# AFK ## Docs - [AFK - Agent Forge Kit](https://afk.arpan.sh/index.md): Build reliable Python agents with typed tools, runtime controls, and production observability. - [Agent-to-Agent (A2A)](https://afk.arpan.sh/library/a2a.md): Cross-system agent communication with authentication and delivery guarantees. - [Agent Skills](https://afk.arpan.sh/library/agent-skills.md): Reusable knowledge bundles that agents load on demand. - [Agentic Behavior](https://afk.arpan.sh/library/agentic-behavior.md): Orchestrate multi-agent DAGs with fan-out, join policies, and backpressure. - [Agentic Levels](https://afk.arpan.sh/library/agentic-levels.md): A capability maturity model — know when to add complexity. - [Agents](https://afk.arpan.sh/library/agents.md): Define agents with instructions, tools, and subagents. - [API Reference](https://afk.arpan.sh/library/api-reference.md): Canonical public imports and core signatures for AFK. - [Architecture](https://afk.arpan.sh/library/architecture.md): How AFK separates orchestration from execution. - [Building with AI](https://afk.arpan.sh/library/building-with-ai.md): Production playbook — patterns, anti-patterns, and deployment guidance. - [Checkpoint Schema](https://afk.arpan.sh/library/checkpoint-schema.md): Checkpoint structure and resume correctness guarantees. - [Configuration Reference](https://afk.arpan.sh/library/configuration-reference.md): Every configurable field across Agent, Runner, FailSafeConfig, and SandboxProfile. - [Core Runner](https://afk.arpan.sh/library/core-runner.md): Execute agents — lifecycle, API modes, streaming, and state management. - [Debugger](https://afk.arpan.sh/library/debugger.md): Debug-mode runner setup with redacted event payloads and live event taps. - [Deployment](https://afk.arpan.sh/library/deployment.md): Deploy AFK agents to production with Docker, Kubernetes, and scaling patterns. - [Developer Guide](https://afk.arpan.sh/library/developer-guide.md): Maintainer workflow for changing AFK itself. - [Environment Variables](https://afk.arpan.sh/library/environment-variables.md): Environment variable reference for AFK defaults and backend configuration. - [Evals](https://afk.arpan.sh/library/evals.md): Behavioral testing for agent quality — assertions, budgets, and CI integration. - [Getting Started](https://afk.arpan.sh/library/examples/index.md): Scenario-based examples for every major AFK feature. - [Failure Policy Matrix](https://afk.arpan.sh/library/failure-policy-matrix.md): How errors flow through the system — classification, handling, and escalation. - [Full Module Reference](https://afk.arpan.sh/library/full-module-reference.md): Module inventory and responsibilities. - [How to Use AFK](https://afk.arpan.sh/library/how-to-use-afk.md): A practical adoption path from first agent to production release. - [Learn AFK in 15 Minutes](https://afk.arpan.sh/library/learn-in-15-minutes.md): A guided path through agents, tools, streaming, memory, and safety. - [LLM Interaction](https://afk.arpan.sh/library/llm-interaction.md): How runner and llms runtime exchange requests and responses. - [MCP Server](https://afk.arpan.sh/library/mcp-server.md): Expose and consume tools via the Model Context Protocol. - [Memory](https://afk.arpan.sh/library/memory.md): Persist conversation state, resume runs, and compact threads. - [Mental Model](https://afk.arpan.sh/library/mental-model.md): Three coordinated loops that drive every AFK agent. - [Internal Messaging](https://afk.arpan.sh/library/messaging.md): Agent-to-agent messaging with delivery guarantees and idempotency. - [Migration Guide](https://afk.arpan.sh/library/migration.md): Move from LangChain, OpenAI Assistants, or custom agents to AFK. - [Observability](https://afk.arpan.sh/library/observability.md): Built-in telemetry with spans, metrics, and exporters. - [What is AFK?](https://afk.arpan.sh/library/overview.md): The short mental model for building and maintaining AFK agents. - [Performance](https://afk.arpan.sh/library/performance.md): Improve AFK latency, throughput, and cost without relying on internal APIs. - [Public API Rules](https://afk.arpan.sh/library/public-imports-and-function-improvement.md): Maintainer rules for preserving AFK's public import contract. - [Quickstart](https://afk.arpan.sh/library/quickstart.md): Build one AFK agent with one typed tool. - [Run Event Contract](https://afk.arpan.sh/library/run-event-contract.md): Runtime event schema and event consumption guidance. - [Security Model](https://afk.arpan.sh/library/security-model.md): Security boundaries, policy engine, and production hardening. - [01: Minimal Chat Agent](https://afk.arpan.sh/library/snippets/01_minimal_chat_agent.md): Smallest synchronous AFK agent run. - [02: Policy with Human Interaction](https://afk.arpan.sh/library/snippets/02_policy_with_hitl.md): Route sensitive actions through policy and human approval. - [03: Subagents with Router](https://afk.arpan.sh/library/snippets/03_subagents_with_router.md): Delegate workload to specialist subagents and merge outputs. - [04: Resume and Compact](https://afk.arpan.sh/library/snippets/04_resume_and_compact.md): Resume interrupted runs from their last checkpoint and compact retained thread memory to control storage growth. - [05: Direct LLM Structured Output](https://afk.arpan.sh/library/snippets/05_direct_llm_structured_output.md): Use afk.llms with schema-validated responses. - [06: Tool Registry Security](https://afk.arpan.sh/library/snippets/06_tool_registry_security.md): Safe tool registration and guardrail practices. - [07: Tool Hooks and Middleware](https://afk.arpan.sh/library/snippets/07_tool_hooks_and_middleware.md): Add pre-execution validation, post-execution transformation, and cross-cutting middleware to tools and the LLM client pipeline. - [08: Prebuilt Runtime Tools](https://afk.arpan.sh/library/snippets/08_prebuilt_runtime_tools.md): Use AFK's built-in filesystem tools with directory-scoped security constraints and compose them with policy checks. - [09: System Prompt Loader](https://afk.arpan.sh/library/snippets/09_system_prompt_loader.md): Resolve agent system prompts from a file hierarchy with deterministic precedence, Jinja templating, and stat-based caching. - [10: Streaming Chat with Memory](https://afk.arpan.sh/library/snippets/10_streaming_chat_with_memory.md): Combine real-time streaming with thread-based memory for multi-turn chat UIs. - [11: Cost Monitoring](https://afk.arpan.sh/library/snippets/11_cost_monitoring.md): Track and control agent costs using FailSafeConfig budgets and telemetry events. - [12: MCP Client Integration](https://afk.arpan.sh/library/snippets/12_mcp_client_integration.md): Discover and use tools from external MCP servers in your agents. - [13: Multi-Model Fallback](https://afk.arpan.sh/library/snippets/13_multi_model_fallback.md): Configure fallback model chains for LLM resilience and cost optimization. - [14: Client Timeouts and Redis Pooling](https://afk.arpan.sh/library/snippets/14_production_client.md): Configure LLM client timeouts and Redis connection pooling. - [Streaming](https://afk.arpan.sh/library/streaming.md): Real-time event streaming for chat UIs and CLI tools. - [System Prompts](https://afk.arpan.sh/library/system-prompts.md): Configure agent instructions with files, templates, and dynamic context. - [Task Queues](https://afk.arpan.sh/library/task-queues.md): Async job processing with execution contracts and dead-letter handling. - [Tested Behaviors](https://afk.arpan.sh/library/tested-behaviors.md): Contract-level guarantees and what test suites validate. - [Tool Call Lifecycle](https://afk.arpan.sh/library/tool-call-lifecycle.md): Detailed event-level view of one tool invocation. - [Tools](https://afk.arpan.sh/library/tools.md): Give agents typed capabilities through Python functions. - [Tools System Walkthrough](https://afk.arpan.sh/library/tools-system-walkthrough.md): From tool registration to runtime execution and model feedback. - [Troubleshooting](https://afk.arpan.sh/library/troubleshooting.md): Common issues and solutions when building with AFK. - [Adapters](https://afk.arpan.sh/llms/adapters.md): Built-in LLM providers and custom adapter registration. - [Agent Integration](https://afk.arpan.sh/llms/agent-integration.md): How agents resolve models and interact with the LLM layer. - [Contracts](https://afk.arpan.sh/llms/contracts.md): LLMRequest and LLMResponse — the data that flows across the LLM boundary. - [Control & Session](https://afk.arpan.sh/llms/control-and-session.md): Retry, caching, rate limiting, and circuit breaking for LLM calls. - [LLM Layer](https://afk.arpan.sh/llms/index.md): Provider-portable LLM runtime with retry, caching, circuit breaking, and middleware. ## OpenAPI Specs - [openapi](https://afk.arpan.sh/api-reference/openapi.json)