o
    i                    @  s  d dl mZ d dlZd dlZd dlZd dlZd dlmZ d dl	m
Z
mZmZmZmZ d dlmZmZmZmZ d dlmZ d dlmZmZmZmZ d dlmZmZ d d	lmZ d d
l m!Z!m"Z"m#Z# d dl$m%Z%m&Z& ddl'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z.m/Z/m0Z1 ddl(m2Z2m3Z3m4Z4m5Z5m6Z6m7Z7 ddl)m8Z8 ddl9m:Z: ddl;m<Z< ddl=m>Z>m?Z?m@Z@ ddlAmBZBmCZC ddlDmEZEmFZF ddlGmHZHmIZI ddlJmKZKmLZLmMZMmNZNmOZOmPZPmQZQmRZRmSZSmTZTmUZUmVZV ddlWmXZX ddlYmZZZm[Z[ ddl\m]Z] ddl^m_Z_ ddl`maZa ddlbmcZcmdZdmeZemfZf ddlgmhZh erddlimjZj d Zke"d!Zle"d"ZmendZoejpd#d$G d%d& d&eceKeBf Zqejpd#d$G d'd( d(e_eK ZrdS ))    )annotationsN)Lock)AsyncIterator	AwaitableCallableIteratorSequence)AbstractAsyncContextManagerAsyncExitStackasynccontextmanagercontextmanager)
ContextVar)TYPE_CHECKINGAnyClassVaroverload)
NoOpTraceruse_span)GenerateJsonSchema)SelfTypeVar
deprecated)DEFAULT_INSTRUMENTATION_VERSIONInstrumentationNames   )_agent_graph_output_system_prompt_utils
exceptionsmessagesmodelsusage)CallToolsNodeEndStrategyHistoryProcessorModelRequestNodeUserPromptNodecapture_run_messages)OutputToolset)ToolManager)AbstractBuiltinTool)InstrumentationSettingsInstrumentedModelinstrument_model)OutputDataT
OutputSpec)AgentRunAgentRunResult)ModelSettingsmerge_model_settings)
AgentDepsTDeferredToolResultsDocstringFormatGenerateToolJsonSchema
RunContextToolToolFuncContextToolFuncEitherToolFuncPlain
ToolParamsToolPrepareFuncToolsPrepareFunc)AbstractToolset)DynamicToolsetToolsetFunc)CombinedToolset)FunctionToolset)PreparedToolset   )AbstractAgentEventStreamHandlerInstructionsRunOutputDataT)WrapperAgent	MCPServer)Agentr1   r2   r(   r$   r#   r&   r'   r,   rL   rH   rI   TSF)initc                   @  s  e Zd ZU dZded< ded< ded< 	 ded	< 	 d
ed< ded< 	 dZded< ejddZded< ejddZ	ded< ejddZ
ded< ejddZded< ejddZded< ejddZded< ejddZded< ejddZd ed!< ejddZd"ed#< ejddZd$ed%< ejddZd&ed'< ejddZd&ed(< ejddZd)ed*< ejddZd)ed+< ejddZd,ed-< ejddZd.ed/< ejddZd)ed0< ejddZd1ed2< e	3ded3d4ed3d3d5d3d4d4d3d3d3dd6d3d3d3d7ddRdSZeedT	3ded3d4ed3d3d5d3d4d4d3d3d4dd6d3d3d3dUddXdSZ	3ded3d4ed3d3d5d3d4d4d3d3d3dd6d3d3d3d7dd[dSZeddd^d_Z e!dd`daZ"e"j#ddcdaZ"e!ddddeZ$e$j#ddfdeZ$e!ddhdiZ%e!ddjdkZ&e!ddldmZ'ddodpZ(e	3dd3d3d3d3d3d3d3d3d3d\d3d3dqdddZ)e	3dd3d3d3d3d3d3d3d3d\d3d3ddddZ)e*	3dd3d3d3d3d3d3d3d3d3d\d3d3dqdddZ)d ddZ+e,e-j.e-j.e-j.e-j.e-j.e-j.dd!ddZ/ed"ddZ0ed#ddZ0ed$ddZ0ed%ddZ0ed&ddZ0	3dd'ddZ0ed"ddZ1ed#ddZ1ed$ddZ1ed%ddZ1eddd(ddZ1	3dddd)ddZ1ed*ddZ2ed+ddZ2ed,ddZ2ed-ddZ2d.ddZ2ed/ddZ3ed3d3d3d3dde4d3ddd3dÜd0ddZ3	3dd3d3d3d3dde4d3ddd3dÜd1ddZ3ed2dd؄Z5ed3d3d3d3dde4d3ddd3dÜd3dd؄Z5	3dd3d3d3d3dde4d3ddd3dÜd4dd؄Z5ed5dd߄Z6ed\dd6dd߄Z6	3dd\dd7dd߄Z6d8ddZ7d9ddZ8d:ddZ9	3dd;ddZ:e-j.d3fd<ddZ;e!d=ddZ<ed>ddZ=ed?d dZ=d@ddZ=dAddZ>dBddZ?ddCd	d
Z@e*ed	3ddDddZAd3S (E  rO   at  Class for defining "agents" - a way to have a specific type of "conversation" with an LLM.

    Agents are generic in the dependency type they take [`AgentDepsT`][pydantic_ai.tools.AgentDepsT]
    and the output type they return, [`OutputDataT`][pydantic_ai.output.OutputDataT].

    By default, if neither generic parameter is customised, agents have type `Agent[None, str]`.

    Minimal usage example:

    ```python
    from pydantic_ai import Agent

    agent = Agent('openai:gpt-4o')
    result = agent.run_sync('What is the capital of France?')
    print(result.output)
    #> The capital of France is Paris.
    ```
    1models.Model | models.KnownModelName | str | None_model
str | None_namer$   end_strategyModelSettings | Nonemodel_settingsOutputSpec[OutputDataT]_output_type%InstrumentationSettings | bool | None
instrumentFz(ClassVar[InstrumentationSettings | bool]_instrument_default)reprtype[AgentDepsT]
_deps_type!_output.OutputSchema[OutputDataT]_output_schemaz6list[_output.OutputValidator[AgentDepsT, OutputDataT]]_output_validators7list[str | _system_prompt.SystemPromptFunc[AgentDepsT]]_instructionsztuple[str, ...]_system_promptsz3list[_system_prompt.SystemPromptRunner[AgentDepsT]]_system_prompt_functionsz8dict[str, _system_prompt.SystemPromptRunner[AgentDepsT]] _system_prompt_dynamic_functionszFunctionToolset[AgentDepsT]_function_toolsetz OutputToolset[AgentDepsT] | None_output_toolsetz!list[AbstractToolset[AgentDepsT]]_user_toolsets#ToolsPrepareFunc[AgentDepsT] | None_prepare_tools_prepare_output_toolsint_max_result_retries_max_tool_retries%EventStreamHandler[AgentDepsT] | None_event_stream_handlerr   _enter_lock_entered_countzAsyncExitStack | None_exit_stackN rG   early)output_typeinstructionssystem_prompt	deps_typenamerY   retriesoutput_retriestoolsbuiltin_toolsprepare_toolsprepare_output_toolstoolsetsdefer_model_checkrW   r]   history_processorsevent_stream_handlermodelrz   r{   Instructions[AgentDepsT]r|   str | Sequence[str]r}   r~   r   r   
int | Noner   <Sequence[Tool[AgentDepsT] | ToolFuncEither[AgentDepsT, ...]]r   Sequence[AbstractBuiltinTool]r   r   r   FSequence[AbstractToolset[AgentDepsT] | ToolsetFunc[AgentDepsT]] | Noner   boolr   -Sequence[HistoryProcessor[AgentDepsT]] | Noner   returnNonec                C     d S Nrx   )selfr   rz   r{   r|   r}   r~   rY   r   r   r   r   r   r   r   r   rW   r]   r   r   rx   rx   `/var/www/html/karishye-ai-python/venv/lib/python3.10/site-packages/pydantic_ai/agent/__init__.py__init__   s   zAgent.__init__z4`mcp_servers` is deprecated, use `toolsets` instead.)rz   r{   r|   r}   r~   rY   r   r   r   r   r   r   mcp_serversr   rW   r]   r   r   r   Sequence[MCPServer]c                C  r   r   rx   )r   r   rz   r{   r|   r}   r~   rY   r   r   r   r   r   r   r   r   rW   r]   r   r   rx   rx   r   r      s   _deprecated_kwargsr   c                K  s  |du s|r
|| _ nt|| _ || _|| _|| _|| _|| _|| _|	dd }r:|dur2t
dtdt |}t| tjt || _g | _| || _t|trY|fnt|| _g | _i | _|	durj|	n|| _|| _|| _ || _!|| _"| jj#| _$| j$r| j| j$_%t&|
| j| jd| _'dd |pg D | _(dd |pg D | _)|pg | _*|| _+t,d	dd
| _-t,ddd
| _.t,ddd
| _/t,ddd
| _0t,ddd
| _1t,ddd
| _2t3 | _4d| _5d| _6dS )a  Create an agent.

        Args:
            model: The default model to use for this agent, if not provided,
                you must provide the model when calling it. We allow `str` here since the actual list of allowed models changes frequently.
            output_type: The type of the output data, used to validate the data returned by the model,
                defaults to `str`.
            instructions: Instructions to use for this agent, you can also register instructions via a function with
                [`instructions`][pydantic_ai.Agent.instructions] or pass additional, temporary, instructions when executing a run.
            system_prompt: Static system prompts to use for this agent, you can also register system
                prompts via a function with [`system_prompt`][pydantic_ai.Agent.system_prompt].
            deps_type: The type used for dependency injection, this parameter exists solely to allow you to fully
                parameterize the agent, and therefore get the best out of static type checking.
                If you're not using deps, but want type checking to pass, you can set `deps=None` to satisfy Pyright
                or add a type hint `: Agent[None, <return type>]`.
            name: The name of the agent, used for logging. If `None`, we try to infer the agent name from the call frame
                when the agent is first run.
            model_settings: Optional model request settings to use for this agent's runs, by default.
            retries: The default number of retries to allow for tool calls and output validation, before raising an error.
                For model request retries, see the [HTTP Request Retries](../retries.md) documentation.
            output_retries: The maximum number of retries to allow for output validation, defaults to `retries`.
            tools: Tools to register with the agent, you can also register tools via the decorators
                [`@agent.tool`][pydantic_ai.Agent.tool] and [`@agent.tool_plain`][pydantic_ai.Agent.tool_plain].
            builtin_tools: The builtin tools that the agent will use. This depends on the model, as some models may not
                support certain tools. If the model doesn't support the builtin tools, an error will be raised.
            prepare_tools: Custom function to prepare the tool definition of all tools for each step, except output tools.
                This is useful if you want to customize the definition of multiple tools or you want to register
                a subset of tools for a given step. See [`ToolsPrepareFunc`][pydantic_ai.tools.ToolsPrepareFunc]
            prepare_output_tools: Custom function to prepare the tool definition of all output tools for each step.
                This is useful if you want to customize the definition of multiple output tools or you want to register
                a subset of output tools for a given step. See [`ToolsPrepareFunc`][pydantic_ai.tools.ToolsPrepareFunc]
            toolsets: Toolsets to register with the agent, including MCP servers and functions which take a run context
                and return a toolset. See [`ToolsetFunc`][pydantic_ai.toolsets.ToolsetFunc] for more information.
            defer_model_check: by default, if you provide a [named][pydantic_ai.models.KnownModelName] model,
                it's evaluated to create a [`Model`][pydantic_ai.models.Model] instance immediately,
                which checks for the necessary environment variables. Set this to `false`
                to defer the evaluation until the first run. Useful if you want to
                [override the model][pydantic_ai.Agent.override] for testing.
            end_strategy: Strategy for handling tool calls that are requested alongside a final result.
                See [`EndStrategy`][pydantic_ai.agent.EndStrategy] for more information.
            instrument: Set to True to automatically instrument with OpenTelemetry,
                which will use Logfire if it's configured.
                Set to an instance of [`InstrumentationSettings`][pydantic_ai.agent.InstrumentationSettings] to customize.
                If this isn't set, then the last value set by
                [`Agent.instrument_all()`][pydantic_ai.Agent.instrument_all]
                will be used, which defaults to False.
                See the [Debugging and Monitoring guide](https://ai.pydantic.dev/logfire/) for more info.
            history_processors: Optional list of callables to process the message history before sending it to the model.
                Each processor takes a list of messages and returns a modified list of messages.
                Processors can be sync or async and are applied in sequence.
            event_stream_handler: Optional handler for events from the model's streaming response and the agent's execution of tools.
        Nr   z<`mcp_servers` and `toolsets` cannot be set at the same time.z3`mcp_servers` is deprecated, use `toolsets` insteadmax_retriesoutput_schemac                 S  s$   g | ]}t |tstt |d qS ))toolset_func)
isinstancerA   rB   r5   .0toolsetrx   rx   r   
<listcomp>I  s    z"Agent.__init__.<locals>.<listcomp>c                 S  s   g | ]	}t |tr|qS rx   )r   rA   r   rx   rx   r   r   N  s    _override_name)default_override_deps_override_model_override_toolsets_override_tools_override_instructionsr   )7rT   r!   infer_modelrV   rW   rY   r[   r]   ra   pop	TypeErrorwarningswarnDeprecationWarningr   validate_empty_kwargsr   OutputSchemar/   buildrc   rd   _normalize_instructionsrf   r   strtuplerg   rh   ri   rq   rr   _builtin_toolsrn   ro   r   rk   r   _AgentFunctionToolsetrj   _dynamic_toolsetsrl   r   rt   r   r   r   r   r   r   r   r   ru   rv   rw   )r   r   rz   r{   r|   r}   r~   rY   r   r   r   r   r   r   r   r   rW   r]   r   r   r   r   rx   rx   r   r      sf   L







TInstrumentationSettings | boolc                 C  s
   | t _dS )zMSet the instrumentation options for all agents where `instrument` is not set.N)rO   r^   )r]   rx   rx   r   instrument_alle     
zAgent.instrument_allc                 C     | j S )z,The default model configured for this agent.rT   r   rx   rx   r   r   j     zAgent.modelvaluec                 C  
   || _ dS )zSet the default model configured for this agent.

        We allow `str` here since the actual list of allowed models changes frequently.
        Nr   r   r   rx   rx   r   r   o  s   
c                 C  s   | j  }|r
|jS | jS )zThe name of the agent, used for logging.

        If `None`, we try to infer the agent name from the call frame when the agent is first run.
        )r   getr   rV   )r   name_rx   rx   r   r~   w  s   
z
Agent.namec                 C  r   )z,Set the name of the agent, used for logging.N)rV   r   rx   rx   r   r~     r   typec                 C  r   )z+The type of dependencies used by the agent.)ra   r   rx   rx   r   r}     r   zAgent.deps_typec                 C  r   )zjThe type of data output by agent runs, used to validate the data returned by the model, defaults to `str`.)r[   r   rx   rx   r   rz     r   zAgent.output_typec                 C  r   )zcOptional handler for events from the model's streaming response and the agent's execution of tools.)rt   r   rx   rx   r   r     r   zAgent.event_stream_handlerr   c                 C  s@   t | j d| jd| jd| jd| jd| jd| jdS )Nz(model=z, name=z, end_strategy=z, model_settings=z, output_type=z, instrument=))r   __name__r   r~   rW   rY   rz   r]   r   rx   rx   r   __repr__  s   @zAgent.__repr__)rz   message_historydeferred_tool_resultsr   r{   depsrY   usage_limitsr"   
infer_namer   r   user_prompt,str | Sequence[_messages.UserContent] | Noner   'Sequence[_messages.ModelMessage] | Noner   DeferredToolResults | Noner   r5   r   _usage.UsageLimits | Noner"   _usage.RunUsage | Noner   ,Sequence[AbstractToolset[AgentDepsT]] | None$Sequence[AbstractBuiltinTool] | None>AbstractAsyncContextManager[AgentRun[AgentDepsT, OutputDataT]]c                C  r   r   rx   r   r   rz   r   r   r   r{   r   rY   r   r"   r   r   r   rx   rx   r   iter     z
Agent.iter)r   r   r   r{   r   rY   r   r"   r   r   r   OutputSpec[RunOutputDataT]AAbstractAsyncContextManager[AgentRun[AgentDepsT, RunOutputDataT]]c                C  r   r   rx   r   rx   rx   r   r     r   OutputSpec[Any] | None(AsyncIterator[AgentRun[AgentDepsT, Any]]c          #       s  |r| j du r| t  | |}~| |}| |}|p#| j}| j}| j	}|| j
ks1|r=|j}|r=| j|_||_| j||d}tt |}t| j | j|}|
pXt }
tj|rat|ng |
ddd}t|j| j}t||}|	pyt }	| j|d\ d% fd
d}t|tr|j }|j j!}nd}t" }tj#tt$f d&i d|d|d|rt%|ndd|d|d|	d| jd| j&d|d|d| j'dg | j(|pg d|d|d|d|}tj)t || | j*| j+| j,d}| j pd}t-.|r|j/nt0}|j1|2||r|j3nd||| dd d!}z|j4||||5 r.t6|ndd"d#4 I dH Z} |4 I dH = t7| }!|!V  |!j8 }"durq|5 rq|rq|j9rq|:d$t|"j;t<rg|"j;nt=>t?|"j; W d  I dH  n1 I dH sw   Y  W d  I dH  n1 I dH sw   Y  W z*|r|5 r|@| A||
|jB|jC W |D  dS W |D  dS W |D  dS |D  w z'|r|5 r|@| A||
|jB|jC W |D  w W |D  w W |D  w |D  w )'a  A contextmanager which can be used to iterate over the agent graph's nodes as they are executed.

        This method builds an internal agent graph (using system prompts, tools and output schemas) and then returns an
        `AgentRun` object. The `AgentRun` can be used to async-iterate over the nodes of the graph as they are
        executed. This is the API to use if you want to consume the outputs coming from each LLM model response, or the
        stream of events coming from the execution of tools.

        The `AgentRun` also provides methods to access the full message history, new messages, and usage statistics,
        and the final result of the run once it has completed.

        For more details, see the documentation of `AgentRun`.

        Example:
        ```python
        from pydantic_ai import Agent

        agent = Agent('openai:gpt-4o')

        async def main():
            nodes = []
            async with agent.iter('What is the capital of France?') as agent_run:
                async for node in agent_run:
                    nodes.append(node)
            print(nodes)
            '''
            [
                UserPromptNode(
                    user_prompt='What is the capital of France?',
                    instructions_functions=[],
                    system_prompts=(),
                    system_prompt_functions=[],
                    system_prompt_dynamic_functions={},
                ),
                ModelRequestNode(
                    request=ModelRequest(
                        parts=[
                            UserPromptPart(
                                content='What is the capital of France?',
                                timestamp=datetime.datetime(...),
                            )
                        ],
                        run_id='...',
                    )
                ),
                CallToolsNode(
                    model_response=ModelResponse(
                        parts=[TextPart(content='The capital of France is Paris.')],
                        usage=RequestUsage(input_tokens=56, output_tokens=7),
                        model_name='gpt-4o',
                        timestamp=datetime.datetime(...),
                        run_id='...',
                    )
                ),
                End(data=FinalResult(output='The capital of France is Paris.')),
            ]
            '''
            print(agent_run.result.output)
            #> The capital of France is Paris.
        ```

        Args:
            user_prompt: User input to start/continue the conversation.
            output_type: Custom output type to use for this run, `output_type` may only be used if the agent has no
                output validators since output validators would expect an argument that matches the agent's output type.
            message_history: History of the conversation so far.
            deferred_tool_results: Optional results for deferred tool calls in the message history.
            model: Optional model to use for this run, required if `model` was not set when creating the agent.
            instructions: Optional additional instructions to use for this run.
            deps: Optional dependencies to use for this run.
            model_settings: Optional settings to use for this model's request.
            usage_limits: Optional limits on model request count or token usage.
            usage: Optional usage to start with, useful for resuming a conversation or agents used in tools.
            infer_name: Whether to try to infer the agent name from the call frame if it's not set.
            toolsets: Optional additional toolsets for this run.
            builtin_tools: Optional additional builtin tools for this run.

        Returns:
            The result of the run.
        N)output_toolsetadditional_toolsetsr   )r   r"   r   run_step)additional_instructionsrun_contextRunContext[AgentDepsT]r   rU   c                   sD   g fddD I d H }dd |D }|sd S d | S )Nc                   s   g | ]
}|  I d H qS r   )run)r   funcr   rx   r   r   M  s    z8Agent.iter.<locals>.get_instructions.<locals>.<listcomp>c                 S  s   g | ]}|r|qS rx   rx   )r   prx   rx   r   r   P  s    z

)joinstrip)r   partsinstructions_functionsinstructions_literalr   r   get_instructionsJ  s   z$Agent.iter.<locals>.get_instructions	user_depspromptnew_message_indexr   rY   r   max_result_retriesrW   r   output_validatorsr   r   tool_managertracerr   instrumentation_settings)r   r   r{   r   system_promptssystem_prompt_functionssystem_prompt_dynamic_functionsagentzno-modelz run)
model_name
agent_namezgen_ai.agent.namezlogfire.msg)
attributesF)inputsstater   spanr   final_result)r   r   r   rU   rx   )Er~   _infer_nameinspectcurrentframe
_get_model	_get_deps_prepare_output_schemarz   rd   rk   rc   r   rq   r   r   _get_toolsetr*   r5   r   build_agent_graphra   _usageRunUsageGraphAgentStatelistr4   settingsrY   UsageLimits_get_instructionsr   r-   r   r   r   GraphAgentDepsr/   lenrW   r   r   r'   rg   rh   ri   r   for_versionversionr   
start_spanget_agent_run_span_namer   r   is_recordingr   r1   resultinclude_contentset_attributeoutputr   jsondumpsserialize_anyset_attributes_run_span_end_attributesr   r   end)#r   r   rz   r   r   r   r{   r   rY   r   r"   r   r   r   
model_usedr   output_type_r   r   r   r   graphr  merged_settingsr   r   r   
graph_depsuser_prompt_noder   instrumentation_namesrun_span	graph_run	agent_runr  rx   r   r   r     s  a






	





,*

r  r,   _usage.RunUsagelist[_messages.ModelMessage]r   c              	     s   |j dkrdtdd ||D i}n1t| dt|t|i| }|dkr3||d< t	 fdd	||d  D rFd
|d< i |
 |dtdi dd | D dddiidiS )NrG   all_messages_eventsc                 S  s   g | ]}t |qS rx   )r-   event_to_dict)r   erx   rx   r   r     s    z2Agent._run_span_end_attributes.<locals>.<listcomp>zpydantic_ai.all_messagesr   zpydantic_ai.new_message_indexc                 3  s0    | ]}t |tjo|jd uo|j kV  qd S r   )r   	_messagesModelRequestr{   )r   mlast_instructionsrx   r   	<genexpr>  s    
z1Agent._run_span_end_attributes.<locals>.<genexpr>Tz!pydantic_ai.variable_instructionszlogfire.json_schemaobjectc                 S  s(   i | ]\}}|t |trd dini qS )r   array)r   r   )r   kvrx   rx   r   
<dictcomp>  s   ( z2Agent._run_span_end_attributes.<locals>.<dictcomp>r  r   )r   
properties)r  r  r  messages_to_otel_eventsr-   r  messages_to_otel_messagesr  system_instructions_attributesanyopentelemetry_attributesitems)r   r  r"   r   r   attrsrx   r6  r   r"    s>   


zAgent._run_span_end_attributes)r~   r   r   r   r   r{   str | _utils.UnsetAgentDepsT | _utils.Unset9models.Model | models.KnownModelName | str | _utils.Unset4Sequence[AbstractToolset[AgentDepsT]] | _utils.UnsetKSequence[Tool[AgentDepsT] | ToolFuncEither[AgentDepsT, ...]] | _utils.Unset'Instructions[AgentDepsT] | _utils.UnsetIterator[None]c             	   c  s   t |r| jt |}nd}t |r!| jt |}nd}t |r5| jt t|}	nd}	t |rF| j	t |}
nd}
t |rW| j
t |}nd}t |rm| |}| jt |}nd}zDdV  W |dur~| j| |dur| j| |	dur| j|	 |
dur| j	|
 |dur| j
| |dur| j| dS dS |dur| j| |dur| j| |	dur| j|	 |
dur| j	|
 |dur| j
| |dur| j| w w )a]  Context manager to temporarily override agent name, dependencies, model, toolsets, tools, or instructions.

        This is particularly useful when testing.
        You can find an example of this [here](../testing.md#overriding-model-via-pytest-fixtures).

        Args:
            name: The name to use instead of the name passed to the agent constructor and agent run.
            deps: The dependencies to use instead of the dependencies passed to the agent run.
            model: The model to use instead of the model passed to the agent run.
            toolsets: The toolsets to use instead of the toolsets passed to the agent constructor and agent run.
            tools: The tools to use instead of the tools registered with the agent.
            instructions: The instructions to use instead of the instructions registered with the agent.
        N)r   is_setr   setSomer   r   r!   r   r   r   r   r   reset)r   r~   r   r   r   r   r{   
name_token
deps_tokenmodel_tokentoolsets_tokentools_tokennormalized_instructionsinstructions_tokenrx   rx   r   override  s`   






zAgent.overrider   'Callable[[RunContext[AgentDepsT]], str]c                C  r   r   rx   r   r   rx   rx   r   r{   $     zAgent.instructions2Callable[[RunContext[AgentDepsT]], Awaitable[str]]c                C  r   r   rx   rZ  rx   rx   r   r{   )  r[  Callable[[], str]c                C  r   r   rx   rZ  rx   rx   r   r{   .     Callable[[], Awaitable[str]]c                C  r   r   rx   rZ  rx   rx   r   r{   1  r^  dCallable[[_system_prompt.SystemPromptFunc[AgentDepsT]], _system_prompt.SystemPromptFunc[AgentDepsT]]c                C  r   r   rx   r   rx   rx   r   r{   4  r[  2_system_prompt.SystemPromptFunc[AgentDepsT] | NoneCallable[[_system_prompt.SystemPromptFunc[AgentDepsT]], _system_prompt.SystemPromptFunc[AgentDepsT]] | _system_prompt.SystemPromptFunc[AgentDepsT]c                  s*   |du rd fdd}|S  j | |S )a  Decorator to register an instructions function.

        Optionally takes [`RunContext`][pydantic_ai.tools.RunContext] as its only argument.
        Can decorate a sync or async functions.

        The decorator can be used bare (`agent.instructions`).

        Overloads for every possible signature of `instructions` are included so the decorator doesn't obscure
        the type of the function.

        Example:
        ```python
        from pydantic_ai import Agent, RunContext

        agent = Agent('test', deps_type=str)

        @agent.instructions
        def simple_instructions() -> str:
            return 'foobar'

        @agent.instructions
        async def async_instructions(ctx: RunContext[str]) -> str:
            return f'{ctx.deps} is the best'
        ```
        Nfunc_+_system_prompt.SystemPromptFunc[AgentDepsT]r   c                   s    j |  | S r   rf   appendrc  r   rx   r   	decorator\  s   z%Agent.instructions.<locals>.decoratorrc  rd  r   rd  re  )r   r   rh  rx   r   r   r{   9  s
   !c                C  r   r   rx   rZ  rx   rx   r   r|   g  r[  zAgent.system_promptc                C  r   r   rx   rZ  rx   rx   r   r|   l  r[  c                C  r   r   rx   rZ  rx   rx   r   r|   q  r^  c                C  r   r   rx   rZ  rx   rx   r   r|   t  r^  dynamicrk  c               C  r   r   rx   )r   rk  rx   rx   r   r|   w  r[  c                 sF   |du rd	 fdd}|S  rJ dj tjt | d |S )
a  Decorator to register a system prompt function.

        Optionally takes [`RunContext`][pydantic_ai.tools.RunContext] as its only argument.
        Can decorate a sync or async functions.

        The decorator can be used either bare (`agent.system_prompt`) or as a function call
        (`agent.system_prompt(...)`), see the examples below.

        Overloads for every possible signature of `system_prompt` are included so the decorator doesn't obscure
        the type of the function, see `tests/typed_agent.py` for tests.

        Args:
            func: The function to decorate
            dynamic: If True, the system prompt will be reevaluated even when `messages_history` is provided,
                see [`SystemPromptPart.dynamic_ref`][pydantic_ai.messages.SystemPromptPart.dynamic_ref]

        Example:
        ```python
        from pydantic_ai import Agent, RunContext

        agent = Agent('test', deps_type=str)

        @agent.system_prompt
        def simple_system_prompt() -> str:
            return 'foobar'

        @agent.system_prompt(dynamic=True)
        async def async_system_prompt(ctx: RunContext[str]) -> str:
            return f'{ctx.deps} is the best'
        ```
        Nrc  rd  r   c                   s2   t jt |  d}j|  r|j| j< | S )Nrj  )r   SystemPromptRunnerr5   rh   rf  ri   __qualname__)rc  runnerrk  r   rx   r   rh    s
   z&Agent.system_prompt.<locals>.decoratorz"dynamic can't be True in this caserj  ri  )rh   rf  r   rl  r5   )r   r   rk  rh  rx   ro  r   r|   |  s   )	<Callable[[RunContext[AgentDepsT], OutputDataT], OutputDataT]c                C  r   r   rx   rZ  rx   rx   r   output_validator  r[  zAgent.output_validatorGCallable[[RunContext[AgentDepsT], OutputDataT], Awaitable[OutputDataT]]c                C  r   r   rx   rZ  rx   rx   r   rq    r[  $Callable[[OutputDataT], OutputDataT]c                C  r   r   rx   rZ  rx   rx   r   rq    r[  /Callable[[OutputDataT], Awaitable[OutputDataT]]c                C  r   r   rx   rZ  rx   rx   r   rq    r[  4_output.OutputValidatorFunc[AgentDepsT, OutputDataT]c                C  s   | j tjttf | |S )a;  Decorator to register an output validator function.

        Optionally takes [`RunContext`][pydantic_ai.tools.RunContext] as its first argument.
        Can decorate a sync or async functions.

        Overloads for every possible signature of `output_validator` are included so the decorator doesn't obscure
        the type of the function, see `tests/typed_agent.py` for tests.

        Example:
        ```python
        from pydantic_ai import Agent, ModelRetry, RunContext

        agent = Agent('test', deps_type=str)

        @agent.output_validator
        def output_validator_simple(data: str) -> str:
            if 'wrong' in data:
                raise ModelRetry('wrong response')
            return data

        @agent.output_validator
        async def output_validator_deps(ctx: RunContext[str], data: str) -> str:
            if ctx.deps in data:
                raise ModelRetry('wrong response')
            return data

        result = agent.run_sync('foobar', deps='spam')
        print(result.output)
        #> success (no tool calls)
        ```
        )rd   rf  r   OutputValidatorr5   r   rZ  rx   rx   r   rq    s   "'ToolFuncContext[AgentDepsT, ToolParams]c                C  r   r   rx   rZ  rx   rx   r   tool  r^  z
Agent.toolauto)r~   descriptionr   preparedocstring_formatrequire_parameter_descriptionsschema_generatorstrict
sequentialrequires_approvalmetadatarz  r{  "ToolPrepareFunc[AgentDepsT] | Noner|  r7   r}  r~  type[GenerateJsonSchema]r  bool | Noner  r  r  dict[str, Any] | None\Callable[[ToolFuncContext[AgentDepsT, ToolParams]], ToolFuncContext[AgentDepsT, ToolParams]]c               C  r   r   rx   r   r~   rz  r   r{  r|  r}  r~  r  r  r  r  rx   rx   r   rx       .ToolFuncContext[AgentDepsT, ToolParams] | Nonec                 8   d 	
fdd}|du r|S ||S )a(  Decorator to register a tool function which takes [`RunContext`][pydantic_ai.tools.RunContext] as its first argument.

        Can decorate a sync or async functions.

        The docstring is inspected to extract both the tool description and description of each parameter,
        [learn more](../tools.md#function-tools-and-schema).

        We can't add overloads for every possible signature of tool, since the return type is a recursive union
        so the signature of functions decorated with `@agent.tool` is obscured.

        Example:
        ```python
        from pydantic_ai import Agent, RunContext

        agent = Agent('test', deps_type=int)

        @agent.tool
        def foobar(ctx: RunContext[int], x: int) -> int:
            return ctx.deps + x

        @agent.tool(retries=2)
        async def spam(ctx: RunContext[str], y: float) -> float:
            return ctx.deps + y

        result = agent.run_sync('foobar', deps=1)
        print(result.output)
        #> {"foobar":1,"spam":1.0}
        ```

        Args:
            func: The tool function to register.
            name: The name of the tool, defaults to the function name.
            description: The description of the tool, defaults to the function docstring.
            retries: The number of retries to allow for this tool, defaults to the agent's default retries,
                which defaults to 1.
            prepare: custom method to prepare the tool definition for each step, return `None` to omit this
                tool from a given step. This is useful if you want to customise a tool at call time,
                or omit it completely from a step. See [`ToolPrepareFunc`][pydantic_ai.tools.ToolPrepareFunc].
            docstring_format: The format of the docstring, see [`DocstringFormat`][pydantic_ai.tools.DocstringFormat].
                Defaults to `'auto'`, such that the format is inferred from the structure of the docstring.
            require_parameter_descriptions: If True, raise an error if a parameter description is missing. Defaults to False.
            schema_generator: The JSON schema generator class to use for this tool. Defaults to `GenerateToolJsonSchema`.
            strict: Whether to enforce JSON schema compliance (only affects OpenAI).
                See [`ToolDefinition`][pydantic_ai.tools.ToolDefinition] for more info.
            sequential: Whether the function requires a sequential/serial execution environment. Defaults to False.
            requires_approval: Whether this tool requires human-in-the-loop approval. Defaults to False.
                See the [tools documentation](../deferred-tools.md#human-in-the-loop-tool-approval) for more info.
            metadata: Optional metadata for the tool. This is not sent to the model but can be used for filtering and tool behavior customization.
        rc  rw  r   c                   *   	j j| d 
d | S )NT	takes_ctxr~   rz  r   r{  r|  r}  r~  r  r  r  r  rj   add_functionrg  rz  r|  r  r~   r{  r}  r  r   r~  r   r  r  rx   r   tool_decoratorG  s    z"Agent.tool.<locals>.tool_decoratorN)rc  rw  r   rw  rx   r   r   r~   rz  r   r{  r|  r}  r~  r  r  r  r  r  rx   r  r   rx    s   $CToolFuncPlain[ToolParams]c                C  r   r   rx   rZ  rx   rx   r   
tool_plain^  r^  zAgent.tool_plain@Callable[[ToolFuncPlain[ToolParams]], ToolFuncPlain[ToolParams]]c               C  r   r   rx   r  rx   rx   r   r  a  r   ToolFuncPlain[ToolParams] | Nonec                 r  )a
  Decorator to register a tool function which DOES NOT take `RunContext` as an argument.

        Can decorate a sync or async functions.

        The docstring is inspected to extract both the tool description and description of each parameter,
        [learn more](../tools.md#function-tools-and-schema).

        We can't add overloads for every possible signature of tool, since the return type is a recursive union
        so the signature of functions decorated with `@agent.tool` is obscured.

        Example:
        ```python
        from pydantic_ai import Agent, RunContext

        agent = Agent('test')

        @agent.tool
        def foobar(ctx: RunContext[int]) -> int:
            return 123

        @agent.tool(retries=2)
        async def spam(ctx: RunContext[str]) -> float:
            return 3.14

        result = agent.run_sync('foobar', deps=1)
        print(result.output)
        #> {"foobar":123,"spam":3.14}
        ```

        Args:
            func: The tool function to register.
            name: The name of the tool, defaults to the function name.
            description: The description of the tool, defaults to the function docstring.
            retries: The number of retries to allow for this tool, defaults to the agent's default retries,
                which defaults to 1.
            prepare: custom method to prepare the tool definition for each step, return `None` to omit this
                tool from a given step. This is useful if you want to customise a tool at call time,
                or omit it completely from a step. See [`ToolPrepareFunc`][pydantic_ai.tools.ToolPrepareFunc].
            docstring_format: The format of the docstring, see [`DocstringFormat`][pydantic_ai.tools.DocstringFormat].
                Defaults to `'auto'`, such that the format is inferred from the structure of the docstring.
            require_parameter_descriptions: If True, raise an error if a parameter description is missing. Defaults to False.
            schema_generator: The JSON schema generator class to use for this tool. Defaults to `GenerateToolJsonSchema`.
            strict: Whether to enforce JSON schema compliance (only affects OpenAI).
                See [`ToolDefinition`][pydantic_ai.tools.ToolDefinition] for more info.
            sequential: Whether the function requires a sequential/serial execution environment. Defaults to False.
            requires_approval: Whether this tool requires human-in-the-loop approval. Defaults to False.
                See the [tools documentation](../deferred-tools.md#human-in-the-loop-tool-approval) for more info.
            metadata: Optional metadata for the tool. This is not sent to the model but can be used for filtering and tool behavior customization.
        rc  r  r   c                   r  )NFr  r  rg  r  rx   r   r    s    z(Agent.tool_plain.<locals>.tool_decoratorN)rc  r  r   r  rx   r  rx   r  r   r  s  s   $CToolsetFunc[AgentDepsT]c                C  r   r   rx   rZ  rx   rx   r   r     r^  zAgent.toolsetper_run_stepr  <Callable[[ToolsetFunc[AgentDepsT]], ToolsetFunc[AgentDepsT]]c               C  r   r   rx   )r   r  rx   rx   r   r     s   ToolsetFunc[AgentDepsT] | Nonec                 s$   d fdd}|du r|S ||S )a  Decorator to register a toolset function which takes [`RunContext`][pydantic_ai.tools.RunContext] as its only argument.

        Can decorate a sync or async functions.

        The decorator can be used bare (`agent.toolset`).

        Example:
        ```python
        from pydantic_ai import AbstractToolset, Agent, FunctionToolset, RunContext

        agent = Agent('test', deps_type=str)

        @agent.toolset
        async def simple_toolset(ctx: RunContext[str]) -> AbstractToolset[str]:
            return FunctionToolset()
        ```

        Args:
            func: The toolset function to register.
            per_run_step: Whether to re-evaluate the toolset for each run step. Defaults to True.
        rc  r  r   c                   s   j t|  d | S )Nr  )r   rf  rB   rg  r  r   rx   r   toolset_decorator  s   z(Agent.toolset.<locals>.toolset_decoratorN)rc  r  r   r  rx   )r   r   r  r  rx   r  r   r     s   models.Modelc                 C  s   | j   }r|du r| jdu rtd|j}n|dur#t|}n| jdur2t| j }| _ntd| j}|du rA| j	}t
||S )zCreate a model configured for this agent.

        Args:
            model: model to use for this run, required if `model` was not set when creating the agent.

        Returns:
            The model used
        Nz`model` must either be set on the agent or included when calling it. (Even when `override(model=...)` is customizing the model that will actually be called)zD`model` must either be set on the agent or included when calling it.)r   r   r   r   	UserErrorr   r!   r   r]   r^   r.   )r   r   
some_modelmodel_r]   rx   rx   r   r    s   



zAgent._get_modelr   Agent[T, OutputDataT]rP   c                 C  s   | j   }r
|jS |S )zGet deps for a run.

        If we've overridden deps via `_override_deps`, use that, otherwise use the deps passed to the call.

        We could do runtime type checking of deps against `self._deps_type`, but that's a slippery slope.
        )r   r   r   )r   r   	some_depsrx   rx   r   r    s   zAgent._get_depsc                 C  s,   |d u rg S t |tst|r|gS t|S r   )r   r   callabler  )r   r{   rx   rx   r   r   %  s
   zAgent._normalize_instructionsr   Ftuple[str | None, list[_system_prompt.SystemPromptRunner[AgentDepsT]]]c                 C  s   | j  }|r|j}n| j }|d ur|| | g }g }|D ]}t|tr/|	| q"|	t
jt | q"d| pBd }||fS )N
)r   r   r   rf   copyextendr   r   r   rf  r   rl  r5   r   r   )r   r   override_instructionsr{   literal_parts	functionsinstructionliteralrx   rx   r   r  /  s   


zAgent._get_instructionsr   1AbstractToolset[AgentDepsT] | None | _utils.Unsetr   AbstractToolset[AgentDepsT]c                 C  s   | j }|r| j du rg ||}t|}ddd}||}| jr)t|| j}t|r0|n| j	}|durF| j
r@t|| j
}t||g}|S )zGet the complete toolset.

        Args:
            output_toolset: The output toolset to use instead of the one built at agent construction time.
            additional_toolsets: Additional toolsets to add, unless toolsets have been overridden.
        Nr   r  r   c                 S  s   t | tr
t| S | S r   )r   rB   dataclassesreplacer   rx   rx   r   copy_dynamic_toolsetsZ  s   

z1Agent._get_toolset.<locals>.copy_dynamic_toolsets)r   r  r   r  )r   r   r   rD   visit_and_replacern   rF   r   rM  rk   ro   )r   r   r   r   r   r  rx   rx   r   r
  G  s   

zAgent._get_toolset%Sequence[AbstractToolset[AgentDepsT]]c                 C  sl   g }| j   }rt|j| j| jd}n| j}|| | j  }r'|j}ng | j	| j
}|| |S )zAll toolsets registered on the agent, including a function toolset holding tools that were registered on the agent directly.

        Output tools are not included.
        r   )r   r   r   r   rr   rc   rj   rf  r   rl   r   r  )r   r   
some_toolsfunction_toolsetsome_user_toolsetsuser_toolsetsrx   rx   r   r   m  s   

zAgent.toolsetsc                 C  r   r   rx   r   rz   rx   rx   r   r	    r^  zAgent._prepare_output_schema$_output.OutputSchema[RunOutputDataT]c                 C  r   r   rx   r  rx   rx   r   r	    r[  _output.OutputSchema[Any]c                 C  s2   |d ur| j rtdtj|}|S | j}|S )NzJCannot set a custom run `output_type` when the agent has output validators)rd   r   r  r   r   r   rc   )r   rz   schemarx   rx   r   r	    s   
r   c              
     s   | j 4 I dH F | jdkr<t 4 I dH }|  }||I dH  | | _W d  I dH  n1 I dH s7w   Y  |  jd7  _W d  I dH  | S 1 I dH sTw   Y  | S )zEnter the agent context.

        This will start all [`MCPServerStdio`s][pydantic_ai.mcp.MCPServerStdio] registered as `toolsets` so they are ready to be used.

        This is a no-op if the agent has already been entered.
        Nr   rG   )ru   rv   r
   r
  enter_async_contextpop_allrw   )r   
exit_stackr   rx   rx   r   
__aenter__  s   
(zAgent.__aenter__argsc              	     sz   | j 4 I d H ( |  jd8  _| jdkr%| jd ur%| j I d H  d | _W d   I d H  d S 1 I d H s6w   Y  d S )NrG   r   )ru   rv   rw   aclose)r   r  rx   rx   r   	__aexit__  s   .zAgent.__aexit__c              
     sr   z|rt |n| dW n tjy! } ztd|d}~ww ddlm  d fd	d
}|  | dS )zSet the sampling model on all MCP servers registered with the agent.

        If no sampling model is provided, the agent's model will be used.
        Nz9No sampling model provided and no model set on the agent.r   rM   r   r  r   r   c                   s   t |  r
| _d S d S r   )r   sampling_modelr  rN   r  rx   r   _set_sampling_model  s   

z9Agent.set_mcp_sampling_model.<locals>._set_sampling_model)r   r  r   r   )	r!   r   r  r   r  mcprN   r
  apply)r   r   r2  r  rx   r  r   set_mcp_sampling_model  s   zAgent.set_mcp_sampling_modelz`run_mcp_servers` is deprecated, use `async with agent:` instead. If you need to set a sampling model on all MCP servers, use `agent.set_mcp_sampling_model()`.AsyncIterator[None]c              	   C st   z|  | W n tjy   |dur Y nw | 4 I dH  dV  W d  I dH  dS 1 I dH s3w   Y  dS )a  Run [`MCPServerStdio`s][pydantic_ai.mcp.MCPServerStdio] so they can be used by the agent.

        Deprecated: use [`async with agent`][pydantic_ai.agent.Agent.__aenter__] instead.
        If you need to set a sampling model on all MCP servers, use [`agent.set_mcp_sampling_model()`][pydantic_ai.agent.Agent.set_mcp_sampling_model].

        Returns: a context manager to start and shutdown the servers.
        N)r  r   r  )r   r   rx   rx   r   run_mcp_servers  s   .zAgent.run_mcp_serversr   )(r   rS   rz   rZ   r{   r   r|   r   r}   r`   r~   rU   rY   rX   r   rp   r   r   r   r   r   r   r   rm   r   rm   r   r   r   r   rW   r$   r]   r\   r   r   r   rs   r   r   )(r   rS   rz   rZ   r{   r   r|   r   r}   r`   r~   rU   rY   rX   r   rp   r   r   r   r   r   r   r   rm   r   rm   r   r   r   r   rW   r$   r]   r\   r   r   r   rs   r   r   )(r   rS   rz   rZ   r{   r   r|   r   r}   r`   r~   rU   rY   rX   r   rp   r   r   r   r   r   r   r   rm   r   rm   r   r   r   r   rW   r$   r]   r\   r   r   r   rs   r   r   )T)r]   r   r   r   )r   rS   )r   rS   r   r   )r   rU   )r   rU   r   r   )r   r   )r   rZ   )r   rs   r   r   )r   r   rz   r   r   r   r   r   r   rS   r{   r   r   r5   rY   rX   r   r   r"   r   r   r   r   r   r   r   r   r   )r   r   rz   r   r   r   r   r   r   rS   r{   r   r   r5   rY   rX   r   r   r"   r   r   r   r   r   r   r   r   r   )r   r   rz   r   r   r   r   r   r   rS   r{   r   r   r5   rY   rX   r   r   r"   r   r   r   r   r   r   r   r   r   )r  r,   r"   r.  r   r/  r   rp   )r~   rF  r   rG  r   rH  r   rI  r   rJ  r{   rK  r   rL  )r   rY  r   rY  )r   r\  r   r\  )r   r]  r   r]  )r   r_  r   r_  )r   r`  )r   ra  r   rb  )rk  r   r   r`  )r   ra  rk  r   r   rb  )r   rp  r   rp  )r   rr  r   rr  )r   rs  r   rs  )r   rt  r   rt  )r   ru  r   ru  )r   rw  r   rw  )r~   rU   rz  rU   r   r   r{  r  r|  r7   r}  r   r~  r  r  r  r  r   r  r   r  r  r   r  )r   r  r~   rU   rz  rU   r   r   r{  r  r|  r7   r}  r   r~  r  r  r  r  r   r  r   r  r  r   r   )r   r  r   r  )r~   rU   rz  rU   r   r   r{  r  r|  r7   r}  r   r~  r  r  r  r  r   r  r   r  r  r   r  )r   r  r~   rU   rz  rU   r   r   r{  r  r|  r7   r}  r   r~  r  r  r  r  r   r  r   r  r  r   r   )r   r  r   r  )r  r   r   r  )r   r  r  r   r   r   )r   rS   r   r  )r   r  r   rP   r   rP   )r{   r   r   re   )r   r   r   r  )r   r  r   r   r   r  )r   r  )rz   r   r   rb   )rz   r   r   r  )rz   r   r   r  )r   r   )r  r   r   r  )r   rS   r   r   )r   rS   r   r  )Br   
__module__rm  __doc____annotations__r^   r  fieldra   rc   rd   rf   rg   rh   ri   rj   rk   rl   rn   ro   rq   rr   rt   ru   rv   rw   r   r   NoneTyper   r   staticmethodr   propertyr   setterr~   r}   rz   r   r   r   r   r"  r   r   UNSETrX  r{   r|   rq  rx  r8   r  r   r  r  r   r  r
  r   r	  r  r  r  r  rx   rx   rx   r   rO   ]   sX  
   k5F.:%ZX	# &
rO   c                      s^   e Zd ZU ded< g fdddd fddZedddZedddZd fddZ  Z	S )r   r  r   rG   Nr   idr   r   r   rp   r  rU   c                  s   || _ t j|||d d S )Nr  )r   superr   )r   r   r   r  r   	__class__rx   r   r     s   z_AgentFunctionToolset.__init__r   r   c                 C     dS )Nz<agent>rx   r   rx   rx   r   r       z_AgentFunctionToolset.idc                 C  r  )Nz	the agentrx   r   rx   rx   r   label  r  z_AgentFunctionToolset.labelrx  Tool[AgentDepsT]r   c                   s(   |j r| jjstdt | d S )NzjTo use tools that require approval, add `DeferredToolRequests` to the list of output types for this agent.)r  r   allows_deferred_toolsr   r  r  add_tool)r   rx  r  rx   r   r    s
   z_AgentFunctionToolset.add_tool)r   r   r   rp   r  rU   r   r  r  )rx  r  r   r   )
r   r  rm  r  r   r  r  r  r  __classcell__rx   rx   r  r   r     s   
 r   )s
__future__r   _annotationsr  r  r  r   asyncior   collections.abcr   r   r   r   r   
contextlibr	   r
   r   r   contextvarsr   typingr   r   r   r   opentelemetry.tracer   r   pydantic.json_schemar   typing_extensionsr   r   r   pydantic_ai._instrumentationr   r    r   r   r   r   r   r    r3  r!   r"   r  r#   r$   r%   r&   r'   r(   r)   _tool_managerr*   r   r+   models.instrumentedr,   r-   r.   r  r/   r0   r   r1   r2   r  r3   r4   r   r5   r6   r7   r8   r9   r:   r;   r<   r=   r>   r?   r@   r   rA   toolsets._dynamicrB   rC   toolsets.combinedrD   toolsets.functionrE   toolsets.preparedrF   abstractrH   rI   rJ   rK   wrapperrL   r  rN   __all__rP   rQ   r   r  	dataclassrO   r   rx   rx   rx   r   <module>   sh    ( 
8
           
