Agent behavior issues
Agent keeps calling the same tool repeatedly
Symptoms: Agent enters a loop, calling the same tool multiple times without making progress. Causes:- Tool output doesn’t provide the information the agent needs
- Agent instructions don’t clarify when to stop
- Missing a tool that would help the agent determine completion
Agent ignores tools and doesn’t call them
Symptoms: Agent responds with text but doesn’t use available tools. Causes:- Instructions don’t mention the tools or when to use them
- Tool descriptions are unclear
- Model being used doesn’t support function calling well
Agent produces inconsistent outputs
Symptoms: Same input produces different outputs on different runs. Causes:- Temperature is set too high
- Missing structured output configuration
- Non-deterministic system prompt
Memory issues
Conversation doesn’t persist between runs
Symptoms: Agent doesn’t remember previous messages. Causes:- Not using
thread_idto link conversations - Memory store not configured correctly
- Using in-memory store (loses state on restart)
Resume doesn’t work
Symptoms: Callingrunner.resume() doesn’t continue from where the run stopped.
Solutions:
LLM issues
Rate limit errors
Symptoms:RateLimitError or 429 responses from LLM provider.
Solutions:
Timeout errors
Symptoms: Requests hang or timeout before completing. Solutions:Model not found errors
Symptoms:ModelNotFoundError or InvalidRequestError.
Solutions:
Streaming issues
Streaming doesn’t work
Symptoms:run_stream() doesn’t return events or returns them all at once.
Solutions:
Streaming disconnects early
Symptoms: Stream ends before completion. Solutions:Cost issues
Unexpected high costs
Symptoms: API costs much higher than expected. Causes:- Agent in a loop making many LLM calls
- No cost limits configured
- Expensive model being used unnecessarily
Token limit errors
Symptoms:ContextLengthExceeded or similar errors.
Solutions:
Tool issues
Tool validation errors
Symptoms:ToolValidationError when tools are called.
Solutions:
Tool not found errors
Symptoms: Agent can’t find or call a tool. Solutions:Debug mode
Enable debug mode for detailed logging:Getting help
If you can’t resolve an issue:- Check the GitHub Issues for known issues
- Enable debug logging and capture the full traceback
- Include these details when reporting:
- AFK version (
pip show afk) - Python version
- LLM provider and model
- Minimal reproduction code
- Full error traceback
- AFK version (
Next steps
Core Concepts
Understand how AFK components work together.
Evals
Test agent behavior before shipping.
Building with AI
Common patterns and anti-patterns.
API Reference
Detailed API documentation.