ó
    ±"³jXu  ã                  óò  • S r SSKJr  SSKrSSKJrJr  SSKJrJ	r	J
r
Jr  SSKJrJrJrJr  SSKJr  SSKJrJr  SS	KJr  SS
KJrJr  SSKJr  SSK J!r!J"r"J#r#J$r$J%r%J&r&J'r'J(r)J*r+J,r,J-r-J.r.J/r/  SSK0J1r1J2r2  SSK3J4r4J5r5J6r6J7r7J8r8J9r9  SSK:J;r;J<r<J=r=J>r>J?r?  SSK@JArA  SSKBJCrC  SSKDJErEJFrFJGrGJHrHJIrIJJrJJKrKJLrL  \(       a&  SSKMJNrN  SSKOJPrPJQrQ  SSKRJSrS  SSKTJUrU  SSKVJWrW  SSK@JXrX  SS jrY\	 " S S\E\   5      5       rZg)zKInstrumentation capability for OpenTelemetry/Logfire tracing of agent runs.é    )ÚannotationsN)Ú	AwaitableÚCallable)ÚKW_ONLYÚ	dataclassÚfieldÚreplace)ÚTYPE_CHECKINGÚAnyÚClassVarÚLiteral)Úset_baggage)ÚattachÚdetach)Ú
StatusCode)ÚValidationErrorÚto_json)Ú_usage_attribution)ÚDEFAULT_INSTRUMENTATION_VERSIONÚInstrumentationNamesÚMessageJsonCacheÚ get_agent_run_baggage_attributesÚget_instructionsÚhas_stale_message_jsonÚopen_model_request_spanÚrecord_exceptionÚrecord_uncaught_errorsÚredact_binary_contentÚsafe_to_jsonÚserialize_anyÚtime_to_first_chunk_ctx)ÚUNSETÚUnset)ÚApprovalRequiredÚCallDeferredÚMessageHistoryMutatedWarningÚ
ModelRetryÚToolFailedErrorÚToolRetryError)ÚModelMessageÚModelResponseÚRetryPromptPartÚToolCallPartÚtool_return_ta)ÚToolDefinition)ÚRunUsageé   )ÚAbstractCapabilityÚCapabilityOrderingÚRawToolArgsÚValidatedToolArgsÚWrapModelRequestHandlerÚWrapOutputProcessHandlerÚWrapRunHandlerÚWrapToolExecuteHandler)Ú
RunContext)ÚModelRequestContextÚModelRequestParameters©ÚInstrumentationSettings)ÚOutputContext)ÚAgentRunResult)Ú
AgentDepsTc                 ó   • SSK Jn   U " 5       $ )zHLazy import to avoid loading the OTel SDK eagerly at module import time.r   r=   ©Úpydantic_ai.models.instrumentedr>   r=   s    Úe/home/mande/repo/quber/.venv/lib/python3.13/site-packages/pydantic_ai/capabilities/instrumentation.pyÚ_default_settingsrF   @   s   € åGá"Ó$Ð$ó    c                  óˆ  • \ rS rSr% SrSrS\S'    \" S S9rS\S	'    \" S
SSS9r	S\S'   \" SSSS9r
S\S'   \" \SSS9rS\S'    \" SSSS9rS\S'   \" SSSS9rS\S'   \" \SSS9rS\S'    \" SSSS9rS\S'    S\S'   S rS!\S"'    \" \SSS9rS#\S$'    \" S% SSS9rS&\S''   S7S( jrS8S) jr\SSS\SS*.           S9S+ jj5       rS:S, jr      S;S- jr        S<S. jr        S=S/ jr            S>S0 jrS?S1 jr SS2.           S@S3 jjr!            SAS4 jr"          SBS5 jr#S6r$g)CÚInstrumentationéG   aŠ  Capability that instruments agent runs with OpenTelemetry/Logfire tracing.

When added to an agent via `capabilities=[Instrumentation(...)]`, this capability
creates OpenTelemetry spans for the agent run, model requests, and tool executions.

Other capabilities can add attributes to these spans using the OpenTelemetry API
(`opentelemetry.trace.get_current_span().set_attribute(key, value)`).
TzClassVar[bool]Ú_safe_at_runtimec                 ó   • [        5       $ ©N)rF   © rG   rE   Ú<lambda>ÚInstrumentation.<lambda>X   s   € ÔFWÔFYrG   )Údefault_factoryr>   ÚsettingsÚagentF)ÚdefaultÚreprÚinitÚstrÚ_agent_namer   ÚintÚ_new_message_index)rQ   rU   rV   r0   Ú
_run_usageNzlist[ModelMessage] | NoneÚ_last_messageszModelRequestParameters | NoneÚ_last_model_request_parameterszstr | None | UnsetÚ_last_formatted_instructionsÚboolÚ_variable_instructionsr   Ú_Úinstrumentationz
str | NoneÚidr   Ú_message_json_cachec                 ó6   • [         R                  " [        5      $ rM   )r   Úfor_versionr   rN   rG   rE   rO   rP      s   € Ô 4× @Ò @ÔA`Ô arG   r   Ú_instrumentation_namesc                ób   • [         R                  " U R                  R                  5      U l        g rM   )r   rf   rR   Úversionrg   ©Úselfs    rE   Ú__post_init__ÚInstrumentation.__post_init__„   s   € Ü&:×&FÒ&FÀtÇ}Á}×G\ÑG\Ó&]ˆÕ#rG   c                ó   • [        SS9$ )NÚ	outermost)Úposition)r3   rj   s    rE   Úget_orderingÚInstrumentation.get_ordering‡   s   € Ü!¨;Ñ7Ð7rG   ©Úinclude_binary_contentÚinclude_contentÚ include_model_request_parametersri   Ú$use_aggregated_usage_attribute_namesc          
     ó*   • SSK Jn  U " U" UUUUUS9S9$ )a  Build an `Instrumentation` capability from a YAML/JSON spec.

Accepts every serializable
[`InstrumentationSettings`][pydantic_ai.models.instrumented.InstrumentationSettings]
option. The OTel `tracer_provider` and `meter_provider` fields can't be expressed in YAML
and default to the global providers (typically configured via `logfire.configure()`).

`id` is deliberately not accepted. An agent has one instrumentation configuration -- which
is what the class-level default `id` says -- so there is nothing for a spec to name, and two
`Instrumentation` capabilities resolve to one rather than colliding.

YAML form:

    capabilities:
      - Instrumentation: {}                # default settings
      - Instrumentation:
          version: 2
          include_content: false
r   r=   rs   )rR   rC   )Úclsrt   ru   rv   ri   rw   r>   s          rE   Ú	from_specÚInstrumentation.from_specŠ   s,   € õ: 	LáÙ,Ø'=Ø /Ø1QØØ5Yññ
ð 	
rG   c              ƒ  óä   #   • [        U 5      nUR                  (       a  UR                  R                  OS=(       d    SUl        [	        UR
                  5      Ul        [        5       Ul        U$ 7f)z0Return a fresh copy for per-run state isolation.NrS   )	r	   rS   ÚnamerX   ÚlenÚmessagesrZ   r0   r[   )rk   ÚctxÚinsts      rE   Úfor_runÚInstrumentation.for_run³   sL   é € ä�t‹}ˆØ.1¯i¯i˜CŸI™IŸNšN¸T×MÀgˆÔÜ"% c§l¡lÓ"3ˆÔô #›*ˆŒØˆùs   ‚A.A0c             ƒ  ó®  #   • UR                   (       a  U" 5       I S h  v•N $ U R                  nU R                  nU R                  nUR                  (       a  UR                  R
                  OSUUUR                  =(       d    SUR                  =(       d    SSU S3S.nUR                  b,  UR                  R                  UR                  5      nUb  XvS'   UR                  R                  UR                  U5      USSS9 n[        XƒR                  S	9   [         R"                  " U R$                  5         ['        S
U5      n	['        SUR                  =(       d    SU	S9n	['        SUR                  =(       d    SU	S9n	[)        U	5      n
S n U" 5       I S h  v•N nUR                  (       a†  UR+                  5       (       aq  UR-                  S[/        UR0                  [2        5      (       a  UR0                  O5[5        [7        [9        UR0                  U5      5      5      R;                  5       5        U[=        U
5        UR+                  5       (       a¶  Ub  UR?                  5       nUR@                  nO+U RB                  =(       d    URD                  nUR@                  nURG                  U RI                  XU5      5        UbG  U RJ                  (       a6  [M        X<U RJ                  5      (       a  [N        RP                  " S[R        5        sS S S 5        sS S S 5        sS S S 5        $  GN GN’! [=        U
5        UR+                  5       (       aº  Ub  UR?                  5       nUR@                  nO+U RB                  =(       d    URD                  nUR@                  nURG                  U RI                  XU5      5        UbJ  U RJ                  (       a8  [M        X<U RJ                  5      (       a  [N        RP                  " S[R        5        f f f f f = f! , (       d  f       O= f S S S 5        O! , (       d  f       O= fS S S 5        g ! , (       d  f       g = f7f)Nzno-modelÚ Úinvoke_agentz run)Ú
model_nameÚ
agent_nameúgen_ai.agent.nameúgen_ai.agent.call.idúgen_ai.conversation.idúgen_ai.operation.nameúlogfire.msgzgen_ai.agent.descriptionF©Ú
attributesr   Úset_status_on_exception©ru   r‰   rŠ   )Úcontextr‹   Úfinal_resultaW  In-place mutation of messages already in the history was detected during this run: the `gen_ai.input.messages` attribute recorded on the run's model request spans may not match the messages actually sent to the model. Mutating history messages in place is not supported; build new message or part objects instead, e.g. via a history processor.)*ÚrealtimerR   rg   rX   Úmodelr‡   Úrun_idÚconversation_idrS   Úrender_descriptionÚdepsÚtracerÚstart_as_current_spanÚget_agent_run_span_nameÚ_record_uncaught_errorsru   r   Ú
accumulater[   Ú_otel_set_baggageÚ_otel_attachÚis_recordingÚset_attributeÚ
isinstanceÚoutputrW   r   r    r   ÚdecodeÚ_otel_detachÚall_messagesÚmetadatar\   r   Úset_attributesÚ_run_span_end_attributesrd   r   ÚwarningsÚwarnr&   )rk   r€   ÚhandlerrR   Únamesrˆ   Úspan_attributesÚrenderedÚspanÚotel_ctxÚtokenÚresultÚmessage_historyr¨   s                 rE   Úwrap_runÚInstrumentation.wrap_runÁ   s£  é € ð �<�<Ù ›—?Ð"à—=‘=ˆØ×+Ñ+ˆØ×%Ñ%ˆ
ð 36·)·)˜#Ÿ)™)×.Ò.ÀØ$Ø!+Ø$'§J¡J×$4°"Ø&)×&9Ñ&9×&?¸RØ%3Ø(˜\¨Ð.ñ+
ˆð �9‰9Ñ Ø—y‘y×3Ñ3°C·H±HÓ=ˆHØÑ#Ø>FÐ :Ñ;ð �O‰O×1Ñ1Ø×-Ñ-¨jÓ9Ø*Ø!&Ø(-ð	 2ñ ð
 Ü# D×:RÑ:RÓSô ×)Ò)¨$¯/©/Õ:ä(Ð)<¸jÓIˆHÜ(Ð)?ÀÇÁ×AQÈrÐ[cÑdˆHÜ(Ð)AÀ3×CVÑCV×C\ÐZ\ÐfnÑoˆHÜ  Ó*ˆEØ15ˆFð*Ù&›yŸ�à×+×+°×0AÑ0A×0CÑ0CØ×&Ñ&Ø&ô  *¨&¯-©-¼×=Ñ=ð #ŸMšMä!-¬mÔ<QÐRX×R_ÑR_ÐaiÓ<jÓ.kÓ!l×!sÑ!sÓ!uôð ä˜UÔ#Ø×$Ñ$×&Ñ&ð Ñ)Ø*0×*=Ñ*=Ó*?˜Ø#)§?¡?™ð +/×*=Ñ*=×*MÀÇÁ˜Ø#&§<¡<˜Ø×'Ñ'¨×(EÑ(EÀcÐ\dÓ(eÔfØÑ)ð
  ×3×3Ô8NØ$°t×7OÑ7O÷9ñ 9ô %ŸMšMð!5ô
 !=ô÷U ;Ð:÷ TÐS÷ñ ò- #òN )øô ˜UÔ#Ø×$Ñ$×&Ñ&ð Ñ)Ø*0×*=Ñ*=Ó*?˜Ø#)§?¡?™ð +/×*=Ñ*=×*MÀÇÁ˜Ø#&§<¡<˜Ø×'Ñ'¨×(EÑ(EÀcÐ\dÓ(eÔfØÑ)ð
  ×3×3Ô8NØ$°t×7OÑ7O÷9ñ 9ô %ŸMšMð!5ô
 !=õð9Ð3ð *ð 'ú÷/ ;Õ:úÐ:÷ T×SÖSú÷÷ ö üs’   ‚QžL*ŸC&QÄQÄ!P*Ä:APÆ
L0ÆL-
ÆBL0È8CPÌ	P*Ì	QÌ QÌ-L0Ì0CP	ÐPÐ
PÐP*Ð!	QÐ*
P8	Ð4QÐ;	QÑ
QÑQc                óš  • U R                   nU R                  n[        X R                  5      nS[	        UR                  [        U5      5      5      R                  5       0UR                  U5      EnUS:”  a  XWS'   U R                  (       a  SUS'   Ub.  [	        [        [        X45      5      5      R                  5       US'   UR                  U R                  5      n0 UEUES[        S0 UR                  5        V	V
s0 s H!  u  pšU	[!        U
["        5      (       a  S	S
0O0 _M#     sn
n	ESS	S00ES.5      R                  5       0E$ s  sn
n	f )z'Compute the end-of-run span attributes.zpydantic_ai.all_messagesr   zpydantic_ai.new_message_indexTz!pydantic_ai.variable_instructionsr¨   úlogfire.json_schemaÚobjectÚtypeÚarrayr“   ©r»   Ú
properties)rR   rZ   r   r]   r   Úmessages_to_otel_messagesÚlistr¥   Úsystem_instructions_attributesr`   r    r   Úaggregated_usage_attributesr[   r   Úitemsr£   rW   )rk   r€   rµ   r¨   rR   Únew_message_indexÚlast_instructionsÚattrsÚusage_attrsÚkÚvs              rE   rª   Ú(Instrumentation._run_span_end_attributes  sf  € ð —=‘=ˆØ ×3Ñ3Ðä,¨_×>aÑ>aÓbÐà&¬Ø×2Ñ2´4¸Ó3HÓIó)ç‰f‹hð!
ð ×5Ñ5Ð6GÓHð	!
ˆð ˜qÓ Ø5FÐ1Ñ2à×&×&Ø9=ˆEÐ5Ñ6àÑÜ ,¬]Ô;PÐQYÓ;dÓ-eÓ f× mÑ mÓ oˆE�*Ñð ×:Ñ:¸4¿?¹?ÓKˆð
Øð
àð
ð "¤7à$ð#ØZ_×ZeÑZeÔZgÔhÒZgÑRVÐRS˜1´:¸aÄ×3EÑ3E˜v wÑ/È2ÒMÑZgÒhð#à&¨°Ð(:ñ#ñó$÷ ‰f‹hñ
ð 	
ùó is   Ã>(Ec             ƒ  óØ  #   • UR                   U l        [        U R                  X R                  S9 u  nnUR
                  U l        [        UR                   UR
                  5      n[        U R                  [        5      (       d  X`R                  :w  a  SU l        X`l	        U" U5      I S h  v•N nU" U[        R                  " 5       S9  UsS S S 5        $  N)! , (       d  f       g = f7f)N)Úmessage_json_cacheT)Útime_to_first_chunk)r   r\   r   rR   rd   Úmodel_request_parametersr]   r   r£   r^   r#   r`   r!   Úget)rk   r€   Úrequest_contextr­   ÚfinishÚprepared_request_contextÚcurrent_instructionsÚresponses           rE   Úwrap_model_requestÚ"Instrumentation.wrap_model_requestQ  sÑ   é € ð .×6Ñ6ˆÔä$ T§]¡]°O×XpÑXpÒqñ v
ØØ$ð 3K×2cÑ2cˆDÔ/ô $4Ø×(Ñ(Ð*B×*[Ñ*[ó$Ð ô ˜d×?Ñ?Ä×GÑGØ'×+LÑ+LÓLØ26�DÔ/Ø0DÔ-á$ _Ó5×5ˆHñ �8Ô1H×1LÒ1LÓ1NÒOØ÷3 rÑqñ( 6÷) rÕqüs/   ‚0C*²A;CÂ-CÂ.CÃ
C*ÃCÃ
C'Ã#C*c             ƒ  ó¼  #   • U R                   nU R                  U5      nSUR                   3US'   SXvR                  '   U R                  R
                  R                  UR                  UR                  5      USSS9 nU R                  R                  (       ah  UR                  5       (       aS  [        R                  " XRR                  UR                  S9n	UR                  UR                  U	R                  5       5        [!        X…U R                  R                  S9  UR#                  [$        R&                  5        SSS5        Ue! , (       d  f       Ue= f7f)	a'  Emit an error span for a tool call whose argument validation failed.

Runs only after every other capability has declined to recover the error, so a
recovered validation failure produces no span. The span keeps the `execute_tool`
operation name so tracing backends group it with other tool spans, and sets
`pydantic_ai.tool.failure_stage: 'validation'` to distinguish it from execution
failures.

With content capture enabled, the span records the retry prompt built from the
error as the tool result. That is the exact message the model receives when the
agent loop handles the failure; raw-mode callers (e.g. sandboxed dispatch via
`handle_call(wrap_validation_errors=False)`) surface the raw exception to the
calling code instead, and the recorded prompt is just the rendered description
of the failure.
zinvalid tool call: r�   Ú
validationFrŽ   )Ú	tool_nameÚtool_call_idr‘   N)rg   Ú_tool_span_attributesrÙ   Útool_failure_stage_attrrR   rš   r›   Úget_tool_span_nameru   r¡   r,   Ú
from_errorrÚ   r¢   Útool_result_attrÚmodel_responseÚ_record_exceptionÚ
set_statusr   ÚERROR)
rk   r€   ÚcallÚtool_defÚargsÚerrorr®   r�   r±   Úretrys
             rE   Úon_tool_validate_errorÚ&Instrumentation.on_tool_validate_error{  s  é € ð0 ×+Ñ+ˆØ×/Ñ/°Ó5ˆ
ð ':¸$¿.¹.Ð9IÐ$Jˆ
�=Ñ!Ø4@ˆ
×0Ñ0Ñ1Ø�]‰]×!Ñ!×7Ñ7Ø×$Ñ$ T§^¡^Ó4Ø!Ø"Ø$)ð	 8ñ 
ð
 Ø�}‰}×,×,°×1BÑ1B×1DÑ1DÜ'×2Ò2°5ÇNÁNÐae×arÑarÑs�Ø×"Ñ" 5×#9Ñ#9¸5×;OÑ;OÓ;QÔRÜ˜d¸4¿=¹=×;XÑ;XÒYØ�O‰OœJ×,Ñ,Ô-÷
ð ˆ÷
ô 
ð ˆüs   ‚A=EÁ?CE
Å 
EÅ

EÅEc                óˆ  • U R                   nU R                  R                  nSUR                  UR                  S.U(       a  UR
                  UR                  5       0O0 E[        5       ESUR                   3[        S0 U(       a  UR
                  SS0UR                  SS00O0 E0 0 S.ES.5      R                  5       S.E$ )	u:  Build the span attributes shared by `wrap_tool_execute` and `wrap_output_process`.

Both spans use `gen_ai.operation.name='execute_tool'` and the same `gen_ai.tool.*`
attributes â€” they only differ in how the result is serialized and which exceptions
are special-cased, which stays in the call-site `try/except`.
Úexecute_tool)rŒ   úgen_ai.tool.nameúgen_ai.tool.call.idzrunning tool: rº   r»   )rí   rî   r½   )r�   r¹   )rg   rR   ru   rÙ   rÚ   Útool_arguments_attrÚargs_as_json_strr   r   rß   r¥   )rk   rä   r®   ru   s       rE   rÛ   Ú%Instrumentation._tool_span_attributes¦  sä   € ð ×+Ñ+ˆØŸ-™-×7Ñ7ˆà%3Ø $§¡Ø#'×#4Ñ#4ñ
ö HW�×)Ñ)¨4×+@Ñ+@Ó+BÑCÐ\^ð	
ô
 /Ó0ð
ð ,¨D¯N©NÐ+;Ð<Ü#*à$ð#ö  /ð !&× 9Ñ 9¸FÀHÐ;MØ %× 6Ñ 6¸ÀÐ8Jñð
 "$ð#ð -/Ø/1ò#ñó$÷  ‰f‹hò/
ð 	
rG   )Úhandle_tool_control_flowc          	   ƒ  óÊ  #   • U R                   nU R                  nUR                  nUR                  R	                  UUSSS9 n	 U" 5       I Sh  v•N n
U(       aN  U	R                  5       (       a9  U	R                  UR4                  [C        U
[D        5      (       a  U
OU" U
5      5        SSS5        U
$  Nc! [
        [        4 Ga6  nU(       d*  [        X›US9  U	R                  [        R                  5        e U	R                  UR                  [        U5      R                  5        U(       a�  U	R                  5       (       a{  UR                   bn  [#        UR                   U5      n [%        U5      R'                  5       nO!! [(        [*        4 a    [-        U5      n Of = fU	R                  UR.                  U5        UR0                  S:  a)  [        X›US9  U	R                  [        R                  5        e SnAf[2         a†  nU(       aP  U(       aI  U	R                  5       (       a4  U	R                  UR4                  UR6                  R9                  5       5        [        XžUS9  U	R                  [        R                  5        e SnAf[:         a…  nU(       aO  U(       aH  U	R                  5       (       a3  U	R                  UR4                  UR<                  R?                  SS95        [        XžUS9  U	R                  [        R                  5        e SnAf[@         a/  n[        XžUS9  U	R                  [        R                  5        e SnAff = f! , (       d  f       W
$ = f7f)u¿  Open a `gen_ai`-flavoured tool/output span around `action`.

Records the serialized result on success (when `include_content` is enabled and
the span is recording), records the exception and sets status `ERROR` on failure.

When `handle_tool_control_flow` is True, the helper additionally special-cases
`CallDeferred`/`ApprovalRequired` (deferrals are control flow, not errors) and
records `ToolRetryError`'s retry prompt as the tool result before re-raising.
Output-function spans leave that flag off â€” `ToolRetryError` is treated as a
plain error there because the retry prompt is recorded on the surrounding
request/agent spans, and `CallDeferred`/`ApprovalRequired` never reach output
processing.
FrŽ   Nr‘   é   )Úwrap_if_error)#rR   rg   ru   rš   r›   r%   r$   rá   râ   r   rã   r¢   Útool_deferral_name_attrr»   Ú__name__r¡   r¨   r   r   r¥   Ú	TypeErrorÚ
ValueErrorrU   Útool_deferral_metadata_attrri   r)   rß   Ú
tool_retryrà   r(   Útool_failedÚmodel_response_strÚBaseExceptionr£   rW   )rk   Ú	span_namer�   ÚactionÚserialize_resultrò   rR   r®   ru   r±   r´   ÚexcÚredacted_metadataÚmetadata_strÚes                  rE   Ú_run_tool_spanÚInstrumentation._run_tool_spanÉ  s±  é € ð, —=‘=ˆØ×+Ñ+ˆØ"×2Ñ2ˆà�_‰_×2Ñ2ØØ!Ø"Ø$)ð	 3ñ 
ð
 ð'Ù%›xŸ�öP  4×#4Ñ#4×#6Ñ#6Ø×"Ñ"Ø×*Ñ*Ü(¨´×5Ñ5‘FÑ;KÈFÓ;Sô÷a
ðj ˆñ] (øÜ Ô"2Ð3ô Þ/Ü% dÀÒQØ—O‘O¤J×$4Ñ$4Ô5Øð ×"Ñ" 5×#@Ñ#@Ä$ÀsÃ)×BTÑBTÔUÞ" t×'8Ñ'8×':Ñ':¸s¿|¹|Ñ?WÜ(=¸c¿l¹lÈHÓ(UÐ%ð?Ü'.Ð/@Ó'A×'HÑ'HÓ'J™øÜ%¤zÐ2ó ?Ü'+Ð,=Ó'>šð?úà×&Ñ& u×'HÑ'HÈ,ÔWØ×#Ñ# aÓ'Ü% dÀÒQØ—O‘O¤J×$4Ñ$4Ô5ØûÜ!ó Þ+¶ÀD×DUÑDU×DWÑDWð ×&Ñ& u×'=Ñ'=¸q¿|¹|×?ZÑ?ZÓ?\Ô]Ü! $¸?ÒKØ—‘¤
× 0Ñ 0Ô1ØûÜ"ó Þ+¶ÀD×DUÑDU×DWÑDWØ×&Ñ& u×'=Ñ'=¸q¿}¹}×?_Ñ?_ÐnsÐ?_Ð?tÔuÜ! $¸?ÒKØ—‘¤
× 0Ñ 0Ô1ØûÜ ó Ü! $¸?ÒKØ—‘¤
× 0Ñ 0Ô1Øûðú÷U
ô 
ðj ˆüs¡   ‚AM#ÁMÁ
B5ÁB3ÁB5ÁAMÂ)
M#Â3B5Â5MÃBG7Å&F Å?G7Æ FÆG7ÆFÆAG7Ç7MÈBJÊMÊB LÌMÌ*M	Í	MÍMÍ
M ÍM#c             ƒ  óð   ^ ^^#   • T R                  U5      nUR                  (       a  SUS'   T R                  T R                  R	                  UR
                  5      UUU4S jU 4S jSS9I S h  v•N $  N7f)NTzpydantic_ai.realtimec                 ó   >• T" T 5      $ rM   rN   )ræ   r­   s   €€rE   rO   Ú3Instrumentation.wrap_tool_execute.<locals>.<lambda>,  s	   ø€ ™7 4œ=rG   c                ót   >• [         R                  " [        U TR                  5      5      R	                  5       $ rM   )r.   Ú	dump_jsonr   rR   r¥   ©Úvaluerk   s    €rE   rO   r
  -  s*   ø€ ¬>×+CÒ+CÜ% e¨T¯]©]Ó;ó,ç‰f‹hð,rG   )rÿ   r�   r   r  rò   )rÛ   r”   r  rg   rÝ   rÙ   )rk   r€   rä   rå   ræ   r­   r�   s   `   `` rE   Úwrap_tool_executeÚ!Instrumentation.wrap_tool_execute  sv   úé € ð ×/Ñ/°Ó5ˆ
Ø�<�<ð 26ˆJÐ-Ñ.Ø×(Ñ(Ø×1Ñ1×DÑDÀTÇ^Á^ÓTØ!Ý(ôð &*ð )ð 
÷ 
ð 	
ñ 
ùs   …A*A6Á/A4Á0A6c          	   ƒ  ó&  ^ ^^#   • UR                   (       d  T" T5      I Sh  v•N $ T R                  nT R                  R                  nUR                  nU(       a  UR
                  OUR                  =(       d    SnSUS.[        5       ESSU 30En	Ub   UR                  (       a  UR                  U	S'   U(       a9  [        [        TT R                  5      5      R                  5       X•R                  '   [        S0 U(       a  UR                  S	S0UR                  S	S00O0 ES
0 0EUb  UR                  (       a  S0 0O0 ES.5      R                  5       U	S'   T R                  UR!                  U5      U	UU4S jU 4S jS9I Sh  v•N $  GNj N7f)u£  Emit a span for output-function execution.

Output processing for plain validation (no function) is not span-worthy â€” the
validated value is the model's response itself, no user code ran. We open a
span only when an output function will execute, regardless of whether the
output arrived via a tool call. The span name reflects the function (or tool
name when the function name is unavailable, e.g. union processors).
NÚoutput_functionrì   )rŒ   rí   r�   zrunning output function: rî   rº   r»   rí   r½   r¹   c                 ó   >• T " T5      $ rM   rN   )r­   r¤   s   €€rE   rO   Ú5Instrumentation.wrap_output_process.<locals>.<lambda>r  s	   ø€ ™7 6œ?rG   c                óp   >• [        [        [        U TR                  5      5      5      R	                  5       $ rM   )r   r    r   rR   r¥   r  s    €rE   rO   r  s  s*   ø€ ¬<ÜÔ3°E¸4¿=¹=ÓIÓJó,ç‰f‹hð,rG   )rÿ   r�   r   r  )Úhas_functionrg   rR   ru   Ú	tool_callrÙ   Úfunction_namer   rÚ   r   r   r¥   rï   r   rß   r  Úget_output_tool_span_name)
rk   r€   Úoutput_contextr¤   r­   r®   ru   r  Úspan_targetr�   s
   `  ``     rE   Úwrap_output_processÚ#Instrumentation.wrap_output_process7  s±  úé € ð  ×*×*Ù  ›×(Ð(à×+Ñ+ˆØŸ-™-×7Ñ7ˆØ"×,Ñ,ˆ	ö .7�i×)Ò)¸^×=YÑ=Y×=nÐ]nˆð &4Ø +ñ&
ô /Ó0ð&
ð Ð6°{°mÐDñ	&
ˆ
ð Ñ  Y×%;×%;Ø09×0FÑ0FˆJÐ,Ñ-ÞÜ4@ÔAVÐW]Ð_c×_lÑ_lÓAmÓ4n×4uÑ4uÓ4wˆJ×0Ñ0Ñ1ä,3à ðö +ð "×5Ñ5¸ÀÐ7IØ!×2Ñ2°V¸XÐ4Fñð
  ðð '¨ñð 7@Ñ6KÐPY×Pf×PfÐ-¨rÑ2Ðlnðñó-
÷  ‰&‹(ð! 	Ð(Ñ)ð$ ×(Ñ(Ø×5Ñ5°kÓBØ!Ý*ôð	 )ð 
÷ 
ð 	
òO )ñN
ùs"   …F¢F£E$FÆFÆFÆF)rg   r^   r\   r]   r`   )ÚreturnÚNone)r  r3   )rt   r_   ru   r_   rv   r_   ri   zLiteral[2, 3, 4, 5, 6]rw   r_   r  rI   )r€   úRunContext[Any]r  rI   )r€   úRunContext[AgentDepsT]r­   r8   r  zAgentRunResult[Any])r€   r   rµ   zlist[ModelMessage]r¨   zdict[str, Any] | Noner  z#dict[str, str | int | float | bool])r€   r!  rÐ   r;   r­   r6   r  r+   )r€   r!  rä   r-   rå   r/   ræ   r4   rç   zValidationError | ModelRetryr  r5   )rä   r-   r  údict[str, Any])rÿ   rW   r�   r"  r   zCallable[[], Awaitable[Any]]r  zCallable[[Any], str]rò   r_   r  r   )r€   r!  rä   r-   rå   r/   ræ   r5   r­   r9   r  r   )
r€   r!  r  r?   r¤   r   r­   r7   r  r   )%r÷   Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__rK   Ú__annotations__r   rR   rX   rZ   r0   r[   r\   r]   r"   r^   r`   rc   r   rd   rg   rl   rq   Úclassmethodr   rz   r‚   r¶   rª   rÕ   ré   rÛ   r  r  r  Ú__static_attributes__rN   rG   rE   rI   rI   G   s  ‡ ñð (,Ð�nÓ+ðñ
 ).Ñ>YÑ(Z€HÐ%ÓZð_ñ  W°5¸uÑE€K�ÓEÙ#¨A°EÀÑFÐ˜ÓFÙ °ÀÈEÑR€J�ÓRðñ
 16¸dÈÐUZÑ0[€NÐ-Ó[ÙDIÐRVÐ]bÐinÑDoÐ"Ð$AÓoÙ7<ÀUÐQVÐ]bÑ7cÐ Ð"4ÓcØ]Ù#(°¸UÈÑ#OÐ˜DÓOØNàƒJà&€Bˆ
Ó&ðñ
 -2ÐBRÐY^ÐejÑ,kÐÐ)Ókð+ñ
 49ÙaØØñ4ÐÐ0ó ô^ô8ð ð (,Ø $Ø15Ø*IØ59ñ&
ð !%ð&
ð ð	&
ð
 +/ð&
ð (ð&
ð /3ð&
ð 
ô&
ó ð&
ôPðZà#ðZð  ð	Zð
 
ôZðx.
àð.
ð ,ð.
ð (ð	.
ð
 
-ô.
ðh$à#ð$ð -ð	$ð
 )ð$ð 
ô$ðT)à#ð)ð ð	)ð
 !ð)ð ð)ð ,ð)ð 
ô)ôV!
ðT */ñOð ðOð #ð	Oð
 -ðOð /ðOð #'ðOð 
õOðb
à#ð
ð ð	
ð
 !ð
ð  ð
ð (ð
ð 
ô
ð:?
à#ð?
ð &ð	?
ð
 ð?
ð *ð?
ð 
÷?
rG   rI   )r  r>   )[r&  Ú
__future__r   r«   Úcollections.abcr   r   Údataclassesr   r   r   r	   Útypingr
   r   r   r   Úopentelemetry.baggager   rŸ   Úopentelemetry.contextr   r    r   r¦   Úopentelemetry.tracer   Úpydantic_corer   r   Úpydantic_air   Úpydantic_ai._instrumentationr   r   r   r   r   r   r   r   rá   r   r�   r   r   r    r!   Úpydantic_ai._utilsr"   r#   Úpydantic_ai.exceptionsr$   r%   r&   r'   r(   r)   Úpydantic_ai.messagesr*   r+   r,   r-   r.   Úpydantic_ai.toolsr/   Úpydantic_ai.usager0   Úabstractr2   r3   r4   r5   r6   r7   r8   r9   Úpydantic_ai._run_contextr:   Úpydantic_ai.modelsr;   r<   rD   r>   Úpydantic_ai.outputr?   Úpydantic_ai.runr@   rA   rF   rI   rN   rG   rE   Ú<module>r>     s­   ðÙ Qå "ã ß /ß :Ó :ß 8Ó 8å Bß PÝ *ß 2å *÷÷ ÷ õ ÷ ,÷÷ ÷ lÕ kÝ ,Ý &÷	÷ 	ó 	ö Ý3ßNÝGÝ0Ý.Ý,ô%ð ôn
Ð(¨Ñ-ó n
ó ñn
rG   