@@ -105,9 +105,22 @@ async def execute_spec_payload(
105105 )
106106 return self ._serialize_result (result )
107107
108- async def execute_sandbox_tool (self , parameters : dict , query : pipeline_query .Query ) -> dict :
109- spec_payload = dict (parameters )
108+ async def execute_tool (self , parameters : dict , query : pipeline_query .Query ) -> dict :
109+ """Execute an agent-facing ``exec`` tool call.
110+
111+ Translates the agent-facing ``command`` field to the internal
112+ ``BoxSpec.cmd`` field and injects the session id from the query.
113+ """
114+ spec_payload : dict = {'cmd' : parameters ['command' ]}
115+
116+ # Pass through allowed agent-facing fields
117+ for key in ('workdir' , 'timeout_sec' , 'env' ):
118+ if key in parameters :
119+ spec_payload [key ] = parameters [key ]
120+
121+ # Inject context the agent must not control
110122 spec_payload .setdefault ('session_id' , str (query .query_id ))
123+
111124 return await self .execute_spec_payload (spec_payload , query )
112125
113126 async def shutdown (self ):
@@ -379,23 +392,23 @@ def get_recent_errors(self) -> list[dict]:
379392 return list (self ._recent_errors )
380393
381394 def get_system_guidance (self ) -> str :
382- """Return LLM system-prompt guidance for sandbox_exec .
395+ """Return LLM system-prompt guidance for the exec tool .
383396
384- All sandbox -specific prompt text is kept here so that callers
397+ All execution -specific prompt text is kept here so that callers
385398 (e.g. LocalAgentRunner) stay free of box domain knowledge.
386399 """
387400 guidance = (
388- 'When sandbox_exec is available, use it for exact calculations, statistics, structured data parsing, '
401+ 'When the exec tool is available, use it for exact calculations, statistics, structured data parsing, '
389402 'and code execution instead of estimating mentally. If the user provides numbers, tables, CSV-like text, '
390- 'JSON, or other data and asks for a computed answer, prefer running a short Python script in sandbox_exec '
403+ 'JSON, or other data and asks for a computed answer, prefer running a short Python script via exec '
391404 'and then answer from the tool result. Unless the user explicitly asks for the script, code, or implementation '
392405 'details, do not include the generated script in the final answer; return the result and a brief explanation only.'
393406 )
394407 if self .default_host_workspace :
395408 guidance += (
396- ' A default host workspace is mounted at /workspace for file tasks. When the user asks to read, create, or '
397- 'modify local files in the working directory, use sandbox_exec with /workspace paths directly; do not ask the '
398- 'user for sandbox parameters such as host_path unless they explicitly need a different directory.'
409+ ' A default workspace is mounted at /workspace for file tasks. When the user asks to read, create, or '
410+ 'modify local files in the working directory, use exec with /workspace paths directly; do not ask the '
411+ 'user for directory parameters unless they explicitly need a different directory.'
399412 )
400413 return guidance
401414
0 commit comments