This page is the shortest useful AFK path: install the package, define an agent, attach one typed tool, and run it.Documentation Index
Fetch the complete documentation index at: https://afk.arpan.sh/llms.txt
Use this file to discover all available pages before exploring further.
Prerequisites
- Python 3.13+
- An LLM provider key, such as
OPENAI_API_KEY
1. Define an agent
Agent stores configuration. Runner executes the run. AgentResult.final_text is the assistant response.
2. Add one typed tool
Tools are Python functions with Pydantic argument models. AFK turns the model into a tool schema, validates model-provided arguments, executes the function, and feeds the result back into the agent loop.3. Read the result
Common fields onAgentResult:
| Field | Meaning |
|---|---|
final_text | Final assistant text |
state | Terminal state such as completed, failed, cancelled, or degraded |
run_id | Unique id for this run |
thread_id | Conversation/thread id used by memory |
tool_executions | Ordered records for tool calls |
subagent_executions | Ordered records for subagent calls |
usage_aggregate | Aggregated token usage |
total_cost_usd | Estimated total run cost when available |
4. Keep going
Learn AFK in 15 Minutes
Add streaming, memory, and safety controls.
Examples
Find complete snippets for common scenarios.
Agents
Understand the agent configuration object.
Runner
Understand sync, async, and streaming execution.