mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-01-11 00:58:30 +00:00
Add execution_image parameter to Agent for custom Docker images
- Add execution_image field to Agent class for specifying custom Docker images - Modify get_code_execution_tools() to pass custom image to CodeInterpreterTool - Add comprehensive tests for the new functionality - Update documentation with usage examples - Fixes #2933: Allow customizing CrewAI code executor Docker image Co-Authored-By: João <joao@crewai.com>
This commit is contained in:
@@ -92,6 +92,22 @@ programmer_agent = Agent(
|
||||
)
|
||||
```
|
||||
|
||||
You can also specify a custom Docker image for code execution:
|
||||
|
||||
```python Code
|
||||
from crewai import Agent
|
||||
|
||||
# Create an agent with code execution enabled and custom Docker image
|
||||
programmer_agent = Agent(
|
||||
role="Python Programmer",
|
||||
goal="Write and execute Python code to solve problems",
|
||||
backstory="An expert Python programmer who can write efficient code to solve complex problems.",
|
||||
allow_code_execution=True, # This automatically adds the CodeInterpreterTool
|
||||
execution_image="python:3.11-slim", # Custom Docker image with specific Python version
|
||||
verbose=True,
|
||||
)
|
||||
```
|
||||
|
||||
### Enabling `unsafe_mode`
|
||||
|
||||
```python Code
|
||||
|
||||
Reference in New Issue
Block a user