Skip to main content
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.
dependencies.py
from agno.agent import Agent
from agno.models.openai import OpenAIChat

agent = Agent(
    model=OpenAIChat(id="gpt-5-mini"),
    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:
  1. Define dependencies: Provide a dictionary of key-value pairs where values can be static data or callable functions
  2. Resolution: When the agent/team runs, Agno calls all callable dependencies and replaces them with their return values
  3. Template substitution: Resolved dependencies are available in your instructions using {dependency_name} syntax
  4. Context injection: When add_dependencies_to_context=True, dependencies are automatically added to the user message

Learn more