
    Cj-                         S SK JrJr  S SKJr  SSKJrJr  SSKJ	r	J
r
  SSKJrJrJr  SSKJr  \" S\\S	9r " S
 S\\\4   5      r " S S\\\4   5      r\\\4   r \\\4   rg)    )AnyGeneric)TypeVar   )Agent	AgentBase)ModelResponseTResponseInputItem)AgentHookContextRunContextWrapperTContext)ToolTAgent)bounddefaultc            
          \ rS rSrSrS\\   S\\   S\S-  S\	\
   SS4
S	 jrS\\   S\\   S
\SS4S jrS\\   S\SS4S jrS\\   S\S\SS4S jrS\\   S\S\SS4S jrS\\   S\S\SS4S jrS\\   S\S\S\SS4
S jrSrg)RunHooksBase   zyA class that receives callbacks on various lifecycle events in an agent run. Subclass and
override the methods you need.
contextagentsystem_promptNinput_itemsreturnc                    #    g7f)z3Called just before invoking the LLM for this agent.N selfr   r   r   r   s        b/home/rurouni/.local/share/pipx/venvs/strix-agent/lib/python3.13/site-packages/agents/lifecycle.pyon_llm_startRunHooksBase.on_llm_start   
      	   responsec                    #    g7f)z=Called immediately after the LLM call returns for this agent.Nr   r   r   r   r#   s       r   
on_llm_endRunHooksBase.on_llm_end   
      	r"   c                    #    g7f)zCalled before the agent is invoked. Called each time the current agent changes.

Args:
    context: The agent hook context.
    agent: The agent that is about to be invoked.
Nr   r   r   r   s      r   on_agent_startRunHooksBase.on_agent_start%   r(   r"   outputc                    #    g7f)zCalled when the agent produces a final output.

Args:
    context: The agent hook context.
    agent: The agent that produced the output.
    output: The final output produced by the agent.
Nr   r   r   r   r-   s       r   on_agent_endRunHooksBase.on_agent_end.   
      	r"   
from_agentto_agentc                    #    g7f)zCalled when a handoff occurs.Nr   )r   r   r3   r4   s       r   
on_handoffRunHooksBase.on_handoff=   r(   r"   toolc                    #    g7fa@  Called immediately before a local tool is invoked.

For function-tool invocations, ``context`` is typically a ``ToolContext`` instance,
which exposes tool-call-specific metadata such as ``tool_call_id``, ``tool_name``,
and ``tool_arguments``. Other local tool families may provide a plain
``RunContextWrapper`` instead.
Nr   r   r   r   r8   s       r   on_tool_startRunHooksBase.on_tool_startF   r2   r"   resultc                    #    g7fa?  Called immediately after a local tool is invoked.

For function-tool invocations, ``context`` is typically a ``ToolContext`` instance,
which exposes tool-call-specific metadata such as ``tool_call_id``, ``tool_name``,
and ``tool_arguments``. Other local tool families may provide a plain
``RunContextWrapper`` instead.
Nr   r   r   r   r8   r>   s        r   on_tool_endRunHooksBase.on_tool_endU   
      	r"   r   )__name__
__module____qualname____firstlineno____doc__r   r   r   strlistr
   r   r	   r&   r   r   r+   r   r0   r6   r   r<   rB   __static_attributes__r       r   r   r      sn   "8, X Tz	
 ,- 
"8, X  	
 
,<X,F v Z^ !(+  	
 
"8,  	
 
"8,  	
 
"8,  	
  
rM   r   c            
          \ rS rSrSrS\\   S\SS4S jrS\\   S\S\	SS4S	 jr
S\\   S\S
\SS4S jrS\\   S\S\SS4S jrS\\   S\S\S\SS4
S jrS\\   S\\   S\S-  S\\   SS4
S jrS\\   S\\   S\SS4S jrSrg)AgentHooksBasef   zA class that receives callbacks on various lifecycle events for a specific agent. You can
set this on `agent.hooks` to receive events for that specific agent.

Subclass and override the methods you need.
r   r   r   Nc                    #    g7f)zCalled before the agent is invoked. Called each time the running agent is changed to this
agent.

Args:
    context: The agent hook context.
    agent: This agent instance.
Nr   r*   s      r   on_startAgentHooksBase.on_startm   r!   r"   r-   c                    #    g7f)zCalled when the agent produces a final output.

Args:
    context: The agent hook context.
    agent: This agent instance.
    output: The final output produced by the agent.
Nr   r/   s       r   on_endAgentHooksBase.on_endw   r2   r"   sourcec                    #    g7f)zjCalled when the agent is being handed off to. The `source` is the agent that is handing
off to this agent.Nr   )r   r   r   rW   s       r   r6   AgentHooksBase.on_handoff   r!   r"   r8   c                    #    g7fr:   r   r;   s       r   r<   AgentHooksBase.on_tool_start   r2   r"   r>   c                    #    g7fr@   r   rA   s        r   rB   AgentHooksBase.on_tool_end   rD   r"   r   r   c                    #    g7f)z7Called immediately before the agent issues an LLM call.Nr   r   s        r   r   AgentHooksBase.on_llm_start   r!   r"   r#   c                    #    g7f)z=Called immediately after the agent receives the LLM response.Nr   r%   s       r   r&   AgentHooksBase.on_llm_end   r(   r"   r   )rE   rF   rG   rH   rI   r   r   r   rR   r   rU   r   r6   r   r<   rJ   rB   r   rK   r
   r   r	   r&   rL   r   rM   r   rO   rO   f   sn   &6x&@  TX !(+  	
 
"8,  	
 
"8,  	
 
"8,  	
  
 "8, X Tz	
 ,- 
"8, X  	
 
rM   rO   N)typingr   r   typing_extensionsr   r   r   r   itemsr	   r
   run_contextr   r   r   r8   r   r   r   rO   RunHooks
AgentHooksr   rM   r   <module>rh      s~     % # 4 F F 	I	>V78V+, VrZWXv-. Zz %( #HeO,
 rM   