Skip to main content
Version: v5.8.1

opschain agent dev

packs:agentspacks:agent-governancepacks:ai-agents

One foreground command for the agent development loop, no ceremony: it starts an embedded server over a SQLite home on loopback, silently mints an identity, manifest and registration token for the developer's agent (exactly the objects production holds), enrols it into a sandbox project, supervises the agent process beside it, and serves the full agent tree on the loopback API.

opschain agent dev [-- <agent-command> [args...]]

A trailing -- <agent-command> is supervised (restarted on exit) and fronted; alternatively --target fronts an already-running local process. --child-transport chooses how the supervised process listens:

  • socket (the default on macOS and Linux): the process binds the unix socket named in OPSCHAIN_AGENT_SOCKET. The socket sits in a directory only you can enter, and the process binds it 0600 (the Python stub, opschain_sidecar, does). Refused on Windows (target_socket_unsupported).
  • tcp (the default on Windows, and the switch for a process that can only listen on TCP): the process listens on 127.0.0.1 at the port in OPSCHAIN_AGENT_PORT (also PORT) and verifies every request with the per-start secret in OPSCHAIN_AGENT_HOP_SECRET. Every forwarded request is signed, and the Python stub refuses an unsigned or wrongly signed one.

The secret is generated at every start and never printed. Copies of OPSCHAIN_AGENT_SOCKET, OPSCHAIN_AGENT_PORT and OPSCHAIN_AGENT_HOP_SECRET inherited from your shell are dropped, so the process sees only the transport it was given. When the loop stops it waits for the process (at most 2 seconds for anything still holding its output) before removing the socket directory. --target takes the same forms as opschain agent (opschain docs cli/agent, "Target forms"). --target-insecure is accepted here only, and prints warning: --target-insecure: requests forwarded to <target> are unsigned; any local process can call it at start. With either, the chat capability is declared by default when no --capability is given. On start the command prints the dev server URL and home, the generated admin token (default profile), the agent's surface URLs (…/{healthz,readyz,info,metrics,logs,…}) and Ctrl-C stops the loop (the agent says goodbye first).

In the default profile a trust profile is also seeded: an assets-under-management assignment plus an AUTONOMOUS grant over the sandbox project, edited afterwards with the same opschain admin trust verbs production uses.

Flags​

FlagMeaning
--listen <addr>Loopback listen address for the dev server (default 127.0.0.1:7726 — fixed so the agent's saved identity stays valid across runs of the same home).
--project <code>Sandbox project the agent enrols into (default local).
--name <name>Agent display name (default dev).
--code <code>Agent code under /api/projects/<project>/agents/ (default dev).
--target <target>Front an already-running process instead of supervising one: unix:///path/agent.sock, http://127.0.0.1:<port> (signed with --target-secret-file, or --target-insecure) or https://<host> (signed, or with --target-client-cert and --target-client-key). Mutually exclusive with a -- command.
--target-secret-file <path>File holding the hop secret every request forwarded to --target is signed with (chmod 600, at least 32 characters).
--target-insecureForward to a loopback http:// --target unsigned, with a warning at start. Accepted by agent dev only.
--child-transport socket|tcpHow the supervised -- command listens: socket (an owner-only unix socket in OPSCHAIN_AGENT_SOCKET; the default on macOS and Linux, refused on Windows) or tcp (a loopback port in OPSCHAIN_AGENT_PORT, every request signed with a per-start secret in OPSCHAIN_AGENT_HOP_SECRET; the default on Windows). Applies only with a -- command.
--target-ca-cert <path>PEM CA bundle that verifies an https:// --target (default: the system roots).
--target-client-cert <path>PEM client certificate presented to an https:// --target. Give it with --target-client-key.
--target-client-key <path>PEM private key of --target-client-cert, readable by its owner only (chmod 600).
--transport auto|stream|pollChannel transport (default auto).
--type <type>Declared agent type (vocabulary): service or ai. Local-mode dev needs no entitlement, but on a licensed server AI-type enrolment requires the packs:agent-governance + packs:ai-agents entitlements (a hard dependency of AI-type enrolment).
--owned-by <name>Declared owning user or group — validated against the server's identity catalog at registration; the local sandbox has no identity backend, so it stores unvalidated there.
--purpose <text>Declared purpose/label disclosure (any type): what this agent is for.
--model <ref>AI model disclosure as <provider>/<model>[@version], e.g. anthropic/claude-sonnet-4-5@20250929. Required with --type ai.
--adapter <ref>AI adapter/SDK disclosure as <name>[@version], e.g. opschain-claude-adapter@1.0. Required with --type ai.
--tool-surface <tools>Disclosed estate tools the agent wields, comma-separated — e.g. request_lane,docs,asker_reads. Required with --type ai.
--custody <mode>Model-credential custody disclosure: brokered, agent-host or vault-to-host. Required with --type ai.
--capability name[=json]Declare an optional capability (repeatable; default: chat when a target/command is given).
--dev-home <path>Dev server state directory (default: <opschain home>/agent-dev).
--strictSeed nothing: registration-token ceremony and token-gated telemetry run exactly as production enforces them. The enforcement code is identical in both profiles — they differ only in which rows exist at t=0.
--token <token>Agent registration token (--strict; mint with opschain admin agent-token create).
--admin-token <token>Admin bearer token for the dev server (--strict: required; default profile: generated and printed).

With --strict and no --token, no agent is enrolled: the command prints the exact opschain admin agent-token create invocation to mint one and keeps the server running so you can.

Exit codes​

CodeMeaning
0Clean shutdown (Ctrl-C).
1The embedded server, enrolment or the agent loop failed.
2Usage error.

Named errors​

  • give either an agent command to supervise or --target, not both
  • --transport must be auto, stream or poll
  • --strict runs the full production ceremony: pass --admin-token
  • --capability needs a name (name or name=<json-config>)
  • --child-transport must be socket or tcp
  • --child-transport applies to a supervised agent command (after --)
  • agent target refused (<reason>): <detail>: a refused --target, or --child-transport socket on Windows (target_socket_unsupported). The reasons are listed under opschain docs cli/agent.

All exit 2.

Examples​

Supervise an agent process with the default sandbox:

opschain agent dev -- python my_agent.py

Supervise a process that can only listen on TCP (every request signed):

opschain agent dev --child-transport tcp -- python my_agent.py

Front an already-running process on its socket, declaring a capability explicitly:

opschain agent dev --target unix:///tmp/my-agent/agent.sock --capability chat

A quick unsigned experiment against a process on a loopback port (dev only, with a warning):

opschain agent dev --target http://127.0.0.1:9000 --target-insecure --capability chat

Production ceremony end to end:

opschain agent dev --strict --admin-token <token> --token <registration-token>

See also​

  • opschain docs cli/agent — the production agent daemon this loop develops against.