Skip to content

pydantic_ai.dependencies

AgentDeps module-attribute

AgentDeps = TypeVar('AgentDeps')

Type variable for agent dependencies.

CallContext dataclass

Bases: Generic[AgentDeps]

Information about the current call.

deps instance-attribute

deps: AgentDeps

Dependencies for the agent.

retry instance-attribute

retry: int

Number of retries so far.

tool_name instance-attribute

tool_name: str | None

Name of the tool being called.

RetrieverParams module-attribute

RetrieverParams = ParamSpec('RetrieverParams')

Retrieval function param spec.

SystemPromptFunc module-attribute

A function that may or maybe not take CallContext as an argument, and may or may not be async.

Usage SystemPromptFunc[AgentDeps].

ResultValidatorFunc module-attribute

A function that always takes ResultData and returns ResultData, but may or maybe not take CallInfo as a first argument, and may or may not be async.

Usage ResultValidator[AgentDeps, ResultData].

RetrieverReturnValue module-attribute

RetrieverReturnValue = Union[
    str,
    Awaitable[str],
    dict[str, Any],
    Awaitable[dict[str, Any]],
]

Return value of a retriever function.

RetrieverContextFunc module-attribute

A retriever function that takes CallContext as the first argument.

Usage RetrieverContextFunc[AgentDeps, RetrieverParams].

RetrieverPlainFunc module-attribute

A retriever function that does not take CallContext as the first argument.

Usage RetrieverPlainFunc[RetrieverParams].