mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-09 08:08:32 +00:00
Migrate docs from MkDocs to Mintlify (#1423)
* add new mintlify docs * add favicon.svg * minor edits * add github stats
This commit is contained in:
53
docs/tools/codeinterpretertool.mdx
Normal file
53
docs/tools/codeinterpretertool.mdx
Normal file
@@ -0,0 +1,53 @@
|
||||
---
|
||||
title: Code Interpreter
|
||||
description: The `CodeInterpreterTool` is a powerful tool designed for executing Python 3 code within a secure, isolated environment.
|
||||
icon: code-simple
|
||||
---
|
||||
|
||||
# `CodeInterpreterTool`
|
||||
|
||||
## Description
|
||||
|
||||
This tool enables the Agent to execute Python 3 code that it has generated autonomously. The code is run in a secure, isolated environment, ensuring safety regardless of the content.
|
||||
|
||||
This functionality is particularly valuable as it allows the Agent to create code, execute it within the same ecosystem,
|
||||
obtain the results, and utilize that information to inform subsequent decisions and actions.
|
||||
|
||||
## Requirements
|
||||
|
||||
- Docker
|
||||
|
||||
## Installation
|
||||
|
||||
Install the `crewai_tools` package
|
||||
|
||||
```shell
|
||||
pip install 'crewai[tools]'
|
||||
```
|
||||
|
||||
## Example
|
||||
|
||||
Remember that when using this tool, the code must be generated by the Agent itself.
|
||||
The code must be a Python3 code. And it will take some time for the first time to run
|
||||
because it needs to build the Docker image.
|
||||
|
||||
```python Code
|
||||
from crewai import Agent
|
||||
from crewai_tools import CodeInterpreterTool
|
||||
|
||||
Agent(
|
||||
...
|
||||
tools=[CodeInterpreterTool()],
|
||||
)
|
||||
```
|
||||
|
||||
We also provide a simple way to use it directly from the Agent.
|
||||
|
||||
```python Code
|
||||
from crewai import Agent
|
||||
|
||||
agent = Agent(
|
||||
...
|
||||
allow_code_execution=True,
|
||||
)
|
||||
```
|
||||
Reference in New Issue
Block a user