Skip to content

sageil/crewai-docker-image

Repository files navigation

CrewAI Agents Docker Image

Motivation

This Docker image provides a convenient & secure way to create and run CrewAI agents without having to install any dependencies locally. I created the image to experiment with ollama code generation and execution.

Prerequisites

  • Docker
  • Basic knowledge of python
  • Basic knowledge of crewAI and langchain
  • Ollama installed locally or access to remote AI services like chatGPT
  • Desire to learn and have fun

Usage

Method 1: using a ollama locally

  1. Run the following command after replacing container-name with the name of your container, project-name with the name of your project and tag with the tag of the image you want to use.
docker run -it --network host --name <container-name> -e P=<project-name> sageil/crewai:<tag> bash

Tip

if you leave out the P completely -e P=<project_name> from the command, a default crew will be created with the name default_crew.

  1. Once the container starts, from your container shell, navigate to your project directory/src/crew.py and import Ollama by adding from langchain_community.llms import Ollama
  2. Configure your crew to use your local llm by adding
 myllm = Ollama(model="openhermes:v2.5", base_url="http://host.docker.internal:11434", temperature=0)
  1. Change the model and the temperature in the above snippet to your desired llm model
  2. Add the llm property to your agents by adding llm=myllm
    @agent
    def researcher(self) -> Agent:
        return Agent(
            config=self.agents_config['researcher'],
            # tools=[MyCustomTool()], # Example of custom tool, loaded on the beginning of file
            verbose=True, # Print out all actions
            llm=myllm
        )
  1. Run your crew by executing crewai run

Method 2: using remote services like chatGPT

  1. Set your OPENAI API key os.environ["OPENAI_API_KEY"] = "YOUR_KEY"
  2. Set your chatGPT model os.environ["CHATGPT_MODEL"] = "YOUR_MODEL
  3. Add the llm property to your agents by adding llm=ChatOpenAI()
  4. Run your crew by executing crewai run

Tip

When working with remote services, you can also remove the --network host part of the command as its only required to allow the container access to the host's network.

Tools

  • neoVim Latest stable version built from source neovim
  • uv Dependency management tool for Python projects uv
  • lazyVim A highly optimized Vim-like editor for Neovim lazyvim
  • crewAI Platform for Multi AI Agents Systems official CrewAI documentation

Versions

Available Versions

  • crewAI 0.98.0 crewai-tools 0.32.1
  • crewAI 0.95.0 crewai-tools 0.25.8
  • crewAI 0.85.0 crewai-tools 0.17.9
  • crewAI 0.85.0 crewai-tools 0.17.0
  • crewAI 0.83.0 crewai-tools 0.14.0
  • crewAI 0.80.0 crewai-tools 0.14.0
  • crewAI 0.79.4 crewai-tools 0.14.0
  • crewAI 0.76.9 crewai-tools 0.13.4
  • crewAI 0.76.2 crewai-tools 0.13.2
  • crewAI 0.74.1 crewai-tools 0.13.2
  • crewAI 0.70.1 crewai-tools 0.12.1
  • crewAI 0.65.2 crewai-tools 0.12.1
  • crewAI 0.64.0 crewai-tools 0.12.1
  • crewAI 0.61.0 crewai-tools 0.12.1
  • crewAI 0.55.2 crewai-tools 0.8.3
  • crewAI 0.51.0 crewai-tools 0.8.3
  • crewAI 0.41.1 crewai-tools 0.4.26
  • crewAI 0.36.0 && crewai-tools 0.4.26

Tips

  • v: alias v='nvim & alias vim='nvim'
  • Running newcrew <project_name> will create a new crew project with the provided name, install dependencies and configure the project virtual environment.
  • You can restart a container after stopping it by using docker container start -ai <container-name>

Example

Veterinary Assistant Crew

ScreenCaptures

Editor Code

Issues

Known issues:

  1. Copying from nvim fails due to display driver
  2. Icon fonts are not rendered correctly in the container's terminal? Watch. if the video peaked your interest in Wezterm, you can use my configuration from Wezterm configs

New Issues:

Please report other issues you encounter on the Issues including steps to reproduce them.

License

This project is licensed under the MIT License.

About

crewAI docker image

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published