Code Interpreter

Let your AI agent write and run code in real time

Customers ask complex questions that need computation, not canned replies. Your AI agent spins up a secure Python sandbox, executes scripts, and delivers calculated answers, charts, or files, all inside the conversation. Data analysis questions resolved on the spot.

Chosen by 800+ global brands across industries

Computational power inside every conversation

Your AI agent gains a full Python runtime and terminal. It creates sandboxes, runs scripts, processes uploads, and returns generated files, all within customer interactions.

Code Interpreter

Use Cases

When talk alone is not enough

Some customer questions demand real computation. These scenarios show how your AI agent turns raw data into actionable answers on the fly.

On-Demand Data Crunching for Customers

A client uploads a CSV of monthly transactions and asks for a spending breakdown by category. Your AI Agent creates a sandbox, uploads the file, writes a Python script using pandas to group and sum the data, then returns a formatted summary table. The client gets precise financial insights in seconds, without your team manually building a report.

Custom Chart Generation Mid-Conversation

A prospect asks to see projected growth based on their current metrics. Your AI Agent runs a Python script that calculates compound growth rates, generates a matplotlib bar chart, saves it as a PNG, and delivers the image directly in the chat. Visual proof of value delivered instantly, no analyst involvement required.

Automated Document Creation from Inputs

A customer provides specifications and needs a formatted quote document. Your AI Agent writes a script to populate a template with pricing calculations, exports it as a PDF, and retrieves the finished file from the sandbox. The customer walks away with a professional document, created in the time it takes to type a message.

Try
Code Interpreter

Code Interpreter

FAQs

Frequently Asked Questions

What programming languages can the AI agent execute in the sandbox?

The sandbox runs Python with full standard library support. Your agent can also use pip to install any public Python package during a session, including pandas, numpy, matplotlib, scikit-learn, and others. Terminal commands cover additional utilities available in the Linux-based sandbox environment.

How long does a sandbox session remain active during a conversation?

By default, sandboxes stay alive for 300 seconds (5 minutes) after creation or last execution. You can configure keep_alive up to 3600 seconds (1 hour) per session. Variables, files, and installed packages persist throughout the session, allowing multi-step computations across follow-up questions.

Is customer data processed in the sandbox stored permanently?

No. Sandboxes are ephemeral cloud environments. Once the session expires or is closed, all files, variables, and data inside the sandbox are destroyed. Nothing persists between conversations. Uploaded files exist only for the duration of that interaction.

Can the sandbox access the internet or external APIs?

The sandbox runs in an isolated environment. By default, it can install Python packages via pip, which requires network access. However, the execution is containerized and isolated from your production systems. The agent cannot access your internal databases or servers unless explicitly configured.

What happens if the Python script throws an error?

The agent receives stdout, stderr, and the error traceback from the sandbox. It can analyze the error, correct the script, and re-execute automatically. Customers see the corrected result, not the debugging process. You can also set execution timeouts to prevent runaway scripts.

How large can uploaded files be for sandbox processing?

Files are uploaded as base64-encoded payloads to the /home/user/ directory inside the sandbox. Practical limits depend on your Tars plan and the sandbox memory allocation. For typical business use cases like spreadsheets, CSVs, and text files, the sandbox handles them comfortably.

Can the agent generate and return files like PDFs or images?

Yes. The agent writes scripts that save output files to the sandbox filesystem, then uses the get_file endpoint to retrieve and deliver them. Common outputs include CSV exports, PNG/SVG charts, PDF reports, and formatted text files. The customer receives the file directly in the conversation.

How does this differ from asking the AI to just describe calculations?

Language models estimate and sometimes hallucinate numerical answers. Code Interpreter actually runs Python code, producing exact computed results. When your customer needs a precise sum, a statistical analysis, or a generated chart, the agent executes real arithmetic rather than guessing. Accuracy is guaranteed by the code, not the model.

How to add Tools to your AI Agent

Supercharge your AI Agent with Tool Integrations

Don't limit your AI Agent to basic conversations. Watch how to configure and add powerful tools making your agent smarter and more functional.

Privacy & Security

We’ll never let you lose sleep over privacy and security concerns

At Tars, we take privacy and security very seriously. We are compliant with GDPR, ISO, SOC 2, and HIPAA.

GDPR
ISO
SOC 2
HIPAA

Still scrolling? We both know you're interested.

Let's chat about AI Agents the old-fashioned way. Get a demo tailored to your requirements.

Schedule a Demo