Code interpreter

Execute basic python functions leveraging natural language

What is Code Interpreter?

The Code Interpreter lets agents execute Python code for data analysis, calculations, visualizations, and complex queries. This tool is essential for agents that need to process data, perform computations, or generate charts and graphs.

Code Interpreter usage

from seekrai import SeekrFlow
from seekrai.types import CreateAgentRequest, RunPython, RunPythonEnv

client = SeekrFlow()

# Create an agent with Code interpreter tool

agent = client.agents.create(
    CreateAgentRequest(
        name="DataAnalystBot",
        instructions="You are an expert data analyst. Use Python to analyze data, create visualizations, and perform calculations. Always explain your code and findings.",
        model_id="meta-llama/Llama-3.1-8B-Instruct",
        tools=[RunPython(
            tool_env=RunPythonEnv(
                run_python_tool_desc="Execute Python code for data analysis, calculations, and complex queries."
            )
        )],
    )
)

Code Interpreter