Running code in chat
Found this helpful? Share it:
Found this helpful? Share it:
The assistant can write real code and run it for you: a data transform, a script to test an API, a quick calculation that deserves actual arithmetic. It runs the code on a cloud computer and hands you back the output right in the chat 💻
Running code Pro and upneeds a computer the assistant can reach. On the free tier the assistant will still write code for you, but it cannot run it until you are on a paid plan with a computer available.
When a task calls for it, the assistant writes the code, runs it on a cloud computer(or one of your own paired machines), and shows you what it produced. The command output appears in the conversation, and any files the code writes land in your Drive so you can open, download, or reuse them.
You do not need special syntax. Ask for something that involves code, for example "parse this CSV and chart the totals" or "test whether this endpoint returns valid JSON", and the assistant decides when running code beats describing an answer.
Be specific about what the code should do. The more context you give, the more likely the first run is the one you wanted.
For work that takes a while, such as a build, a training run, or a server you want to keep alive, the assistant can start the job in a persistent session on the computer and check back on it, rather than blocking the chat until it finishes. See Computers for how machines connect and what they can do.
Time on a cloud computer is billed as compute minutes. See Compute minutes for how that is measured and what each plan includes.
Related articles
Computers
Pair your own machine or launch a cloud one, then let your AI run commands and work with files on it.
Cloud computers
Launch an on-demand cloud machine, understand what it costs per second, and hibernate it when you're done.
Chat settings and toggles
Customize each conversation from the composer: tool toggles, autonomy, compaction, and a spend limit.
Up next
Ask AI to create images from text descriptions, saved to your Drive automatically.
Was this helpful?