AI Agents

  • Area: Intelligence
  • Path: ai/agents
  • Kind: Autonomous agent runtime (REST + WebSocket API)
  • Version: v0.2.1
  • Status: Active

Role in the stack

AI Agents is the execution layer for autonomous AI agents within the Koder stack. It exposes a REST + WebSocket API that other Koder products can call to run multi-step reasoning tasks, decompose complex goals into parallel swarms, and connect to external tools via MCP.

Key capabilities added in v0.2.1:

  • Context Compression — long sessions summarise their own history, keeping sessions coherent beyond the model's context window
  • Dynamic Swarm Planner — LLM-driven goal decomposition into a parallel task DAG, executed via the worker pool
  • Federated Agent Registry — external agents (any model, any device) register and participate in swarms

Primary couplings

Dependency Relationship
ai/gateway All LLM calls (reasoning, compression, planning, synthesis) routed through gateway
ai/mcp MCP server registry for tool discovery and execution
data/sqlite Agent definitions, run history, memories, MCP server configs

Public interfaces

REST

  • POST /v1/agents — create agent
  • POST /v1/agents/:id/runs — submit run (strategy: react / chain-of-thought / plan-and-execute)
  • GET /v1/agents/:id/runs/:runId — poll status / result
  • POST /v1/swarm/runs — dynamic swarm execution (goal → DAG → parallel)
  • POST /v1/swarm/plan — inspect DAG without executing
  • POST /v1/registry/agents — register external peer
  • POST /v1/registry/agents/:id/heartbeat — liveness signal

WebSocket

  • WS /v1/agents/:id/runs/:runId/stream — real-time step events (think / act / observe / completed)

Config (env)

Variable Default Description
AGENTS_PORT 7804 HTTP port
AGENTS_GATEWAY_URL http://localhost:7800 LLM gateway
AGENTS_MAX_CONCURRENT 10 Worker pool size
AGENTS_CONTEXT_MAX_TOKENS 128000 Context window limit
AGENTS_CONTEXT_THRESHOLD 0.8 Compression trigger ratio
AGENTS_SWARM_MAX_AGENTS 20 Max parallel swarm sub-agents