The project directory¶
An OpenCode server can serve several projects. Most endpoints take a location that says which one a request is
about. Set a default once on the client:
client = Opencode("http://127.0.0.1:4096", directory="/path/to/repo")
client.agent.list() # (1)!
client.agent.list(location={"directory": "/other"}) # (2)!
- Sent with
location=/path/to/repo. - A per-call
locationoverrides the default.
Without a default, the server uses its own working directory. With OpencodeServer, that is cwd; you can also pass
directory= to server.client().