Skip to main content
The VirtualFS SDKs are hand-written clients for the standalone VirtualFS HTTP server documented in the VirtualFS API Reference. They are separate from the generated Conductor SDKs (orcapods, @agent-orc/..., sdks/go) and they target the /vfs/... HTTP surface directly. Use a VirtualFS SDK when application code needs to:
  • Read or write files in tenant-scoped mounts from outside the agent runtime.
  • Run sealed shell commands against the VirtualFS without going through the conductor.
  • Expose VFS as agent tools to OpenAI, Vercel AI SDK, or Claude SDK loops.
  • Provide a sandbox-shaped facade to existing agent runtime code.

Package map

The VirtualFS SDKs ship as four packages in this repository: Runnable examples live under virtualfs/examples/python and virtualfs/examples/typescript. There is no Go VirtualFS SDK. Go callers use virtualfs.New(dispatcher, policy) and Workspace.Execute(ctx, cmd, ExecOpts) directly from the in-process Go package documented in the API Reference Workspace Execute section.

Server prerequisites

Every SDK client speaks the structured /vfs/... surface plus POST /vfs/exec. Boot a server before running any SDK example:
Defaults:
  • Standalone serve listens on :8080. The compose-backed VirtualFS service published by docker-compose.yml listens on :8090.
  • Without VFS_AUTH_TOKEN, the server uses smokeAuth and accepts any bearer token, including the default dev-token printed in the boot banner. Set VFS_AUTH_TOKEN for any non-local deployment.
  • The smoke driver seeds /s3/log.jsonl and /s3/report.parquet unless --seed=false is passed.
Common environment variables consumed by the SDKs and examples:
When VirtualFS is fronted by the conductor (/api/vfs/*) or the Vercel-hosted dashboard (/vfs/* rewrite), client Authorization headers are stripped and the proxy injects Bearer ${VFS_AUTH_TOKEN} server-side. The SDK token argument is for direct use against a standalone or Railway-hosted VirtualFS — not for browser code that already routes through one of those proxies.

Python: agent-orc-vfs

A thin async + sync HTTP client built on httpx and Pydantic v2.

Install

The package is not yet on PyPI. Install from the repo:
For editable development with uv:
Runtime requirements: Python >=3.11, httpx>=0.27, pydantic>=2.7.

Workspace

Workspace is the entry point. It carries declared mount metadata used by file_prompt and by validate() plus a base URL and bearer token used by every HTTP call.
Constructor signature:
The instance lazily opens an httpx.AsyncClient and httpx.Client the first time async or sync methods are called. Both close paths are explicit:

Mount factories

Mount specs declare the backend each path is expected to be backed by. The server validates the declaration at connect time via validate().
Both return frozen dataclasses (RamMount, R2Mount). Clients cannot register additional mount kinds; the server is the source of truth for which paths exist. Call validate() (or validate_sync()) to assert that every declared path exists on the server and that its kind, bucket, and endpoint match. See Strict mount validation.

Typed file operations

Every async helper has a sync sibling. All operations target the typed POST /vfs/... endpoints described in the API reference.

Strict mount validation (Python)

Call validate() immediately after constructing Workspace so a misconfigured server fails fast instead of silently routing reads to the wrong store.
Validation raises:
  • MountMismatch — a declared path is not registered on the server, or the backend kind / bucket / endpoint does not match what the server reports.
  • MountUnavailable — the server has the mount but its backend failed to initialize at boot; the server-reported reason is included in the exception message.

Shell execution

execute and execute_sync post to POST /vfs/exec. There is no host shell fallback; unsupported syntax raises a VfsError subclass.

Response models

All responses are Pydantic v2 models. Use .model_dump() for plain dicts.

file_prompt

ws.file_prompt returns a system-prompt fragment describing the configured mounts. Pass it to the agent’s instructions or prepend it to the system prompt.
Override the rendering by passing file_prompt_template=callable to the constructor.

OpenAI function tools

tools(ws) returns a list of OpenAI chat-completions tool dicts. Each entry carries an extra executor callable used for local dispatch. The surface is intentionally two tools:
Helpers exposed alongside tools(...):

Errors

All non-2xx responses are mapped to typed exceptions:
Each exception carries code (string), message, and detail (dict). The shared error code table is in Error codes below.

TypeScript: @agent-orc/vfs

An ESM + CJS package that ships a thin Workspace HTTP client, mount factories, a Vercel AI SDK / OpenAI tool bundle, and an in-package SandboxClient facade.

Install

The package is not published to npm. Install it from this repository:
Build outputs ship to dist/index.js (ESM), dist/index.cjs (CJS), and dist/index.d.ts. The only runtime dependency is zod ^3.23.8.

Workspace

Constructor signature:
The client uses the global fetch and exposes one request<T>(method, path, body?) private helper that injects Authorization: Bearer <token> and parses non-2xx responses through parseErrorResponse.

Mount factories

Mount union: Mount = R2Mount | RamMount | NotionMount. NotionMount is a placeholder for a future driver. describeMountAt(mountPath, mount) is exported for custom prompt templates.

Typed file operations

Strict mount validation (TypeScript)

Call validate() immediately after constructing Workspace so a misconfigured server fails fast instead of silently routing reads to the wrong store.
Validation rejects with:
  • MountMismatch — a declared path is not registered on the server, or the backend kind / bucket / endpoint does not match what the server reports.
  • MountUnavailable — the server has the mount but its backend failed to initialize at boot; the server-reported reason is included.
The TypeScript stat() swallows NOT_FOUND and returns null, while the Python stat() raises NotFound. Pick one shape per call site rather than mixing.

Response types

file_prompt

ws.file_prompt is a getter, not a method. It renders the configured mounts using defaultFilePromptTemplate unless opts.filePromptTemplate was supplied.

Agent tools

tools(ws) returns a VfsTools object compatible with the Vercel AI SDK tools: argument and with manual OpenAI function-calling loops. Each entry has a Zod inputSchema and an execute(input) callable that routes through Workspace.
The two-tool surface mirrors the Python adapter: vfs_execute returns { stdout, stderr, exitCode, durationMs }, and vfs_grep returns { matches }.

SandboxClient

The TypeScript SDK ships its sandbox facade in-package. There is no separate @agent-orc/openai-vfs for TypeScript; the OpenAI Agents adapter is Python-only.

Errors

The TypeScript SDK uses a single VfsError class with code, message, httpStatus, and optional allowed. There are no per-code subclasses; branch on err.code instead.

Claude adapter: @agent-orc/claude-vfs

A TypeScript-only adapter that exposes Claude’s Bash tool and routes its invocations through Workspace.execute(). Lives at virtualfs/sdk/adapters/claude-sdk.

Install

The adapter has @anthropic-ai/sdk as an optional peer dependency (>=0.26.0); the adapter itself does not import the SDK at module load time, so it can be used with any Anthropic SDK loop or with no SDK at all.

Surface

bashTool(ws) returns { definition, handler }:

Usage

Behavior notes

  • restart: true is a no-op. The VFS shell is stateless, so the handler returns a notice with exit_code: 0 instead of clearing any session state.
  • An empty command string returns { output: "", exit_code: 0 }.
  • stdout and stderr are concatenated into output; stderr is appended after stdout when both are present.
  • Any thrown error (VfsError, network error, etc.) is caught and surfaced as { output: error.message, exit_code: 1 } so the agent loop can keep running.
This adapter is not a sandbox: Claude itself runs locally, only its Bash tool calls are intercepted. For a sandbox-shaped facade, use SandboxClient from @agent-orc/vfs (TypeScript) or agent-orc-vfs-openai (Python).

OpenAI Agents adapter: agent-orc-vfs-openai

A Python-only adapter that wraps a Workspace in a sandbox-shaped facade for agent runtime code that expects BaseSandboxClient-style operations. Lives at virtualfs/sdk/adapters/openai-agents.

Install

The adapter intentionally does not import openai-agents at module load time. The OpenAI Agents SDK’s sandbox surface (BaseSandboxClient, SandboxSession) is still beta; this package exposes a smaller SandboxClientProtocol that is direct-protocol compatible today and can be wrapped in the future when agent-orc adopts the official shape.

Surface

Methods

Usage

VfsError and its subclasses propagate from run_command, read_file, and write_file exactly as they do from the underlying Workspace.

Error codes

Every endpoint uses the shared { "error": { "code", "message", ... } } envelope. The Python SDK maps each code to a dedicated exception class; the TypeScript SDK exposes a single VfsError and asks callers to branch on code. The cmd shape that triggers UNSUPPORTED_SHELL_FEATURE and the full builtin list live in the Shell Parser and Compiler section of the API reference.

Examples

Runnable scripts ship with the SDKs: To run them, boot a server with go run ./virtualfs/cmd/vfs serve, export VFS_BASE_URL and VFS_TOKEN, then follow the README.md in the example directory.