How scs-labrat/figaro works
Figaro orchestrates long-running desktop-agent tasks: users submit work through the dashboard or conversational gateway; the orchestrator assigns tasks over NATS to workers or supervisors, tracks results and durable state, and exposes live desktop views. Other documented capabilities include recurring schedules, help requests, self-healing/self-learning, external desktop connections, and Telegram. The graph combines README-described behavior with indexed references and excerpts; unsampled subsystems and some UI-to-service wiring are shown only where documented, or omitted where evidence is insufficient.
Main entry points: client.py NATS messaging · app.py Orchestrator app · Dashboard.tsx Dashboard · service.py NATS service
Components 23
User interfaces
- Dashboard
figaro-ui/src/components/Dashboard.tsx - Live UI state
figaro-ui/src/api/nats-broadcast-handler.ts - Telegram gateway
figaro-gateway/src/figaro_gateway/channels/telegram/bot.py - Gateway router
figaro-gateway/src/figaro_gateway/core/router.py - Schedule controls
figaro-ui/src/components/ScheduleFormModal.tsx - Desktop controls
figaro-ui/src/components/AddDesktopWorkerForm.tsx
Orchestration
- Orchestrator app
figaro/src/figaro/app.py - Task routing
figaro/src/figaro/services/nats/api_tasks.py - Task lifecycle
figaro/src/figaro/services/task_manager.py - Event handling
figaro/src/figaro/services/nats/event_handlers.py - Scheduled work
figaro/src/figaro/services/scheduler.py - Help requests
figaro/src/figaro/services/help_request.py
Agent runtime
- Worker agent
figaro-worker/src/worker/executor.ts - Supervisor agent
figaro-worker/src/supervisor/executor.ts - Agent entrypoint
figaro-worker/src/index.ts - Browser automation
patchright-cli/src/patchright_cli/server.py
Desktop access
- Remote desktop access
- Guacamole streaming
figaro/src/figaro/routes/guacamole.py
Messaging and state
- NATS service
figaro/src/figaro/services/nats/service.py - Task publishing
figaro/src/figaro/services/nats/publishing.py - NATS messaging
figaro-nats/src/figaro_nats/client.py - PostgreSQL state
figaro/src/figaro/db/models.py
Other components
- User
Connections 26
- User → Dashboard: manages tasks
- Dashboard → Live UI state: renders updates
figaro-ui/src/api/nats-broadcast-handler.ts - Dashboard → NATS messaging: communicates via
- User → Telegram gateway: sends instructions
- Telegram gateway → Gateway router: routes messages
- Gateway router → NATS messaging: communicates via
- Orchestrator app → NATS service: starts service
figaro/src/figaro/app.py - NATS service → NATS messaging: connects and subscribes
figaro/src/figaro/services/nats/service.py - NATS service → Task routing: registers handlers
figaro/src/figaro/services/nats/service.py - NATS service → Event handling: registers handlers
figaro/src/figaro/services/nats/service.py - Task routing → Task lifecycle: creates and routes
figaro/src/figaro/services/nats/api_tasks.py - Task routing → Task publishing: requests assignment
figaro/src/figaro/services/nats/api_tasks.py - Task publishing → NATS messaging: publishes assignments
figaro/src/figaro/services/nats/publishing.py - Event handling → Task lifecycle: records completion
figaro/src/figaro/services/nats/event_handlers.py - Task lifecycle → PostgreSQL state: persists task state
figaro/src/figaro/services/task_manager.py - Orchestrator app → Scheduled work: starts scheduler
figaro/src/figaro/app.py - Schedule controls → NATS messaging: manages schedules
- Orchestrator app → Help requests: initializes manager
figaro/src/figaro/app.py - Agent entrypoint → Worker agent: dispatches tasks
figaro-worker/src/index.ts - Agent entrypoint → Supervisor agent: dispatches tasks
figaro-worker/src/index.ts - Agent entrypoint → NATS messaging: connects through client
figaro-worker/src/index.ts - Supervisor agent → Remote desktop access: observes and controls
- Desktop controls → Orchestrator app: adds desktop
- Orchestrator app → Guacamole streaming: mounts streaming server
figaro/src/figaro/app.py - Dashboard → Guacamole streaming: views desktops
- Worker agent → Browser automation: uses browser automation