code_executor
Execute Python code in a sandbox to solve computational tasks, analyze data, or perform scientific calculations through iterative reasoning and execution.
Instructions
Solve a task by letting Grok run Python in a stateful sandbox.
The agent iteratively writes and executes Python (with common scientific
libraries) to arrive at a numeric, data, or analysis answer.
Args:
prompt: Task or question requiring computation.
model: Grok model driving the agent (default `grok-4-1-fast-reasoning`).
max_turns: Cap the number of reasoning/execution turns.
Returns:
Markdown with the final answer followed by each code execution block's stdout.Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| prompt | Yes | ||
| model | No | grok-4-1-fast-reasoning | |
| max_turns | No |