Skip to main content
This page is the shortest useful AFK path: install the package, define an agent, attach one typed tool, and run it.

Prerequisites

  • Python 3.13+
  • An LLM provider key, such as OPENAI_API_KEY
When working from this repository instead of an installed package:

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 on AgentResult:

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.