
    Cj
                        S SK Jr  S SKJr  S SKJr  SSKJr  SSK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  SS\S.         SS jjrg)    )annotations)Any)ResponseTextDeltaEvent   )Agent)TResponseInputItem)RunResultBase)DEFAULT_MAX_TURNSRunner)TContext)AgentUpdatedStreamEventRawResponsesStreamEventRunItemStreamEventTN)streamcontext	max_turnsc               R  #    U n/ n  [        S5      nUR	                  5       R                  5       S;   a  gU(       d  M9  UR                  SUS.5        U(       Ga<  [        R                  " XEX#S9nUR                  5         Sh  vN n[        U[        5      (       aB  [        UR                  [        5      (       a!  [        UR                  R                  SSS	9  M^  M`  [        U[        5      (       af  UR                   R"                  S
:X  a  [        SSS9  M  UR                   R"                  S:X  a$  [        SUR                   R$                   S3SS9  M  M  [        U[&        5      (       d  M  [        SUR(                  R*                   S3SS9  GM  [        R,                  " XEX#S9I Sh  vN nUR.                  b  [        UR.                  5        UR0                  nUR3                  5       nGM  ! [        [        4 a    [        5          gf = f GN
 [        5         NN Nt7f)a  Run a simple REPL loop with the given agent.

This utility allows quick manual testing and debugging of an agent from the
command line. Conversation state is preserved across turns. Enter ``exit``
or ``quit`` to stop the loop.

Args:
    agent: The starting agent to run.
    stream: Whether to stream the agent output.
    context: Additional context information to pass to the runner.
    max_turns: Maximum number of turns for the runner to iterate.
Tz > >   exitquituser)rolecontent)inputr   r   N )endflushtool_call_itemz
[tool called])r   tool_call_output_itemz
[tool output: ]z
[Agent updated: )r   r   )r   EOFErrorKeyboardInterruptprintstriplowerappendr   run_streamedstream_events
isinstancer   datar   deltar   itemtypeoutputr   	new_agentnamerunfinal_output
last_agentto_input_list)	agentr   r   r   current_agentinput_items
user_inputresultevents	            ]/home/rurouni/.local/share/pipx/venvs/strix-agent/lib/python3.13/site-packages/agents/repl.pyrun_demo_loopr;      s    ( M,.K
	uJ ##%)99FzBC (('F  &335 
Tee%<==!%**.DEEejj..BdC F'9::zz*::/t<,CC 01B1B0C1ETR D'>??.u/C/C.DAFdS "::G F "".f))*))**,M  +, 	G	
T5 Gs`   H'G6 A-H'HHH	C&H'3=H'0H%1AH'6HH'HH'HH')
r4   z
Agent[Any]r   boolr   zTContext | Noner   intreturnNone)
__future__r   typingr   0openai.types.responses.response_text_delta_eventr   r4   r   itemsr   r8   r	   r0   r
   r   run_contextr   r'   r   r   r   r;        r:   <module>rG      sc    "  S  % ! * ! _ _ #&<-<- <- 	<-
 <- 
<-rF   