Skip to content
Changelog

Dependency callables can now read the run input and session

ContributorAshpreet BediFounder & CEO

September 8, 20261 min read

Agno passes each callable in an agent's dependencies whichever of agent, run_context, run_input and session it asks for. run_input.input_content holds the user's message, and session gives it the earlier turns.

A docs assistant needs evidence that fits what the user asked, so the docs_context dependency below reads the question straight from run_input.

async def docs_context(run_input) -> str:
    question = run_input.input_content if run_input is not None else None
    return await search_docs(question) if question else "No question supplied."
 
agent = Agent(
    dependencies={"docs_context": docs_context},
    instructions="Answer from this evidence:\n{docs_context}",
)

One agent run in four stages: resolve dependencies, which can now receive run_input and session alongside agent and run_context, then pre-hooks, then build the prompt, then the model call, where a retry reuses the resolved values.

Agno resolves dependencies before pre-hooks, and reuses a value that resolved successfully if the model call is retried. add_dependencies_to_context still defaults to False.

See the cookbook for reference, and learn more about runtime inputs for dependencies in the documentation.

Frequently asked questions

Give the callable in the agent's dependencies a run_input parameter. Agno passes the run input, and run_input.input_content holds the user's message.

A dependency callable can take agent, run_context, run_input and session. Agno passes whichever ones the function asks for. See runtime inputs for dependencies in the documentation.

Dependencies resolve before pre-hooks run. If the model call is retried, Agno reuses any value that resolved successfully.

Shipped around the same time