<@U06QJHRBLQG> I think you were working on the Wor...
# proj-sdk
w
@chilly-france-44439 I think you were working on the Workspace concept. Here's my sample code if it's helpful 🧵
Workspace Setup Usually you’ll want to work with existing code, and maybe have the agent open a pull request.
Copy code
# ... same as "hello world" above

workspace = Workspace(directory=os.getcwd())
workspace.execute_bash("git clone https://github.com/All-Hands-AI/OpenHands")
workspace.execute_bash("git config --global user.name OpenHands") 

conversation = Conversation(agent=agent, workspace=workspace)

# ... same as "hello world" above
Remote Conversations What’s magic 🪄 is that OpenHands Workspaces can run locally, or they can run remotely, inside of a container! So you can scale up to thousands of OpenHands agents, where each one has its own sandbox—and control them all via the same local Python script. To start a remote AgentServer:
Copy code
docker run ghcr.io/all-hands-ai/agent-server:1.0.0 -p 3000:3000
The Python code stays entirely the same! We just need to pass a
host
field to the Workspace. There’s a /workspace/project folder built into the image.
Copy code
# ... same as "hello world" above
workspace = Workspace(host="localhost:3000", directory="/workspace/project")
conversation = Conversation(agent=agent, workspace=workspace)
# ... same as "hello world" above
You can also use Docker volumes to mount a local directory into the image, so you can work with local files, but keep your bash execution sandboxed.
c
yeah sounds good nod this is exactly what i had in mind
highfive 1
Workspace implementation is now working - would appreciate 👀 @wooden-umbrella-84098 https://github.com/All-Hands-AI/agent-sdk/pull/534
w
What does Conversation use
working_dir
for? Is it to set up the tools?
We should definitely not have
working_dir=Workspace()
but we could just rename that param to
workspace
Overall this lgtm though
👍 1
c
What does Conversation use
working_dir
for? Is it to set up the tools?
yep
We should definitely not have
working_dir=Workspace()
but we could just rename that param to
workspace
I will rename and get it merged!
w
I kind of like the idea of pushing
working_dir
back into Workspace, and I feel like we're eventually going to end up there. But I'm OK with making
workspace: str | Workspace
for now
Thanks for taking this on!
c
I feel like we're eventually going to end up there. But I'm OK with making
workspace: str | Workspace
for now
I really want to get rid of the
str |
too -- if you are ok with forcing user to always put in
workspace=Workspace(cwd)
when they start a conversation, i'd be ok with that
w
That seems very reasonable
easy little one-liner
it does add one more import but I think it's OK
can it be None (e.g. if you're not using tools, or default to cwd?)
c
can it be None (e.g. if you're not using tools, or default to cwd?)
we can default to cwd if we want, though i do hope we make this optional so user is aware that the agent can modify their file system to prevent accidents..
w
true