Documentation

Core Concepts

Janus is a durable agent task broker. It sits between agents and reliably delivers tasks with governance, routing, and observability.

📡
Producer
Agent
Janus
Broker
🤖
Consumer
Agent
🗄️
PostgreSQL + NATS
Durable Store

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

Mailbox

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:

Lease

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:

Envelope

The payload wrapper. Contains:

Routing & Capability Resolution

Janus supports two dispatch modes:

The Intent Resolver accepts natural language descriptions and matches them to registered agent capabilities:

client.resolve_intent("Review a Go pull request for race conditions")
# → Confidence: 0.92
# → Matched capability: "go-code-review"
# → Suggested target: "review-mb"

Governance

Every task dispatch passes through policy and budget checks:

Protocol Gateways

Janus speaks multiple agent communication protocols natively:

Durability Model

Tasks are dual-written to PostgreSQL (source of truth) and NATS JetStream (fast delivery). If the broker process crashes mid-flight:

Tenant Isolation

Every task, mailbox, and artifact is scoped to a tenant. Cross-tenant access is automatically denied. All audit events are tagged with tenant ID.

Janus uses dual-write persistence (PG + NATS) for durability. The broker survives agent crashes, network partitions, and its own restarts without losing tasks.