Embedded SDK
The embedded runner reads YAML manifests from disk, registers them in an in-process runtime, and runs them locally with no network hop. Use @agntz/sdk in TypeScript or agntz in Python. Both load the same agent YAML and expose the same resource shape with language-native option names.
Node 22+ for TypeScript. Python 3.11+ for Python. Universal clients that cannot read from the local filesystem should use the hosted client instead.
Basic usage
agntz(options)
Returns an initialized local client. Validation errors throw at startup, so misconfigured agents do not make it past process boot.
| TypeScript option | Python option | Description |
|---|---|---|
agents | agents | Path to a directory of .yaml files |
tools | tools | Local tool definitions |
resources | resources | Resource providers keyed by kind, such as memory |
store | store | Optional persistence |
defaultModel | model_provider | Python passes a concrete provider; TypeScript can default model config |
onEvent | N/A | TypeScript event hook for full local event stream |
Runtime API
Run an agent
Run with resource grants
Pass context when the run needs access to a resource such as memory. This is a namespace grant array, not the legacy contextIds scratchpad.
Agents that declare resources: also need matching providers at construction time:
See Context and resources, Resources schema, and Memory with memrez.
Stream or inspect
TypeScript local streaming includes token deltas and tool-loop events. Python local streaming currently emits start and complete snapshots; use the hosted Python client for full worker SSE streaming.
Runs and traces
Persistence
The same store backs sessions, runs, and traces. Without a configured store, TypeScript uses bounded in-memory history. SQLite persists messages, runs, and trace spans in the same file across client instances.
Call await client.close() during process shutdown to flush pending trace writes and close owned SQLite and MCP connections. The TypeScript close operation is idempotent.
Persisted stores also keep agent versions and aliases. References can be a bare id, agent@latest, an exact created-at version, or an alias. In-memory registered agents run by id only; use a store when you need version history.
Import and migration surfaces
The embedded client mirrors the hosted import APIs so local state can move to a worker later.
The CLI uses the same resources for agntz publish agents sessions memory.
Datasets and eval records
Local clients include the same dataset/eval resource shape as hosted clients. Use it to run evals before pushing an agent to a worker, then publish the definitions and results when you are ready.
Errors
The hosted clients expose structured HTTP error classes. Local embedded execution raises Python or TypeScript runtime errors directly.
Switching to hosted
When you're ready to graduate, swap constructors and keep the same resource shape:
agents.run, runs.list, and traces.get stay the same. Local tools must be promoted to HTTP or MCP servers when the runtime moves out of your process.