> ## Documentation Index
> Fetch the complete documentation index at: https://docs.getcara.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Code Execution

> Run Python inside a workspace to compute, transform, and verify data

Some tasks — reconciling a schedule of locations, checking premium math on a proposal, reshaping an exported spreadsheet — are more reliably done in code than in natural language. Cara can execute Python inside a sandboxed environment attached to your workspace and use the result to continue the task.

<Tip>
  Code execution is always visible. Every run appears in the workspace's **Execution** tab with the exact code, inputs, stdout, stderr, and any files produced.
</Tip>

## When Cara uses it

Cara reaches for code execution whenever a task benefits from deterministic computation, including:

* **Tabular reshaping** — pivoting a schedule of locations, joining two spreadsheets, deduping rows, normalizing carrier names
* **Verification** — recomputing a premium sum, checking that TIV rolls up correctly, confirming that ACORD 125 totals match the underlying schedule
* **File conversions** — `.xlsx` → `.csv`, extracting specific sheets or columns, filtering by date
* **Small parsers** — pulling structured data out of an unusual PDF layout or a text dump

You can also ask directly: "Use code execution to..." or "Run Python to check that...". Cara will draft the code, execute it, and quote the result back to you.

## What it can access

The sandbox has read access to any file you've attached to the workspace and any artifact Cara has generated in that workspace. It does **not** have network access, and it does not have direct access to your integrations or knowledge base — Cara pulls that data via her regular tools first, then hands it to the sandbox.

Cara treats code-execution output as evidence, not as truth: she still narrates her reasoning in the **Messages** tab and cites the specific run when relevant.

## Reviewing a run

Open the **Execution** tab and click any code-execution step to expand it. You'll see:

* The Python source that ran
* The input files referenced
* `stdout` and `stderr`
* Any new files produced (they'll also show up in the **Artifacts** tab)

If a run failed, Cara automatically retries with a corrected version and keeps both attempts in the history.
