Skip to content

Agent Workspace ​

Chat shell and file tools run in agent-exec, a separate container with no QDash credentials or network. The Agent Runtime never executes model-written shell commands locally.

Request flow ​

The runtime opens an ExecWorkspace for a conversation and connects over a shared Unix socket. The first tool call creates the directory and starts a pi-env daemon under the owner's uid. Closing the connection stops that daemon's processes.

Branches share their source chat's directory and see its current files. Deleting the last chat using a store removes its workspace. Chats that never use tools create no workspace.

Isolation ​

BoundaryEnforcement
CredentialsScrubbed daemon environment; no QDash token or model key
Networknetwork_mode: none
UsersDistinct owner uids and mode 0700 directories
ContainerRead-only root, bounded resources, restricted capabilities
Runtime socketAccessible to the runtime group, not workspace users

Conversations of the same owner can access each other's files. This is owner isolation, not conversation isolation. Conflicting persisted uid ownership is refused rather than shared.

Configuration ​

VariableDefault / purpose
AGENT_EXEC_SOCKETCompose: /run/agent-exec/exec.sock; unset disables tools
AGENT_EXEC_SOCKET_GID1000, the runtime group
AGENT_EXEC_WORKSPACE_ROOT/workspace
AGENT_EXEC_ISOLATE_USERSOn when the server runs as root
AGENT_EXEC_MEMORY_LIMIT2g
AGENT_EXEC_CPU_LIMIT2

Without a socket the model gets no shell/file tools. Workspace plots reach chat through render_chart; writing a file does not itself display it.

Change and test ​

Run task ci-agent-runtime. The exec protocol/server tests exercise real Unix-socket commands, file operations, cleanup, and malformed requests. User-isolation tests require root.

Add Python packages to agent-runtime/exec/requirements.txt and rebuild agent-exec. Keep arbitrary execution out of the runtime and never add QDash credentials to the exec image.

Implementation files ​

FileResponsibility
agent-runtime/src/exec-env.tsWorkspace lifecycle
agent-runtime/src/exec-relay.tsSocket relay
agent-runtime/exec/protocol.tsConnection validation
agent-runtime/exec/server.tsOwner identity and daemon supervision
compose.yamlContainer isolation and volumes

Released under the Apache 2.0 License.