DSAgent provides Docker images for easy deployment of both the CLI and API server.
-
Clone the repository:
git clone https://github.com/nmlemus/dsagent cd dsagent -
Set your API key:
export OPENAI_API_KEY=sk-your-key-here # Or for other providers: # export ANTHROPIC_API_KEY=sk-ant-... # export GOOGLE_API_KEY=...
-
Start the API server:
docker-compose up -d
-
Access the API:
- API docs: http://localhost:8000/docs
- Health check: http://localhost:8000/health
# Pull the image
docker pull nmlemus/dsagent:latest
# Run API server (PORT defaults to 8000)
docker run -d \
-p 8080:8080 \
-e PORT=8080 \
-e DSAGENT_DEFAULT_MODEL=gpt-4o \
-e OPENAI_API_KEY=sk-your-key \
-v $(pwd)/workspace:/workspace \
nmlemus/dsagent:latest
# Run interactive CLI
docker run -it \
-e OPENAI_API_KEY=sk-your-key \
-v $(pwd)/workspace:/workspace \
nmlemus/dsagent:latest \
dsagent chat
# One-shot task
docker run --rm \
-e OPENAI_API_KEY=sk-your-key \
-v $(pwd)/workspace:/workspace \
nmlemus/dsagent:latest \
dsagent run "Analyze this dataset" --data ./data.csvConfiguration matches the rest of DSAgent: use DSAGENT_* and provider API keys. The default container command runs the API server and listens on PORT (default 8000).
| Variable | Description | Default |
|---|---|---|
DSAGENT_DEFAULT_MODEL |
Default LLM model | gpt-4o |
LLM_MODEL |
Legacy default model | - |
OPENAI_API_KEY |
OpenAI API key | - |
ANTHROPIC_API_KEY |
Anthropic API key | - |
GOOGLE_API_KEY |
Google API key | - |
GROQ_API_KEY |
Groq API key | - |
DEEPSEEK_API_KEY |
DeepSeek API key | - |
LLM_API_BASE |
Custom API endpoint | - |
OLLAMA_API_BASE |
Ollama API endpoint | http://host.docker.internal:11434 |
| Variable | Description | Default |
|---|---|---|
DSAGENT_MAX_ROUNDS |
Maximum agent iterations | 30 |
DSAGENT_TEMPERATURE |
LLM temperature | 0.3 |
DSAGENT_MAX_TOKENS |
Max tokens per response | 4096 |
DSAGENT_CODE_TIMEOUT |
Code execution timeout (seconds) | 300 |
| Variable | Description | Default |
|---|---|---|
PORT |
Port the server listens on | 8000 |
DSAGENT_API_KEY |
API key (enables auth when set) | - (disabled) |
DSAGENT_CORS_ORIGINS |
CORS allowed origins | * |
DSAGENT_REQUIRE_API_KEY |
Refuse start without API key | false |
DSAGENT_MAX_UPLOAD_MB |
Max upload per file (MB); 0 = no limit |
50 |
| Variable | Description |
|---|---|
BRAVE_API_KEY |
Brave Search API key |
FINANCIAL_DATASETS_API_KEY |
Financial Datasets API key |
Create a .env file in the same directory as docker-compose.yml:
# .env
# LLM Configuration
LLM_MODEL=gpt-4o
OPENAI_API_KEY=sk-your-openai-key
# Or for other providers:
# LLM_MODEL=claude-sonnet-4-5
# ANTHROPIC_API_KEY=sk-ant-your-key
# Agent Settings (optional)
DSAGENT_MAX_ROUNDS=30
DSAGENT_TEMPERATURE=0.3
# API Server (optional)
DSAGENT_API_KEY=my-secret-api-key
# MCP Tools (optional)
BRAVE_API_KEY=your-brave-keyThen start with docker-compose:
docker-compose up -dOr with docker run:
docker run -d -p 8000:8000 --env-file .env nmlemus/dsagent:latestNote: Only set the API key for your chosen provider.
| Path | Description |
|---|---|
/workspace |
Session data, notebooks, artifacts |
/home/dsagent/.dsagent |
User configuration |
# Start server with default settings
docker-compose up -d
# Start with specific model
LLM_MODEL=claude-sonnet-4-5 ANTHROPIC_API_KEY=sk-ant-... docker-compose up -d
# View logs
docker-compose logs -f dsagent
# Stop server
docker-compose down# Using docker-compose
docker-compose run --rm dsagent-cli
# Or directly with docker
docker run -it \
-e OPENAI_API_KEY=$OPENAI_API_KEY \
-v $(pwd)/workspace:/workspace \
nmlemus/dsagent:latest \
dsagent chatdocker run --rm \
-e OPENAI_API_KEY=$OPENAI_API_KEY \
-v $(pwd)/workspace:/workspace \
-v $(pwd)/data.csv:/workspace/data.csv \
nmlemus/dsagent:latest \
dsagent run "Analyze this dataset" --data /workspace/data.csvLaTeX is available in the :full variant of the Docker image for generating PDF reports and presentations.
| Tag | Size | LaTeX | Use Case |
|---|---|---|---|
dsagent:latest |
~1GB | No | Standard data science tasks |
dsagent:full |
~1.5GB | Yes | When you need PDF report generation |
# Build without LaTeX (default)
docker build -t dsagent:latest .
# Build with LaTeX
docker build -t dsagent:full --build-arg INSTALL_LATEX=true .Available LaTeX tools (:full only): pdflatex, xelatex, latexmk
Ask the agent to create a report:
Create a PDF report summarizing the analysis with charts
The agent can:
- Create a
.texfile with your analysis results - Include generated charts from
artifacts/ - Compile to PDF using
!pdflatex report.tex
# Inside the container
docker exec -it dsagent /bin/bash
# Compile LaTeX
cd /workspace/artifacts
pdflatex report.texNote: LaTeX adds ~500MB to the image size. It's only available in the Docker image, not in pip installations.
# Build the image
docker build -t dsagent:local .
# Run with local build
docker run -it \
-e OPENAI_API_KEY=$OPENAI_API_KEY \
dsagent:local \
dsagent chatThe docker-compose.yml includes two services:
- dsagent (default): API server on port 8000
- dsagent-cli (profile: cli): Interactive CLI
# Start API server only
docker-compose up -d
# Start CLI session
docker-compose --profile cli run --rm dsagent-cli- The container runs as a non-root user (
dsagent) - API key authentication is optional but recommended for production
- Use
DSAGENT_API_KEYto enable API authentication - Restrict
DSAGENT_CORS_ORIGINSin production
Check logs:
docker-compose logs dsagentEnsure the environment variable is passed correctly:
docker run -e OPENAI_API_KEY="$OPENAI_API_KEY" ...The container user needs write access:
chmod 777 ./workspace
# Or run as root (not recommended):
docker run --user root ...