Multi-Agent Wiki

Production Multi-Agent Runtime

An architecture for internal coding-agent platforms and agent backends.

This architecture is suitable for an internal coding-agent platform, an agent CLI, an IDE agent backend, or the orchestration layer behind a Claude Code / Codex-style system.

Core modules

ModuleResponsibilityCapabilities to ship
App Server / Session APIReceive requests from user, IDE, CLIsession, stream, cancel, resume
OrchestratorSchedule agents and workflowsplan, route, retry, timeout, checkpoint
Agent RegistryManage agent definitionsname, role, model, tools, permissions, prompt
Task RegistryManage the task treetask id, parent id, status, owner, artifact
Blackboard / Context StoreHold shared facts and artifactsfacts, artifacts, decisions, TTL, provenance
Event Log / TraceRecord every actionmessage, tool call, handoff, state mutation
GuardrailsPermissions and safetypolicy, risk scoring, approval, sandbox
Workspace ManagerIsolate executionworktree, container, snapshot, rollback
Protocol GatewayExpose to other systemsMCP, A2A, Agent Client Protocol
TypeScript
export type AgentDefinition = {
  id: string;
  name: string;
  role: string;
  model: string;
  instructions: string;
  tools: string[];
  permissions: Permission[];
  memoryScope: "none" | "session" | "project" | "global";
};

export type Task = {
  id: string;
  parentId?: string;
  sessionId: string;
  assignedAgent?: string;
  goal: string;
  status: "pending" | "running" | "blocked" | "done" | "failed" | "cancelled";
  input: unknown;
  output?: unknown;
  artifacts?: Artifact[];
  createdAt: string;
  updatedAt: string;
};

export type TraceEvent = {
  id: string;
  runId: string;
  sessionId: string;
  taskId?: string;
  actor: string;
  type: string;
  payload: unknown;
  timestamp: string;
};

Minimal run loop

TypeScript
async function runSession(session: Session) {
  let state = await loadCheckpoint(session.id);

  while (!state.done) {
    const next = await orchestrator.next(state);

    await eventBus.publish({
      type: "workflow.node.enter",
      actor: "orchestrator",
      payload: next,
    });

    const result = await runNode(next, state);
    state = await checkpoint(reduce(state, result));
  }

  return state.finalAnswer;
}

Key principles

  1. Agents are replaceable execution units, not global state containers.
  2. Orchestrators own flow; agents own specialty output.
  3. Blackboard stores facts and artifacts; trace stores process.
  4. All high-risk actions pass through guardrails.
  5. Each agent's context should be minimized, isolated, auditable.