Deps
AgentDeps
dataclass
Dependency Injection container for PydanticAI Agents.
This class encapsulates external resources (specifically the database path) that need to be passed into the Agent's runtime context. It allows the Agent to establish connections dynamically during execution.
Attributes:
| Name | Type | Description |
|---|---|---|
db_path |
str
|
The filesystem path to the DuckDB database file. |
Source code in api/src/agents/deps.py
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | |
get_db_connection(read_only=True)
Creates a new connection to the DuckDB database.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
read_only
|
bool
|
Safety flag to prevent accidental writes. Defaults to |
True
|
Returns:
| Name | Type | Description |
|---|---|---|
DuckDBPyConnection |
DuckDBPyConnection
|
An active database connection object. |
Source code in api/src/agents/deps.py
22 23 24 25 26 27 28 29 30 31 32 | |