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:
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: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
agents/injector/agent.py