This project demonstrates how to create AI agents using Claude AI and Docker to generate synthetic data. It was developed as a learning exercise, following the tutorial by David Ondrej
This project consists of two main AI agents:
- Analyzer Agent: Analyzes the structure and patterns of a given CSV dataset.
- Generator Agent: Generates new CSV rows based on the analysis results and sample data.
The agents are containerized using Docker for easy deployment and scalability.
- Docker
- Python 3.12
- Anthropic API key
agents.py
: Main script containing the Analyzer and Generator agents.prompts.py
: Contains the system and user prompts for the AI agents.Dockerfile
: Instructions for building the Docker container.requirements.txt
: List of Python dependencies..env
: Configuration file for storing the Anthropic API key. [Not a part of this Github Repo].dockerignore
: Specifies files and directories to be excluded from the Docker build.
-
Create a
.env
file in the project root and add your Anthropic API key:ANTHROPIC_API_KEY=your_api_key_here
Build the Docker image using the following command:
docker build -t claude-docker-ai-agents .
To run the Docker container you can either provide the directory directly or create a docker volume to map to the image to your currect directory :
- Mapping to absolute path: [Replace
"path/to/your/data/directory"
with the actual path to your data directory.]
$path = "path/to/your/data/directory"
docker run -it `
--rm `
-v "${path}:/app/data" `
-e ANTHROPIC_API_KEY `
--name ai-agents-container `
claude-docker-ai-agents
- Mapping as a docker volume to current directory:
docker run -it `
--rm `
-v "${PWD}/data:/app/data" `
-e ANTHROPIC_API_KEY `
--name ai-agents-container `
claude-docker-ai-agents
- When prompted, enter your Anthropic API key.
- Enter the name of your CSV file (which should be placed in the data directory you specified).
- Specify the number of rows you want to generate.
- The script will analyze your data and generate new rows based on the patterns it identifies.
- The output will be saved in
/app/data/output.csv
.
If you want to publish your Docker image to Docker Hub:
-
Log in to Docker Hub:
docker login
-
Tag your image:
docker tag claude-docker-ai-agents your-dockerhub-username/claude-data-gen-agent:latest
-
Push the image to Docker Hub:
docker push your-dockerhub-username/claude-data-gen-agent:latest
To use the published Docker image:
-
Pull the image from Docker Hub:
docker pull your-dockerhub-username/claude-data-gen-agent:latest
-
Run the container:
$path = "path/to/your/data/directory" docker run -it ` --rm ` -v "${path}:/app/data" ` -e ANTHROPIC_API_KEY ` --name ai-agents-container ` your-dockerhub-username/claude-data-gen-agent
This project was created following the tutorial by David Ondrej.
MIT License