"The XAMPP for Vertical AI Agents"
AgentStack bundles all the essential infrastructure for building Vertical AI Agents into a single docker compose up command, running locally for $0.
Building a Vertical AI Agent (e.g., "AI Dental Billing Clerk") traditionally requires:
- Database with vector search ($70/mo Pinecone)
- AI Gateway for model routing ($50/mo Portkey)
- Observability to debug traces ($100/mo Langfuse)
- Task Queue for async jobs ($30/mo AWS SQS)
- Document Parser for PDFs ($100/mo Unstructured.io)
Total SaaS Cost: $350+/month before writing agent code.
AgentStack provides all of this locally with open-source alternatives.
| Component | Technology | Purpose | Cost |
|---|---|---|---|
| AI Gateway | LiteLLM Proxy | Model routing, load balancing, cost tracking | $0 |
| Observability | Arize Phoenix | LLM tracing, latency analysis, prompt comparison | $0 |
| Database | PostgreSQL + pgvector | Relational + vector search (1536-dim embeddings) | $0 |
| REST API | pREST | Auto-generated REST API from database schema | $0 |
| Task Queue | Celery + Valkey | Async document processing, job status tracking | $0 |
| Document Parser | Docling (IBM) | PDF/HTML/DOCX β clean Markdown | $0 |
| Admin UI | Adminer | Database administration interface | $0 |
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β USER APPLICATION β
β (Next.js, React, Mobile App) β
βββββββββββββββββββββββββββ¬ββββββββββββββββββββββββββββββββββββ
β
ββββββββββΌβββββββββ
β LiteLLM β β AI Gateway (Port 4000)
β Gateway β
ββββββββββ¬βββββββββ
β Traces (OTLP)
ββββββββββΌβββββββββ
β Phoenix β β Observability (Port 6006)
β Dashboard β
ββββββββββ¬βββββββββ
β SQL
ββββββββββΌβββββββββ
β PostgreSQL β β Database (Port 5432)
β + pgvector β
ββββββββββ¬βββββββββ
β Read/Write
ββββββββββΌβββββββββ
β Celery β β Async Worker
β Tasks β
ββββββββββ¬βββββββββ
β Jobs
ββββββββββΌβββββββββ
β Valkey β β Message Broker (Port 6379)
β (Redis alt) β
βββββββββββββββββββ
- Docker & Docker Compose
- 2GB+ RAM, 5GB+ disk space
- OpenSSL (for SSL certificates)
# 1. Clone repository
git clone <repository-url>
cd agentstack-oss
# 2. Copy environment template
cp .env.example .env
# 3. Add your OpenAI API key (required)
nano .env
# Set: OPENAI_API_KEY=sk-your-openai-key-here
# 4. Start all services
docker compose up -d --build
# 5. Wait for initialization (2-5 minutes on first run)
docker compose logs -f worker| Service | URL | Expected Result |
|---|---|---|
| Phoenix | http://localhost:6006 | Dashboard loads, shows "Projects" |
| pREST API | http://localhost:3000/tables | JSON list of database tables |
| LiteLLM | http://localhost:4000/health | {"status": "healthy"} |
| Adminer | http://localhost:8080 | Login form (postgres/password) |
from celery import Celery
app = Celery(broker='redis://localhost:6379/0')
# Ingest PDF from URL
result = app.send_task(
'tasks.ingest_document',
args=['https://example.com/document.pdf'],
kwargs={'metadata': {'category': 'research'}}
)
# Wait for completion
document = result.get(timeout=120)
print(f"Document ID: {document['document_id']}")# Search knowledge base
result = app.send_task(
'tasks.semantic_search',
args=['What is machine learning?', 5, 0.7]
)
matches = result.get(timeout=30)
for doc in matches:
print(f"Match: {doc['filename']} (similarity: {doc['similarity']:.2f})")# Ask question with context from knowledge base
result = app.send_task(
'tasks.rag_query',
args=['Explain quantum computing'],
kwargs={'model': 'gpt-4o'}
)
response = result.get(timeout=60)
print(response['answer'])
print("Sources:", response['sources'])# Required
OPENAI_API_KEY=sk-your-key-here
# Optional
ANTHROPIC_API_KEY=sk-ant-your-key-here
DEFAULT_MODEL=gpt-4o
EMBEDDING_MODEL=text-embedding-3-small
# Database
POSTGRES_USER=postgres
POSTGRES_PASSWORD=password
POSTGRES_DB=agentstack
# Security
JWT_SECRET=change-in-productionEdit configs/litellm_config.yaml to add/remove models:
model_list:
- model_name: gpt-4o
litellm_params:
model: openai/gpt-4o
api_key: os.environ/OPENAI_API_KEY
- model_name: claude-3-5-sonnet
litellm_params:
model: anthropic/claude-3-5-sonnet-20241022
api_key: os.environ/ANTHROPIC_API_KEYknowledge_base: Documents + embeddingschat_sessions: Conversation memorychat_messages: Individual messages with tracingjob_status: Async task trackingprompt_templates: Reusable prompts
-- Search by semantic similarity
SELECT * FROM search_knowledge(
query_embedding => '[0.1,0.2,...]',
match_threshold => 0.7,
match_count => 5
);All LLM calls are automatically traced in Phoenix:
- Latency analysis per model
- Cost tracking per request
- Prompt comparison across versions
- Error debugging with full context
Access Phoenix at: http://localhost:6006
agentstack-oss/
βββ docker-compose.yml # Main orchestration
βββ .env.example # Environment template
βββ configs/
β βββ litellm_config.yaml # Model routing config
βββ init/
β βββ 01_extensions.sql # Database schema
βββ scripts/ # Utility scripts
βββ src/
βββ agentstack_worker/ # Celery worker code
- Define task in
src/agentstack_worker/tasks.py - Add tracing with Phoenix spans
- Update database schema if needed
- Test with
docker compose restart worker
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests for new functionality
- Submit a pull request
# Install dependencies
pip install -r requirements-dev.txt
# Run tests
pytest
# Lint code
ruff check .
mypy .Licensed under the Apache License 2.0. See LICENSE for details.
Built with open-source components:
- LiteLLM - AI Gateway
- Arize Phoenix - Observability
- pgvector - Vector search
- pREST - REST API
- Docling - Document parsing
- Celery - Task queue
Ready to build your Vertical AI Agent? Start with docker compose up and focus on your agent logic instead of infrastructure.