Skip to main content
The Bearly Code Interpreter tool lets an agent run code in a sandboxed cloud environment.

Overview

The Bearly Code Interpreter tool is a tool that allows you to execute various programming languages using the AI Agents.
pip install langchain-community
export BEARLY_API_KEY="${BEARLY_API_KEY:?Set BEARLY_API_KEY in your shell}"
from praisonaiagents import Agent, AgentTeam
from langchain_community.tools import BearlyInterpreterTool

coder_agent = Agent(instructions="""for i in range(0,10):
                                        print(f'The number is {i}')""", tools=[BearlyInterpreterTool])

agents = AgentTeam(agents=[coder_agent])
agents.start()

How It Works

Getting Started

1

Simple Usage

  1. Install dependencies (see Overview above)
  2. Set required API keys in your environment
  3. Run the agent example in Overview
2

With Configuration

Use the same tool with an agent — see the Overview example, or pass env vars from the sections above.

Best Practices

Set BEARLY_API_KEY in your shell or .env. The tool reads it automatically — never hard-code the key.
Bearly runs code in an isolated cloud sandbox, so agent-generated code cannot touch your machine. Prefer it over local execution for untrusted input.
Each run is stateless. Include all imports and inputs in the snippet you pass so it executes without external state.

Python

Run Python code

Azure Code Interpreter

Azure sessions runtime

Jina Code Interpreter

Riza Python execution