Dieses Dokument hilft Claude Code, schneller und effektiver mit diesem Projekt zu arbeiten.
ProcessCube Robot Agent ist ein Python-basierter Agent-Service, der BPMN-Workflows (ProcessCube Engine) mit RPA-Automatisierungen verbindet. Das Projekt unterstützt zwei verschiedene Robot-Typen:
- RCC Robots: Basieren auf Robot Framework, optimal für UI/Web-Automation (über Robocorp RCC CLI)
- UV Robots: Reine Python-Skripte, optimal für API-Integration und Datenverarbeitung (über UV Package Manager)
ProcessCube Engine (BPMN)
↓ External Tasks
FastAPI REST Server (Port 42042)
├─ External Task Handler
├─ MultiRunnerFactoryCreator
│ ├─ RCC Robot Factory → RCC Robot Agent
│ └─ UV Robot Factory → UV Robot Agent
└─ Project Watcher (optional)
- Dual-Engine Ansatz: Zwei separate Robot-Typen (RCC und UV) für unterschiedliche Anwendungsfälle
- Factory Pattern: Automatische Erkennung und Instanziierung von Robots aus ZIP-Packages
- Topic-basiertes Routing: Robots werden über Topics (z.B. "rcc.windows.ui" oder "uv.api-processor") angesprochen
- Work Items: JSON-basierter Payload-Austausch zwischen Engine und Robots
- Hot Reload: Optional automatisches Neu-Packen und Re-Registrieren bei Dateiänderungen
| Modul | Zweck | Wichtige Dateien |
|---|---|---|
processcube_robot_agent/ |
Hauptpaket | __main__.py (CLI Entry Point) |
robot_agent/ |
Core Robot Execution | base_agent.py, builder.py |
robot_agent/rcc/ |
RCC Robot Implementation | robot_agent.py, rcc_runner.py |
robot_agent/uv/ |
UV Robot Implementation | robot_agent.py, uv_runner.py |
external_task/ |
ProcessCube Integration | robot_task_handler.py |
rest_api/ |
HTTP API Endpoints | robots.py, health.py |
tools/ |
Utilities | robot_runner.py, work_items.py |
processcube-robot-agent/
├── processcube_robot_agent/ # Hauptpaket
│ ├── __main__.py # CLI Entry Point (Typer)
│ ├── commands/ # CLI Commands
│ │ ├── pack_robots_command.py
│ │ ├── serve_command.py
│ │ └── watch_robots_command.py
│ ├── robot_agent/ # Robot Agents
│ │ ├── base_agent.py # Abstract Base
│ │ ├── rcc/ # RCC Implementation
│ │ └── uv/ # UV Implementation
│ ├── external_task/ # ProcessCube Bridge
│ ├── rest_api/ # FastAPI Server
│ └── tools/ # Shared Utilities
├── robots/
│ ├── src/ # Source Robots (entwickelt hier)
│ │ ├── rcc/ # RCC Robot Sources
│ │ └── uv/ # UV Robot Sources
│ └── installed/ # Gepackte Robots (ZIP)
│ ├── rcc/ # RCC Robot ZIPs
│ └── uv/ # UV Robot ZIPs
├── tests/
│ ├── unit/ # Unit Tests
│ └── integration/ # Integration Tests
├── temp/ # Temporäre Dateien (unwrapped robots)
├── config.dev.json # Development Config
├── pyproject.toml # Python Package Config
└── architecture-diagram.excalidraw # Architektur-Diagramm
{
"debugging": {
"enabled": false,
"hostname": "0.0.0.0",
"port": 5678,
"wait_for_client": false
},
"engine": {
"url": "http://localhost:8000"
},
"rcc": {
"topic_prefix": "rcc",
"wrap_dir": "robots/installed/rcc",
"unwrap_dir": "temp/robots/rcc/unwrapped",
"start_watch_project_dir": true,
"project_dir": "robots/src/rcc"
},
"uv": {
"topic_prefix": "uv",
"wrap_dir": "robots/installed/uv",
"unwrap_dir": "temp/robots/uv/unwrapped",
"start_watch_project_dir": true,
"project_dir": "robots/src/uv"
},
"rest_api": {
"port": 42042,
"host": "0.0.0.0"
}
}# 1. Branch erstellen
git checkout -b feature/neue-feature
# 2. Tests schreiben (TDD)
# - Unit Tests in tests/unit/
# - Integration Tests in tests/integration/
# 3. Code implementieren
# 4. Tests ausführen
pytest
# 5. Code Coverage prüfen
pytest --cov=processcube_robot_agent --cov-report=html# 1. Robot in robots/src/rcc/ erstellen
mkdir -p robots/src/rcc/mein-robot
cd robots/src/rcc/mein-robot
# 2. robot.yaml und tasks.robot erstellen
# robot.yaml:
# tasks:
# Default:
# shell: python -m robot --outputdir ./output tasks.robot
# 3. Robot packen
python -m processcube_robot_agent pack
# 4. Startet automatisch mit Topic "rcc.mein-robot"# 1. Robot in robots/src/uv/ erstellen
mkdir -p robots/src/uv/mein-robot
cd robots/src/uv/mein-robot
# 2. pyproject.toml erstellen
# [project]
# name = "mein-robot"
# [project.scripts]
# robot_runner = "main:main"
# 3. main.py erstellen
# 4. Robot packen
python -m processcube_robot_agent pack
# 5. Startet automatisch mit Topic "uv.mein-robot"# Development Mode mit Hot Reload
CONFIG_FILE=config.dev.json python -m processcube_robot_agent serve
# Nur Robots packen
python -m processcube_robot_agent pack# Alle Tests
pytest
# Nur Unit Tests
pytest tests/unit/
# Nur Integration Tests
pytest tests/integration/
# Mit Coverage
pytest --cov=processcube_robot_agent --cov-report=term-missing
# Coverage HTML Report
pytest --cov=processcube_robot_agent --cov-report=html
open htmlcov/index.html# Mit Debugger starten (wartet auf VSCode)
# In config.dev.json: debugging.enabled = true, wait_for_client = true
CONFIG_FILE=config.dev.json python -m processcube_robot_agent serve
# Logs ansehen
# Logs werden auf stdout ausgegeben# Dependencies installieren
pip install -e .
# Development Dependencies
pip install -e ".[dev]"
# Neue Dependency hinzufügen
# → Bearbeite pyproject.toml [project.dependencies]
pip install -e .- Fokus: Einzelne Komponenten isoliert testen
- Mocking: Externe Dependencies werden gemockt
- Schnell: < 1 Sekunde pro Test
- Beispiele:
test_rcc_robot_agent.py: RCC Agent Logiktest_uv_robot_agent.py: UV Agent Logiktest_work_items.py: Work Items Handling
- Fokus: Komponenten-Interaktion und End-to-End Flows
- Mock Engine:
mock_engine.pysimuliert ProcessCube Engine - Langsamer: ~ 1-5 Sekunden pro Test
- Beispiele:
test_robot_execution_integration.py: Robot Execution Flowtest_external_task_integration.py: External Task Handlingtest_rest_api_integration.py: REST API Endpoints
- Minimum: 60% (requirement für CI/CD)
- Aktuell: ~85%
- Fokus: Kritische Pfade und Error Handling
- PEP 8 konform
- Black für Code Formatting (falls konfiguriert)
- Type Hints wo sinnvoll
- Klassen:
PascalCase(z.B.RobotAgent,MultiRunnerFactoryCreator) - Funktionen/Methoden:
snake_case(z.B.execute_robot,create_work_items) - Konstanten:
UPPER_SNAKE_CASE(z.B.DEFAULT_PORT) - Private: Prefix
_(z.B._internal_method)
- ProcessCube SDK benötigt
asyncio - FastAPI ist async-native
- nest-asyncio wird verwendet für Kompatibilität
# Verwende RobotError für Robot-spezifische Fehler
from processcube_robot_agent.robot_agent.error import RobotError, RobotErrorCode
try:
# Robot Logik
pass
except Exception as e:
raise RobotError(
code=RobotErrorCode.EXECUTION_FAILED,
message="Robot execution failed",
details={"error": str(e)}
)- processcube-sdk (6.0.2a1): ProcessCube Integration
- FastAPI (0.121+): REST API
- uvicorn (0.23+): ASGI Server
- typer (0.9+): CLI Framework
- watchdog (6.0+): File System Monitoring
- Robot Framework (7.x): RPA Framework (für RCC)
- RCC: Robocorp CLI Tool (muss separat installiert werden)
- UV: Python Package Manager (muss separat installiert werden)
- pytest: Testing Framework
- pytest-asyncio: Async Test Support
- pytest-cov: Coverage Reporting
- main: Produktions-Branch (stable)
- develop: Development-Branch (default)
- feature/: Feature Branches
- fix/: Bugfix Branches
# Conventional Commits Format
git commit -m "feat: Add UV robot factory implementation"
git commit -m "fix: Resolve work items parsing error"
git commit -m "test: Add integration tests for robot execution"
git commit -m "docs: Update architecture diagram"
git commit -m "refactor: Simplify robot agent builder"- Base:
develop(nichtmain!) - Title: Beschreibender Titel
- Description: Was wurde geändert und warum
- Tests: Alle Tests müssen grün sein
# Service starten (Dev Mode)
CONFIG_FILE=config.dev.json python -m processcube_robot_agent serve
# Robots packen
python -m processcube_robot_agent pack
# Tests ausführen
pytest
# Tests mit Coverage
pytest --cov=processcube_robot_agent --cov-report=html
# Git Status
git status
# Git Log (pretty)
git log --oneline --graph --all --decorate
# Branch wechseln
git checkout develop
git checkout -b feature/meine-feature
# Dependencies installieren
pip install -e .
pip install -e ".[dev]"# RCC muss separat installiert werden
# https://github.com/robocorp/rcc
# macOS/Linux:
curl -o rcc https://downloads.robocorp.com/rcc/releases/latest/macos64/rcc
chmod +x rcc
sudo mv rcc /usr/local/bin/
# Windows:
# Download von https://downloads.robocorp.com/rcc/releases/latest/windows64/rcc.exe# UV muss separat installiert werden
# https://github.com/astral-sh/uv
# macOS/Linux:
curl -LsSf https://astral.sh/uv/install.sh | sh
# Windows:
# powershell -c "irm https://astral.sh/uv/install.ps1 | iex"# Ändere Port in config.dev.json
# "rest_api": { "port": 42043 }# Prüfe Engine URL in config.dev.json
# "engine": { "url": "http://localhost:8000" }
# Prüfe Engine Status
curl http://localhost:8000/health# Liste aller Robots
GET http://localhost:42042/robot_agents/robots
# Health Check
GET http://localhost:42042/health
# Metrics
GET http://localhost:42042/metrics- Zuerst Tests lesen: Verstehe die erwartete Funktionalität
- Test schreiben: Reproduziere den Bug in einem Test
- Fix implementieren: Ändere den Code minimal
- Tests ausführen: Stelle sicher, dass alle Tests grün sind
- Architektur verstehen: Siehe architecture-diagram.excalidraw
- Factory Pattern beachten: Neue Robot-Typen über Factories implementieren
- Tests zuerst: TDD Ansatz bevorzugen
- Dokumentation aktualisieren: README.md, CHANGELOG.md, diese Datei
- Tests beibehalten: Ändern nur wenn nötig
- Kleine Schritte: Ein Refactoring pro Commit
- Backwards Compatibility: Wenn möglich beibehalten
- Code Smells: Keine unused Variables, unnötige Abstractions vermeiden
- Keep it simple: Over-Engineering vermeiden
- DRY: Don't Repeat Yourself - aber nicht zu früh abstrahieren
- YAGNI: You Aren't Gonna Need It - keine Features für "vielleicht später"
- Error Handling: Nur an Systemgrenzen validieren (User Input, External APIs)
- Type Hints: Verwenden wo sinnvoll, aber nicht zwingend überall
- ProcessCube: https://www.processcube.io/
- Robot Framework: https://robotframework.org/
- Robocorp RCC: https://github.com/robocorp/rcc
- UV: https://github.com/astral-sh/uv
- FastAPI: https://fastapi.tiangolo.com/
- Python: 3.11+
- processcube-sdk: 6.0.2a1
- Robot Framework: 7.x
- FastAPI: 0.121+
Letztes Update: 2025-12-02 Projekt Version: 0.1.2