Stepping back a bit around the git/workspace/runti...
# proj-sdk
w
Stepping back a bit around the git/workspace/runtime discussion, here's a workflow that is going to be very common, which we should have a "hello world" SDK example for • I start an AgentServer • A repo gets cloned • I start an OH conversation • It modifies the repo • It commits and pushes its changes somewhere Right now v1 supports the last 3 steps. But the first 2 steps are still expected to be handled by the client, which means every client needs to reinvent the wheel In v0, those 3 steps are handled by our Runtime objects (they start the ActionExecutionServer somewhere, and handle repo cloning). This actually seems like the right pattern and something we should carry over: some higher-level thing is responsible for getting the workspace set up before we start any kind of agent/conversation I'd like to propose we create a new package in OpenHands/agent-sdk:
openhands/workspace
• This replaces our existing Runtime implementations from the OpenHands repo • Each impl would start an AgentServer ◦ Except for LocalWorkspace • They'd provide the same high-level methods for getting the workspace set up ◦
execute_bash
◦
setup_git_config
◦
clone_repo
◦
get_microagents_from_org_or_user
◦
get_microagents_from_selected_repo
A basic example would look like this
Copy code
workspace = DockerWorkspace()
dest = workspace.clone_repo("https://ghp_asdf@github.com/user/repo")
microagents = workspace.get_microagents(dir=dest)
agent = Agent(microagents=microagents)
conversation = Conversation(agent=agent, workspace=workspace)
c
A quick question: does this imply that the agent-server doesn't support multiple conversations?
w
No I think it'd be fine with multiple conversations
You could attach the same workspace to as many conversations as you want
c
nod as long as the workspace folder is the same
Then, if the client would like to make a
git worktree
for some conversation, it needs to restart the server, or start another server, I guess Please don’t get me wrong, I think this workspace abstraction handles more than 90% expected clients, it’s perfectly fine. And I feel it also fits somehow with the concept of “ephemeral agent-server” better than a server that sits there and somehow runs agents in different folders. It just seemed for a split second that the latter could sort of happen 😅 Just for context, this use case is what I had in mind : https://github.com/All-Hands-AI/agent-sdk/issues/530#issuecomment-3344559179
So I guess this is something that the extension will do itself: • either run only on the default workspace folder, which is what everyone else does • or make a worktree (probably on user choice) for a conversation, and then start a different agent-server on it
w
I think if you're working locally, you don't really have any AgentServers--everything just runs directly in Python. But you could pass a different
working_dir
to the tools for each conversation/worktree
c
That's a good question...
I use the server mainly to receive events, to display in vscode/typescript. Seems straightforward thinky spin