Dependencies

Inject a live appointment snapshot through Clinic’s callable dependencies.

This walkthrough follows Demo OS at the reviewed revision, which pins Agno 2.8.1. Use the application’s checked-in requirements.

Clinic demonstrates request-time context through callable dependencies. Its patient_appointments callable reads the operational appointment database; its current_patient_id callable resolves the sample caller identity.

The shared dependency mapping in teams/clinic/team.py is:

_dependencies = {
    "patient_appointments": get_patient_context,
    "current_patient_id": current_patient_id,
}

Clinic and both members receive this mapping with add_dependencies_to_context=True. In this pinned framework version, the resolved additional context is added to the user message during message preparation.

Static vs per-request dependencies

A static value can supply configuration. A callable supplies data for the run. get_patient_context(run_context) reads run_context.user_id, maps it through the demo’s patient resolver, and executes a parameterized appointment query using :pid.

RunContext contains identifiers, session state, dependencies, metadata, and other run data. It has no agent attribute; a dependency callable can request a separate agent parameter when it needs the owning Agent.

What belongs in dependencies vs memory vs knowledge

MechanismClinic example
DependenciesA current appointment snapshot fetched for this run
KnowledgeSearchable patient record documents
Session stateMutable data associated with a conversation
Learning or memoryInformation intentionally retained for later use

Dependencies are runtime inputs, not a persistent store. They are mutable configuration, and prompt-visible values may be persisted with run messages.

See it in action

Seed Clinic’s synthetic data, then select Clinic and ask for upcoming appointments. Compare the answer with the operational tables and inspect the resolved context.

Use synthetic data for this demo. Its patient mapping accepts sample IDs and defaults unknown callers to a sample patient; record filters are selected by the model. These are demo policies, not production patient authorization controls.

Next

teams/clinic/context.py · teams/clinic/team.py · teams/clinic/patients.py

Run Demo OS · Current AgentOS documentation