Janus is a durable agent task broker. It sits between agents and reliably delivers tasks with governance, routing, and observability.
Janus is layered into four planes. External clients enter through protocol gateways; stateless core services own the task lifecycle, governance, and background workers; all durable state is externalized. Every layer scales independently.
agents & tooling that talk to Janus
authentication · protection · rate limiting
protocol adaptation & authentication
stateless · horizontally replicated
externalized state · highly available
The ingress plane only adapts protocols. Core services own state machines and governance. PostgreSQL is the source of truth; NATS carries deliveries and events; Redis holds only heartbeats and rate counters.
The ingress plane does only protocol adaptation and authentication — it holds no business logic. The core services own the task state machine, policy enforcement, budget accounting, and audit; they are stateless and scale horizontally. Background workers (outbox publisher, event projector, lease scanner, heartbeat sweep) run independently and coordinate through database leases and idempotency keys, so multiple replicas never double-deliver.
PostgreSQL is the source of truth for task state, the transactional outbox, budgets, and audit projections. NATS JetStream carries task deliveries and domain events through durable streams and per-mailbox consumers. Redis holds only agent heartbeats and short-window rate counters — never durable facts.
accepted and queued never loses a task.The fundamental unit of work. A task carries an opaque payload (the envelope) from a source agent to a target consumer. Every task has a unique ID, a tenant scope, and a lifecycle state:
pending → claimed → in_progress → completed
→ failed
→ nacked → pending (retry)
→ dlq
A named queue where tasks are delivered. Agents pull tasks from a mailbox they own. Mailboxes are durable — if an agent crashes, tasks remain until the agent comes back and pulls them.
Key properties:
When an agent pulls a task, it receives a time-bound lease. The lease prevents other agents from claiming the same task. If the agent crashes without ACKing:
pending and becomes available for another agent to pullThe payload wrapper. Contains:
type — message type identifierpayload — the actual data (structured JSON)priority — high / normal / lowcontext_refs — references to shared artifacts (files, images, previous results)Janus routes every task to the right agent through five target types:
mailbox or agenttarget_type: capability and Janus finds an online agent that declares that capabilitytarget_type: group to deliver to a team. Group membership comes from the team field on each agent's registration — Janus resolves the team to its online members' active mailboxes automaticallytarget_type: intent with a natural-language description. With LLM configured (JANUS_LLM_ENABLED), Janus maps the text to the best matching capability, validates it against the live catalog, then routes deterministically; without LLM, a keyword matcher is used as fallbackEvery task dispatch passes through policy and budget checks:
Janus speaks multiple agent communication protocols natively:
Tasks are dual-written to PostgreSQL (source of truth) and NATS JetStream (fast delivery). If the broker process crashes mid-flight:
Every task, mailbox, and artifact is scoped to a tenant. Cross-tenant access is automatically denied. All audit events are tagged with tenant ID.