@@ -89,14 +89,16 @@ async def _stream_modal_sandbox(question: str, api_base_url: str):
8989 """Stream output from Claude Code running in Modal Sandbox."""
9090 from concurrent .futures import ThreadPoolExecutor
9191
92- # Immediate log and yield
92+ # Immediate log
93+ print ("[AGENT] _stream_modal_sandbox started" , flush = True )
9394 logfire .info ("_stream_modal_sandbox: started" , question = question [:100 ])
9495
9596 sb = None
9697 executor = ThreadPoolExecutor (max_workers = 1 )
9798 try :
9899 from policyengine_api .agent_sandbox import run_claude_code_in_sandbox
99100
101+ print ("[AGENT] creating sandbox" , flush = True )
100102 logfire .info (
101103 "_stream_modal_sandbox: creating sandbox" , api_base_url = api_base_url
102104 )
@@ -106,6 +108,7 @@ async def _stream_modal_sandbox(question: str, api_base_url: str):
106108 sb , process = await loop .run_in_executor (
107109 executor , run_claude_code_in_sandbox , question , api_base_url
108110 )
111+ print ("[AGENT] sandbox created" , flush = True )
109112 logfire .info ("_stream_modal_sandbox: sandbox created" )
110113
111114 # Poll for lines with timeout to allow other async tasks
@@ -215,6 +218,7 @@ async def stream_analysis(request: AskRequest):
215218 data: {"type": "done", "returncode": 0}
216219 ```
217220 """
221+ print (f"[AGENT] /stream called, use_modal={ settings .agent_use_modal } " , flush = True )
218222 api_base_url = settings .policyengine_api_url
219223 logfire .info (
220224 "stream_analysis: called" ,
0 commit comments