Files

104 lines
3.3 KiB
Markdown
Raw Permalink Normal View History

2026-07-05 22:18:00 +02:00
# Agent Platform
Eine schlanke, business-taugliche Agent-Plattform mit LiteLLM, Pydantic AI und MCP.
## Architektur
```
┌─────────────────────────────────────────────┐
│ agent-platform (Port 8000) │
│ - FastAPI + LiteLLM + Pydantic AI │
│ - HTMX-UI (kein JS-Build) │
│ - SQLite │
│ - Audit-Log, Auth │
└──────────────────┬──────────────────────────┘
│ MCP (HTTP)
┌─────────────────────────────────────────────┐
│ mcp-tools (Port 8501, intern) │
│ - fastmcp │
│ - 6 generische Tools │
└─────────────────────────────────────────────┘
```
## Quickstart
```bash
# 1. Env-Datei anlegen
cp .env.example .env
# .env editieren: LLM_API_KEY und AUTH_TOKEN setzen
# 2. Starten
docker compose up -d --build
# 3. UI öffnen
http://localhost:8000
# 4. Ersten Agent anlegen
# Im UI: Agents → "Neuen Agent erstellen"
# System-Prompt: "Du bist ein hilfreicher Assistent."
# Erlaubte Tools: "echo, calculate, get_time"
```
## API
```bash
# Health
curl http://localhost:8000/health
# Agents
curl -H "Authorization: Bearer $AUTH_TOKEN" http://localhost:8000/api/agents
# Chat
curl -X POST -H "Authorization: Bearer $AUTH_TOKEN" \
-H "Content-Type: application/json" \
-d '{"message": "Hallo!"}' \
http://localhost:8000/api/chat/general_assistant
# MCP-Tools
curl http://localhost:8000/api/tools
```
## Verfügbare MCP-Tools
- `echo(text)` - Echo-Tool
- `get_time(timezone_name)` - Aktuelle Zeit
- `calculate(expression)` - Mathe-Ausdruck (sicher)
- `http_get(url)` - HTTP-Request (SSRF-Schutz)
- `list_env(prefix)` - Umgebungsvariablen
- `json_format(data)` - JSON formatieren
## Konfiguration
Alle Env-Vars sind in `.env.example` dokumentiert.
## Entwicklung
```bash
# Backend lokal starten (ohne Docker)
cd agent_platform
pip install -e .
LLM_API_KEY=sk-xxx uvicorn api:app --reload
# MCP-Server lokal
cd mcp_tools
pip install -r requirements.txt
python server.py
```
## Ressourcen
- agent-platform: 256 MB RAM, 0.5 CPU
- mcp-tools: 128 MB RAM, 0.25 CPU
- SQLite: 5-10 MB
## Deploy (Coolify)
1. In Coolify: **Projects → New Project** → name it (e.g. `agent-platform`).
2. Inside the project: **Resources → New → Docker Compose**.
3. **Repository URL**: `https://forgejo.media-on.de/Leopoldadmin/agent-platform.git`, **Branch**: `main`.
4. **Domain**: bind a hostname to the `agent-platform` service (Traefik routes via the `expose: 8000` label).
5. **Environment Variables**: set `AUTH_TOKEN` (≥32 chars, NOT `change-me-in-production`) and `LLM_API_KEY`; other vars can keep their `.env.example` defaults.
6. Click **Deploy** — Coolify builds the two images, creates the `agent-data` volume, and brings up the stack.
7. **Health check**: `curl https://<your-domain>/health` returns `{"status":"ok"}` once `mcp-tools` is healthy and `agent-platform` is up.