Skip to content

Latest commit

 

History

History
48 lines (37 loc) · 1.58 KB

File metadata and controls

48 lines (37 loc) · 1.58 KB

Protocol and SDKs

The wire specification lives in opagent-protocol/spec.md. The Protocol uses JSON-RPC 2.0 over persistent transports, with newline-delimited JSON for stdio and MCP-compatible streamable HTTP support.

SDKs

Go module:

github.com/colinagent/opagent/opagent-protocol/go-sdk
server := op.NewServer(&op.Implementation{Name: "my-agent", Version: "0.1.0"}, nil)
server.AddAgent(meta, handler)
err := server.Run(ctx, &op.StdioTransport{})

The TypeScript SDK is under opagent-protocol/ts-sdk:

cd opagent-protocol/ts-sdk
npm ci
npm test
npm run build

Compatibility rules

  • Preserve JSON-RPC request IDs and unknown _meta keys when forwarding.
  • Treat content as a discriminated union by type; JSON content uses payload on the wire.
  • Unknown opcodes must produce an explicit unsupported/invalid-params result, never be silently interpreted as a privileged operation.
  • Transports must unblock pending reads and writes during close.
  • Product extensions belong in namespaced SystemConfig.Extensions or UserConfig.Extensions; reusable SDK types do not own product configuration.
  • Protocol additions should be optional or capability-negotiated. A breaking wire change requires a new protocol version.

Operation groups

The SDK defines agent calls, generic node operations, thread lifecycle and control, permission/approval operations, scheduling, and typed notifications. The generic Server deliberately exposes only a small HTTP projection of these operations; Protocol is the richer embedding boundary.