Skip to main content
To build effective agents, start simple: a model, tools, and instructions. Once that works, layer in more functionality as needed. For example, here’s the simplest possible agent with access to HackerNews:
hackernews_agent.py

Run your Agent

Use Agent.print_response() for development. It prints the response in a readable format in your terminal. For production, use Agent.run() or Agent.arun():

Callable Factories

Pass a function instead of a static list for tools or knowledge. The function is called at the start of each run, so the toolset or knowledge base can vary per user or session.
callable_tools.py

Callable Caching Settings

Factory results are cached by default. The cache key is resolved in this order: custom key function > user_id > session_id. If none are available, caching is skipped and the factory runs every time.
SettingDefaultDescription
cache_callablesTrueEnable or disable caching for all callable factories
callable_tools_cache_keyNoneCustom cache key function for tools factory
callable_knowledge_cache_keyNoneCustom cache key function for knowledge factory
callable_members_cache_keyNoneCustom cache key function for members factory (Team only)
Set cache_callables=False when session_state changes between runs and the factory should re-evaluate each time. Clear cached results programmatically:
Use aclear_callable_cache() in async code.

Next Steps

After getting familiar with the basics, add functionality as needed:
TaskGuide
Run agentsRunning agents
Debug agentsDebugging agents
Manage sessionsAgent sessions
Handle input/outputInput and output
Add toolsTools
Manage contextContext engineering
Add knowledgeKnowledge
Handle images, audio, video, filesMultimodal
Add guardrailsGuardrails
Cache responses during developmentResponse caching