Dependencies
Inject variables into agent and team context with dependencies.
Dependencies are a way to inject variables into your Agent or Team context. The dependencies parameter accepts a dictionary containing functions or static variables that are automatically resolved before the agent or team runs.
You can use dependencies to inject memories, dynamic few-shot examples, "retrieved" documents, etc.
Basic usage
You can reference the dependencies in your agent instructions or user message.
from agno.agent import Agent
from agno.models.openai import OpenAIResponses
agent = Agent(
model=OpenAIResponses(id="gpt-5.2"),
dependencies={"name": "John Doe"},
instructions="You are a story writer. The current user is {name}."
)
agent.print_response("Write a 5 second short story about {name}")You can set dependencies on Agent/Team initialization, or pass it to the run() and arun() methods.
How dependencies work
Dependencies are resolved at runtime, just before your agent or team executes. Here's the flow:
- Define dependencies: Provide a dictionary of key-value pairs where values can be static data or callable functions
- Resolution: When the agent/team runs, Agno resolves callable dependencies into values; asynchronous functions require async execution
- Template substitution: Resolved dependencies are available in your instructions using
{dependency_name}syntax - Context injection: When
add_dependencies_to_context=True, dependencies are automatically added to the user message
Agent callables can request the current run input and loaded session by parameter name. See runtime inputs for Agent dependencies; the accepted parameters differ for Teams.