9router is an experimental, TypeScript-first framework for building arbitrary living-agent systems. It provides typed agent definitions, stable logical identity, private state, concurrent Runs, child agents, plugins, traces, a fast local runtime, a local chat and trace flight deck, and an Elixir/OTP semantic kernel.
The framework does not force a support-agent workflow or require an LLM. Developers can build assistants, coordinators, simulations, automations, games, background systems, or new patterns that do not fit those labels.
This repository is a working prototype, not a production runtime or managed cloud service.
Implemented today:
9routerfor the concise single-package agent, local runtime, and flight deck API.@9router/protocolfor addresses, messages, envelopes, Runs, traces, state snapshots, and capability manifests.@9router/agentsfor typed definitions, lifecycle hooks, state handles, messaging, child agents, timers, signals, tracing, and plugins.@9router/tracingfor redacted trace storage, chronological and tree projections, summaries, NDJSON, and a serialized capability registry.@9router/runtime-localfor in-process development, concurrent waiting Runs, lifecycle behavior, mailbox policies, child lifetimes, plugins, and inspection.@9router/dev-serverfor a loopback local UI with chat, state, Runs, and trajectory views.@9router/clifor project scaffolding, project checks, template discovery, and trace inspection.runtime/beamfor the dependency-free Elixir/OTP semantic kernel prototype.- Three validated starter templates, three focused examples, and one complete launch-room sample application.
- A searchable VitePress documentation site plus repository guidance and reusable skills for coding agents.
Read docs/LIMITATIONS.md before using the prototype for sensitive or production work.
From this repository:
bun install
bun run packages/cli/src/index.ts create ./my-agent --template basic
cd ./my-agent
bun install
bun run check
bun run start
bun run devOpen http://127.0.0.1:3000 after bun run dev. The generated flight deck talks to the real in-process agent runtime and shows state, Runs, and traces.
The basic scaffold starts with one import and either authoring style:
import { agent } from "9router";
export default agent("greeter", message => `Hello ${message}`);Every concise agent requires a stable name because its identity survives individual Runs. Use agent({ name, state, handle }) when the agent needs configuration or private state. Use defineAgent(...) for several independently typed message handlers.
Available templates:
basicfor one stateful agentcoordinatorfor a parent that creates and asks workersworldfor multiple living instances of one definition
bun install
bun run check
bun run example:counter
bun run example:coordinator
bun run example:world
bun run sample:launch-room
bun run sample:launch-room:test
bun run comparison:research-approval:test
bun run comparison:research-approval
bun run docs:buildExamples write NDJSON traces in the current directory. Set TRACE_FILE to choose another path.
TRACE_FILE=counter.ndjson bun run example:counter
bun run trace counter.ndjson tree- Documentation site source
- Getting started
- Launch room sample
- Coding-agent guide
- Concepts
- TypeScript API
- Local runtime
- Local developer server
- BEAM runtime
- Plugins
- Tracing
- CLI
- Testing
- 9router vs Mastra
- Limitations
packages/protocol: shared identifiers, envelopes, Runs, traces, and capability schemaspackages/sdk: the concise9routerpackage entry pointpackages/core: the@9router/agentsauthoring APIpackages/tracing: trace ledger and capability registrypackages/runtime-local: in-memory local runtimepackages/dev-server: typed local HTTP adapter and flight deck serverpackages/cli: scaffolding, checks, template listing, and trace inspectionapps/dev-ui: React/Vite local flight deck adapted from the MIT-licensed DeepSeek Harness frontendruntime/beam: Elixir/OTP semantic runtimeexamples: focused repository demosexamples/launch-room: complete multi-agent sample with tests and a local flight deckcomparisons/research-approval: the same deterministic approval agent implemented and tested in 9router and Mastra.agents/skills: reusable application-building, framework-extension, and verification skillsdocs: VitePress website content and themetemplates: generated starter projectsdocs/research: design research and primary-source notes
- Logical agent identity is separate from its current runtime process.
- A Run is one execution, not the whole agent.
- A waiting Run does not have to block unrelated work. Use
parallelorkeyedconcurrency when that behavior is required. - State belongs to the addressed agent instance. Agents share data only through explicit messages, tools, or developer-defined capabilities.
- Features are replaceable capabilities, not hardcoded product assumptions.
- Current behavior is documented as current behavior. Future managed-platform plans are labeled as future work.
See CONTRIBUTING.md, SECURITY.md, and docs/TESTING.md. All code files must carry a short purpose header and an Updated: YYYY-MM-DD line, except formats that cannot contain comments.