CodeAct Round-Trip

The agent emits one execute_code call; the sandbox runs it, calls tools, and returns results to the conversation

CodeAct Round-Trip The agent emits one execute_code call; the sandbox runs it, calls tools, and returns results to the conversation execute_code(program) call_tool(args) tool result program output append result context for next step Emit + run Feed back Agent · reasoning loop · Sequence participant Agent reasoning loop Sandbox · code runtime · Sequence participant Sandbox code runtime Tool · call_tool target · Sequence participant Tool call_tool target Conversation · message history · Sequence participant Conversation message history Legend request return security async trace

Code Is The Action

  • • The agent emits one execute_code call per step
  • • A single program replaces many discrete tool calls
  • • Control returns only after the program finishes

Tools From Inside

  • • The sandboxed program calls tools via call_tool
  • • Tool results are consumed inside the same run
  • • The sandbox isolates untrusted execution

Back Into Context

  • • Program output is appended to the conversation
  • • The next step reasons over the accumulated result
  • • The loop repeats until the task is complete