How s-k-agrawal/apra-agent-kit works
Apra Agent Kit is a modular toolkit for running autonomous agents on Apra Fleet. The main path is a user request entering through chat, HTTP, or MCP, being routed as a task, and executed by the configured run loop with tools and Fleet workers. Separate capabilities add queued jobs, scheduled workflows, notifications, and optional memory. The graph preserves these documented branches and the central pool, adapter, and task layers; unsampled implementation links are omitted or marked unverified rather than inferred.
Main entry points: index.mjs Host lifecycle · worker-dispatcher.mjs Worker dispatcher · server.mjs MCP server · tasks.mjs Task execution
Components 28
Interfaces
- Host lifecycle
host/index.mjs - HTTP routes
host/routes.mjs - Chat UI
host/chat/app.mjs - Comm routing
comm/router.mjs - Azure adapter
comm/azure-functions/http.mjs - MCP server
mcp/server.mjs - MCP tools
mcp/registry.mjs
Agent execution
- Task execution
host/tasks.mjs - Run loop
host/run-loop.mjs - Run strategies
host/strategies - Prompt stages
host/prompts - Tool execution
host/tools/executor.mjs - Guardrails
host/guardrails.mjs - Run budgets
host/budgets.mjs - Agent tools
tools
Fleet workers
- Worker dispatcher
pool/worker-dispatcher.mjs - Worker pool
pool/worker-pool.mjs - Member lifecycle
pool/member-manager.mjs - Pooled Fleet API
pool/pooled-fleet-api.mjs - Fleet transport
transport/stdio-fleet.mjs
Host capabilities
- Jobs backend
host/jobs/interface.mjs - Workflow scheduler
host/scheduler/interface.mjs - Notifications
host/notify/index.mjs - Standalone workflows
workflows/standalone.mjs
State and storage
- Agent memory
host/memory/index.mjs - Memory stores
host/memory/store/interface.mjs - Job stores
host/jobs/store/interface.mjs
Other components
- Agent user
Connections 36
- Agent user → Chat UI: sends request
- Chat UI → HTTP routes: uses host routes
- Agent user → MCP server: invokes tools
- Host lifecycle → HTTP routes: builds routes
host/index.mjs - Host lifecycle → Worker dispatcher: creates dispatcher
host/index.mjs - Host lifecycle → Task execution: executes tasks
host/index.mjs - Host lifecycle → Jobs backend: creates backend
host/index.mjs - Host lifecycle → Agent memory: initializes memory
host/index.mjs - Host lifecycle → Workflow scheduler: configures schedules
host/index.mjs - HTTP routes → Task execution: runs or submits
host/routes.mjs - HTTP routes → Jobs backend: reads and cancels
host/routes.mjs - Comm routing → HTTP routes: dispatches routes
- Azure adapter → Comm routing: uses routing
comm/azure-functions/http.mjs - MCP server → MCP tools: registers tools
mcp/server.mjs - MCP server → Pooled Fleet API: creates leased API
mcp/server.mjs - MCP server → Worker dispatcher: dispatches workers
- Task execution → Worker dispatcher: uses Fleet API
host/tasks.mjs - Task execution → Run loop: runs task loop
host/tasks.mjs - Task execution → Run budgets: applies limits
host/tasks.mjs - Run loop → Run strategies: selects strategy
- Run strategies → Prompt stages: uses prompt stages
- Task execution → Guardrails: checks tool policy
- MCP server → Tool execution: guards execution
mcp/server.mjs - Tool execution → Agent tools: executes registered tools
- Worker dispatcher → Worker pool: dispatches leases
- Worker dispatcher → Member lifecycle: provisions roster
pool/index.mjs - Worker dispatcher → Pooled Fleet API: exposes leased API
pool/pooled-fleet-api.mjs - Standalone workflows → Fleet transport: spawns Fleet
workflows/standalone.mjs - Standalone workflows → Worker dispatcher: creates dispatcher
workflows/standalone.mjs - Standalone workflows → Pooled Fleet API: provides leased API
workflows/standalone.mjs - Jobs backend → Job stores: persists job state
- Workflow scheduler → Jobs backend: queues scheduled work
- Jobs backend → Notifications: emits job updates
- Agent memory → Memory stores: uses configured stores
host/memory/index.mjs - Host lifecycle → MCP server: starts MCP service
host/index.mjs - Host lifecycle → Azure adapter: starts Azure adapter
comm/azure-functions/main.mjs