Skip to content

API Reference parrot_tools.codeinterpreter.internals

github-actions[bot] edited this page Dec 2, 2026 · 4 revisions

parrot_tools.codeinterpreter.internals

View source

Internal tools for the CodeInterpreterTool agent. These tools provide the agent with capabilities for static analysis, code execution, and file operations.

Class ClassInfo

Information about a class

Parameter Type Default Description
name str
lineno int
bases List[str]
methods List[str]
docstring Optional[str]
decorators List[str]

Fields:

Field Type Default Description
name str
lineno int
bases List[str]
methods List[str]
docstring Optional[str]
decorators List[str]

Class FileOperationsTool

Tool for file operations (reading, writing, organizing outputs).

Parameter Type Default Description
base_output_dir Path Base directory for saving outputs

Method FileOperationsTool.save_file

Save content to a file.

save_file(content: str, filename: str, subdirectory: Optional[str] = None) -> Dict[str, Any]

Parameter Type Default Description
content str Content to save
filename str Name of the file
subdirectory Optional[str] None Optional subdirectory within base_output_dir

Returns: Dict[str, Any] — Dictionary with file path and success status

Method FileOperationsTool.read_file

Read content from a file.

read_file(file_path: str) -> Dict[str, Any]

Parameter Type Default Description
file_path str Path to the file

Returns: Dict[str, Any] — Dictionary with file content and metadata

Method FileOperationsTool.save_multiple

Save multiple files.

save_multiple(files: Dict[str, str], subdirectory: Optional[str] = None) -> Dict[str, Any]

Parameter Type Default Description
files Dict[str, str] Dictionary of filename -> content
subdirectory Optional[str] None Optional subdirectory within base_output_dir

Returns: Dict[str, Any] — Dictionary with results for each file

Class FunctionInfo

Information about a function

Parameter Type Default Description
name str
lineno int
args List[str]
returns Optional[str]
docstring Optional[str]
decorators List[str]
is_async bool

Fields:

Field Type Default Description
name str
lineno int
args List[str]
returns Optional[str]
docstring Optional[str]
decorators List[str]
is_async bool

Class ImportInfo

Information about an import

Parameter Type Default Description
module str
names List[str]
is_from_import bool

Fields:

Field Type Default Description
module str
names List[str]
is_from_import bool

Class PythonExecutionTool

Tool for executing Python code in isolated environment. This wraps the IsolatedExecutor for use by the agent.

Parameter Type Default Description
executor IsolatedExecutor or SubprocessExecutor instance

Method PythonExecutionTool.execute

Execute Python code and return results.

execute(code: str, description: str = 'Execute Python code') -> Dict[str, Any]

Parameter Type Default Description
code str Python code to execute
description str 'Execute Python code' Description of what's being executed

Returns: Dict[str, Any] — Dictionary with execution results

Method PythonExecutionTool.execute_tests

Execute pytest tests.

execute_tests(test_code: str, source_code: Optional[str] = None) -> Dict[str, Any]

Parameter Type Default Description
test_code str Test code using pytest
source_code Optional[str] None Optional source code being tested

Returns: Dict[str, Any] — Dictionary with test execution results

Class StaticAnalysisTool

Tool for performing static analysis on Python code. Uses AST parsing and radon for complexity metrics.

Method StaticAnalysisTool.analyze_code_structure

Analyze code structure using AST.

analyze_code_structure(code: str) -> Dict[str, Any]

Parameter Type Default Description
code str Python source code

Returns: Dict[str, Any] — Dictionary with functions, classes, imports, and basic metrics

Method StaticAnalysisTool.calculate_complexity

Calculate code complexity metrics using radon.

calculate_complexity(code: str) -> Dict[str, Any]

Parameter Type Default Description
code str Python source code

Returns: Dict[str, Any] — Dictionary with complexity metrics

Function calculate_code_hash

Calculate SHA-256 hash of code.

calculate_code_hash(code: str) -> str

Parameter Type Default Description
code str Source code

Returns: str — Hexadecimal hash string

Architecture

Clients

Bots & Agents

Memory

Knowledge

Tools & Toolkits

Flows

Experts

Skills

Stores & Loaders

MCP & A2A

Server & APIs

Integrations

Outputs & A2UI

Prompts

Security

Operations

Migration

SDD Tooling

LLM Wiki

Deployment

Decisions

API Reference

Clone this wiki locally