Model resolution
Agents can specify their model in two ways:- Model name (auto-resolved)
- Pre-built client
Pass a model name string. AFK resolves it to an LLM client using the default provider.The resolution order:
- Check
agent.model_resolver(custom function) - Check registered adapters for matching provider prefix
- Default to OpenAI adapter
How the runner uses the LLM
On each step of the agent loop:Request construction
The runner builds anLLMRequest from multiple sources:
Streaming integration
When usingrun_stream(), the runner passes through streaming events from the LLM:
text_delta events come from two paths:
- Provider streaming when the adapter supports stream deltas.
- Runner fallback chunking of final text for non-streaming providers.
Error handling
LLM errors are classified and handled automatically:Model selection guide
Treat these as example starting points. Confirm current model names, prices, and rate limits with the provider you use.Next steps
Core Runner
The step loop and execution engine.
Streaming
Real-time event streaming API.