ó
    ±"³j  ã                  ó‚   • S r SSKJr  SSKrSSKJrJr  SSKJr  SSK	J
r
JrJrJr  SSKJr  \ " S	 S
\\
   5      5       rg)zTCapability that resolves deferred tool calls using a user-supplied handler function.é    )ÚannotationsN)Ú	AwaitableÚCallable)Ú	dataclass)Ú
AgentDepsTÚDeferredToolRequestsÚDeferredToolResultsÚ
RunContexté   )ÚAbstractCapabilityc                  óP   • \ rS rSr% SrS\S'    \S	S j5       r      S
S jrSr	g)ÚHandleDeferredToolCallsé   ab  Resolves deferred tool calls inline during an agent run using a handler function.

When tools require approval or external execution, the agent normally pauses the run
and returns [`DeferredToolRequests`][pydantic_ai.tools.DeferredToolRequests] as output.
This capability intercepts deferred tool calls, calls the provided handler to resolve
them, and continues the agent run automatically.

The handler receives the [`RunContext`][pydantic_ai.tools.RunContext] and the
[`DeferredToolRequests`][pydantic_ai.tools.DeferredToolRequests]. It may return
[`DeferredToolResults`][pydantic_ai.tools.DeferredToolResults] with results for
some or all pending calls, or return `None` to decline handling (the next capability
in the chain gets a chance, otherwise the calls bubble up as `DeferredToolRequests`
output).

Example:
    ```python
    from pydantic_ai import Agent
    from pydantic_ai.capabilities import HandleDeferredToolCalls
    from pydantic_ai.tools import DeferredToolRequests, DeferredToolResults, RunContext


    async def handle_deferred(
        ctx: RunContext, requests: DeferredToolRequests
    ) -> DeferredToolResults:
        # Auto-approve all tools that need approval
        return requests.build_results(approve_all=True)


    agent = Agent(
        'openai:gpt-5',
        capabilities=[HandleDeferredToolCalls(handler=handle_deferred)],
    )
    ```
z|Callable[[RunContext[AgentDepsT], DeferredToolRequests], DeferredToolResults | None | Awaitable[DeferredToolResults | None]]Úhandlerc                ó   • g ©N© )Úclss    Úk/home/mande/repo/quber/.venv/lib/python3.13/site-packages/pydantic_ai/capabilities/deferred_tool_handler.pyÚget_serialization_nameÚ.HandleDeferredToolCalls.get_serialization_name>   s   € àó    c             ƒ  ó~   #   • U R                  X5      n[        R                  " U5      (       a
  UI S h  v•N $ U$  N7fr   )r   ÚinspectÚisawaitable)ÚselfÚctxÚrequestsÚresults       r   Úhandle_deferred_tool_callsÚ2HandleDeferredToolCalls.handle_deferred_tool_callsB   s8   é € ð —‘˜cÓ,ˆÜ×Ò˜v×&Ñ&Ø—<ÐØˆñ  ùs   ‚2=´;µ=r   N)Úreturnz
str | None)r   zRunContext[AgentDepsT]r   r   r"   zDeferredToolResults | None)
Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__Ú__annotations__Úclassmethodr   r    Ú__static_attributes__r   r   r   r   r      sL   ‡ ñ!ðFó ðð óó ðð	à#ð	ð 'ð		ð
 
$÷	r   r   )r'   Ú
__future__r   r   Úcollections.abcr   r   Údataclassesr   Úpydantic_ai.toolsr   r   r	   r
   Úabstractr   r   r   r   r   Ú<module>r0      s>   ðÙ Zå "ã ß /Ý !ç _Ó _å (ð ô<Ð0°Ñ<ó <ó ñ<r   