Module dependencies
The AFK architecture is organized around a few stable boundaries:afk.agentsowns declarative agent configuration, policy, prompts, skills, delegation metadata, and A2A contracts.afk.coreowns execution: runner lifecycle, streaming, interaction providers, delegation scheduling, checkpointing, memory wiring, and telemetry wiring.afk.llmsowns model provider adapters, runtime policies, structured output helpers, routing, caching, and LLM request/response types.afk.toolsowns tool definitions, registries, hooks, middleware, sandbox profiles, and prebuilt runtime tools.
Extension points
The framework is designed to be extended at specific protocol boundaries. Do not subclass internal classes. Instead, implement these protocols:InteractionProvider(afk.core): Build custom human-in-the-loop interfaces (for example Slack, Discord, or web approval UIs).MemoryStore(afk.memory): Add support for new databases (Mongo, DynamoDB).LLMProvider(afk.llms): Integrate new model providers (local inference, exotic APIs).TelemetrySink(afk.observability): Export metrics/traces to custom backends (Datadog, Honeycomb).
afk.agents
Agent definitions, lifecycle types, delegation, policy, A2A protocol, and error hierarchy.
Sub-modules:
Key imports:
afk.core
Runner execution engine, streaming, interaction providers, and delegation engine.
Sub-modules:
Key imports:
afk.llms
LLM client builder, provider registry, runtime policies, caching, routing, middleware, and type definitions.
Sub-modules:
Key imports:
afk.tools
Tool definition, registry, hooks, middleware, security, and prebuilt runtime tools.
Sub-modules:
Key imports:
afk.memory
Pluggable memory stores, compaction, retention policies, long-term memory, vector search, and thread state persistence.
Sub-modules:
Key imports:
afk.queues
Task queue abstraction, worker lifecycle, failure classification, and metrics.
Sub-modules:
Key imports:
afk.observability
Telemetry collection, projection, and export for runtime monitoring.
Sub-modules:
Key imports:
afk.evals
Eval suite execution, assertion contracts, budget constraints, and report serialization.
Sub-modules:
Key imports:
afk.mcp
Model Context Protocol server implementation, tool store, and server registration.
Sub-modules:
Key imports:
afk.messaging
Protocol-first agent-to-agent messaging exports.
Sub-modules:
Key imports: