Skip to main content
The Injector agent shows how to give an agent access to runtime configuration without baking it into the prompt or the tool definitions.
add_dependencies_to_context=True makes the dependencies visible in the system prompt. The agent can refer to them directly:
“Is dark mode enabled?” → reads feature_flags.dark_mode from dependencies, answers “Yes.”
Tools can also access dependencies via RunContext:
The RunContext parameter is auto-injected. Tools that take it get the full request scope: dependencies, user_id, session_id, metadata, messages, even the parent agent.

Static vs per-request dependencies

The Injector example uses static dependencies (defined at agent construction). For per-request dependencies, set them on the run:
Per-request dependencies override the agent-level ones for that single run. Useful for multi-tenant apps where each request brings its own tenant ID, feature set, or DB connection.

What belongs in dependencies vs memory vs knowledge

The lines blur, but the rule of thumb is that dependencies are read-only and ephemeral, memory and knowledge are persistent, and session state is mutable but session-scoped.

See it in action

Source: agents/injector/agent.py

Next

Session State →