Model class is the abstract base for all language model integrations in Agno. It defines the interface for invoking models, streaming responses, and handling tool calls.
Core Attributes
Model identifier (e.g., “gpt-4o”, “claude-3-5-sonnet”).
Optional display name for the model.
Model provider name (e.g., “OpenAI”, “Anthropic”).
Configuration
Controls which tool is called: “none”, “auto”, or specific tool.
System prompt added to the agent.
Additional instructions added to the agent.
Caching
Cache model responses to avoid redundant API calls during development.
Time-to-live for cached responses in seconds.
Directory to store cache files.
Retries
Number of retries to attempt when a ModelProviderError occurs.
Delay in seconds between retries.
If True, delay doubles after each retry.
Enable retrying with guidance message for known avoidable errors.
Methods
invoke()
Synchronous model invocation.ainvoke()
Asynchronous model invocation.invoke_stream()
Stream model responses synchronously.ainvoke_stream()
Stream model responses asynchronously.count_tokens()
Count tokens in messages.Supported Models
Agno provides integrations for major language model providers:- OpenAI:
OpenAIChat,OpenAIReasoning - Anthropic:
Claude - Google:
Gemini - Groq:
Groq - Azure:
AzureOpenAIChat - AWS:
AWSBedrock - Ollama:
Ollama - XAI:
xAI