Code Execution
code_execution runs sandboxed remote Python analysis on xAI’s Responses API.
This is different from local exec:
execruns shell commands on your machine or nodecode_executionruns Python in xAI’s remote sandbox
code_execution for:
- calculations
- tabulation
- quick statistics
- chart-style analysis
- analyzing data returned by
x_searchorweb_search
exec for that.
Setup
You need an xAI API key. Any of these work:XAI_API_KEYplugins.entries.xai.config.webSearch.apiKey
How To Use It
Ask naturally and make the analysis intent explicit:task parameter internally, so the agent should send
the full analysis request and any inline data in one prompt.
Limits
- This is remote xAI execution, not local process execution.
- It should be treated as ephemeral analysis, not a persistent notebook.
- Do not assume access to local files or your workspace.
- For fresh X data, use
x_searchfirst.