feat: agent platform initial commit
- FastAPI + HTMX UI: dashboard, agents CRUD, chat, audit, tools - SQLite schema: agents, conversations, messages, audit, sessions - Code-agent sync (agents/*.py -> DB on startup) - MCP client with health check - Token auth (Bearer + session) - LiteLLM integration via llm.py - Docker Compose: agent-platform + mcp-tools services - Smoke tests pass: /health 200, /api/agents 200, / 401
This commit is contained in:
@@ -0,0 +1,93 @@
|
||||
# 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
|
||||
Reference in New Issue
Block a user