StackAI Computer

StackAI Computer is a built-in tool provider that gives your AI workflows direct access to isolated sandbox environments. It bridges the gap between language model reasoning and real-world computation by enabling your agents to run shell commands, execute scripts, navigate the web, and produce files.

StackAI Computer surfaces two distinct execution environments, each designed for a different class of task:

  • Code Interpreter (terminal sandbox): A Linux environment with a pre-installed suite of data-processing libraries.

  • Desktop (browser sandbox): A full desktop environment running a real browser, controlled by an AI agent.

The two sandbox types are fully isolated from each other and never share state.

Available Actions

1. Terminal Tool

The Terminal tool allows you to execute shell commands in a secure and isolated sandbox environment. You can use it to install packages, process files, run scripts, and create output files that downstream nodes can use.

Terminal works the best when it is used as a tool within the AI Agent node, so that the large language models can run commands automatically.

Inputs

Name
Descriptions
Required

Command

The shell command to execute. Supports bash, Python one-liners, piped commands, and multi-step chains with &&.

Yes

Description

A short (2–5 word) label describing the intent of this command. Shown in the UI during execution (e.g., "Parsing CSV data").

No

Terminal Sandbox ID

When left blank, each new session will have a randomly generated ID. You can also pass in the ID of an existing sandbox session to reuse the environment.

No

Enable New Files

Enable New Files is enabled by default.

When enabled, new files created during execution can be downloaded and accessed by downstream nodes.

No

Outputs

Parameter
Type
Description

stdout

string

Standard output from the command.

stderr

string

Standard error output from the command.

exit_code

integer

The exit code returned by the command. 0 indicates success; any non-zero value indicates failure.

success

boolean

true if exit_code is 0.

terminal_sandbox_id

string

The ID of the sandbox session used for this execution.

new_files

array

List of files created during execution. Each entry includes name, path, size_bytes, and a download_url (a signed URL ready for immediate use).

image_data

array

Base64-encoded image data for any image files created during execution, enabling direct visual analysis by the AI.

Session Persistence

The terminal_sandbox_id lets you chain multiple Terminal nodes together within the same isolated environment. This is useful when you need to:

  • Install a package in one step and use it in the next

  • Build up data or files incrementally across multiple commands

  • Share intermediate results between nodes without writing to external storage

Working with Files

Workflow Files

Workflow files (e.g. files uploaded through the Files node) are available at /home/user/ at the start of each session.

Since the Terminal tool runs in a sandbox, it will not have access to local files on the computer.

Output Files

When Enable New Files is enabled, files created during the session will be automatically saved to /home/user/ . The signed download URLs of these files are returned in the output parameter new_files.

Knowledge Base Files

Terminal Tool can access files in the knowledge base. When an AI Agent node has both Terminal Tool and Knowledge Base, you will see an option to enable File Access for the Terminal Tool.

While Search KB Tool is best as finding relevant content semantically, the Terminal tool is better for processing and transforming the files. The Terminal tool lets you:

  • Work with the original file: parse a spreadsheet, extract specific pages from a PDF, run OCR on an image, etc.

  • Run actions beyond searching: aggregate across an entire file, run computations, reformat data, extract structured output (JSON, CSV) from unstructured documents

  • Handle file formats that don't chunk well: large Excel files, ZIP archives, binary formats, multi-sheet workbooks

  • Chain processing steps: download a file, transform it, and write the result back to /home/user/ so downstream nodes get the processed version

2. Canvas

Canvas is a built-in document workspace that lives alongside your chat. When an agent creates a file, like a report, a draft, or a structured document, it automatically appears in Canvas on the right side of the chat interface so you can read, edit, and download it without leaving the conversation.

Enabling Canvas

To use Canvas in your workflow, you need to add two tools to your AI Agent node:

  1. Terminal: allows the AI to run code in a secure sandbox environment

  2. Canvas Share File: allows the AI to send files generated in the sandbox to the Canvas panel

Once both tools are added to the AI Agent node, the AI can create and share files directly to Canvas during a conversation. You don't need to explicitly instruct the model to use these tools, it automatically detects their presence and will use them whenever you ask it to generate a document.

Chat Interface Setup

Canvas requires restricting access to the chat interface by email or group. This is configured in the Security section of the interface settings — specifically under the Enable SSO Protection toggle. You do not need SSO set up at the organization level; the toggle simply unlocks access control for the interface.

To enable it, open your workflow and navigate to the Interface tab. Scroll down to the Security section and toggle Enable SSO Protection on. An access control dialog will appear — use the Select users and groups dropdown to add the individuals or groups who should have access. Your own email is included by default. Remember to save and publish the interface after making any changes.

Canvas works best with capable frontier models that can reliably generate well-structured documents. We recommend using models from the GPT-5 family (OpenAI) or the Claude 4.6 family (Anthropic), as these models produce high-quality output and handle document formatting consistently.

Opening a File

When the agent generates a file, it automatically opens in the Canvas on the right side of the page. A file card with the filename and a short description also appears in the chat. If needed, you can click it to reopen the file in the Canvas.

The panel opens automatically the first time a file is created in a conversation.

Editing Documents

Canvas supports live editing for Markdown files. Click anywhere in the document to start typing. The editor supports:

  • Headings (H1, H2, H3)

  • Ordered and unordered lists

  • Tables

  • Code blocks

  • Blockquotes

  • Links and images

Changes are saved automatically after a short pause. The save status icon in the top-right corner of the panel shows whether your changes are synced:

Icon
Meaning

Spinning loader

Saving in progress

Dashed circle

Unsaved changes

Warning triangle

Sync error

Hidden

All changes saved

Version History

Canvas records a new version once per conversation turn. If the model updates a file, that creates a version.

If you then edit that file, another version is created. However, if you continue editing within the same turn, your changes overwrite the previous edit rather than creating additional versions. To browse the history:

  1. Click the history icon in the Canvas toolbar

  2. A dropdown shows each version with its timestamp and authorship (Human or AI)

  3. Click any version to preview it in read-only mode

  4. Click Back to latest to return to the current version

Annotating and Asking the Model to Apply Edits

Canvas supports a collaborative editing loop between you and the LLM. Instead of describing every change in the chat, you can annotate the document directly and then ask the model to act on your notes.

To use this workflow:

  1. Open the document in Canvas and click anywhere to start editing

  2. Leave your comments, corrections, or instructions inline — for example, rewrite this section, add a table here, or make this more concise

  3. Go back to the chat and ask the model to go over your edits, for example: "I've left some notes in the document — can you go through them and apply the changes?"

  4. The model will read the current state of the document, process your annotations, and update the file in Canvas with a new version

This is useful when you want to guide the output without rewriting things yourself — you annotate, the model finishes.

circle-info

You can mix inline edits with chat instructions. For example, fix a paragraph directly yourself and leave a note for the model on another section — the model will only act on what you explicitly ask it to.

Downloading Files

Click the Download button to save the current file to your computer. The button is disabled while there are unsaved changes, wait for the save indicator to clear before downloading.

You can also download a specific historical version by navigating to it first and then downloading.

Supported File Types

Type
View
Edit

Markdown (.md)

Yes

Yes

HTML (.html)

Yes

No

File Scope

Files in Canvas are scoped to a specific conversation and are only accessible to the user who created them. Each conversation has its own isolated workspace, so files from one chat won't appear in another.

Downloading in Other Formats

The Download button currently exports files in their original format only (.md or .html). If you need the document in a different format, such as PDF, DOCX, Excel, or others, ask the AI directly in the chat. For example:

  • "Can you export this as a PDF?"

  • "Convert this document to a Word file."

  • "Save this as an Excel spreadsheet."

The AI will generate the file in the requested format and share it to Canvas for download.

Version History

Canvas records a new version once per conversation turn. If the model updates a file, that creates a version.

If you then edit that file, another version is created. However, if you continue editing within the same turn, your changes overwrite the previous edit rather than creating additional versions. To browse the history:

  1. Click the history icon in the Canvas toolbar

  2. A dropdown shows each version with its timestamp and authorship (Human or AI)

  3. Click any version to preview it in read-only mode

  4. Click Back to latest to return to the current version

Content Writer Template

This documentation page covers the core setup and usage of Canvas. For a more complete, end-to-end example, explore the Content Writer agent template available in Stack AI.

The Content Writer template is a pre-built AI agent configured with a structured system prompt designed to produce well-formatted reports and written documents. It demonstrates best practices for using Canvas in a real workflow:

  • How to craft a system prompt that instructs the AI to always output results as a Canvas file

  • How to structure the agent so it consistently produces clean, well-organized Markdown documents

  • How to combine the Terminal and Canvas Share File tools to automate document generation end-to-end

To try it, open the Templates section in Stack AI and search for "Content Writer". You can use it as-is or customize the system prompt to match your own use case.

Last updated

Was this helpful?