Files
AutoGPT/autogpt_platform/docker-compose.yml
Reinier van der Leer d23248f065 feat(backend/copilot): Copilot Executor Microservice (#12057)
Uncouple Copilot task execution from the REST API server. This should
help performance and scalability, and allows task execution to continue
regardless of the state of the user's connection.

- Resolves #12023

### Changes 🏗️

- Add `backend.copilot.executor`->`CoPilotExecutor` (setup similar to
`backend.executor`->`ExecutionManager`).

This executor service uses RabbitMQ-based task distribution, and sticks
with the existing Redis Streams setup for task output. It uses a cluster
lock mechanism to ensure a task is only executed by one pod, and the
`DatabaseManager` for pooled DB access.

- Add `backend.data.db_accessors` for automatic choice of direct/proxied
DB access

Chat requests now flow: API → RabbitMQ → CoPilot Executor → Redis
Streams → SSE Client. This enables horizontal scaling of chat processing
and isolates long-running LLM operations from the API service.

- Move non-API Copilot stuff into `backend.copilot` (from
`backend.api.features.chat`)
  - Updated import paths for all usages

- Move `backend.executor.database` to `backend.data.db_manager` and add
methods for copilot executor
  - Updated import paths for all usages
- Make `backend.copilot.db` RPC-compatible (-> DB ops return ~~Prisma~~
Pydantic models)
  - Make `backend.data.workspace` RPC-compatible
  - Make `backend.data.graphs.get_store_listed_graphs` RPC-compatible

DX:
- Add `copilot_executor` service to Docker setup

Config:
- Add `Config.num_copilot_workers` (default 5) and
`Config.copilot_executor_port` (default 8008)
- Remove unused `Config.agent_server_port`

> [!WARNING]
> **This change adds a new microservice to the system, with entrypoint
`backend.copilot.executor`.**
> The `docker compose` setup has been updated, but if you run the
Platform on something else, you'll have to update your deployment config
to include this new service.
>
> When running locally, the `CoPilotExecutor` uses port 8008 by default.

### Checklist 📋

#### For code changes:
- [x] I have clearly listed my changes in the PR description
- [x] I have made a test plan
- [x] I have tested my changes according to the test plan:
  - [x] Copilot works
    - [x] Processes messages when triggered
    - [x] Can use its tools

#### For configuration changes:

- [x] `.env.default` is updated or already compatible with my changes
- [x] `docker-compose.yml` is updated or already compatible with my
changes
- [x] I have included a list of my configuration changes in the PR
description (under **Changes**)

---------

Co-authored-by: Zamil Majdy <zamil.majdy@agpt.co>
2026-02-17 16:15:28 +00:00

186 lines
3.6 KiB
YAML

networks:
app-network:
name: app-network
shared-network:
name: shared-network
volumes:
supabase-config:
clamav-data:
x-agpt-services:
&agpt-services
networks:
- app-network
- shared-network
x-supabase-services:
&supabase-services
networks:
- app-network
- shared-network
services:
# AGPT services
migrate:
<<: *agpt-services
extends:
file: ./docker-compose.platform.yml
service: migrate
redis:
<<: *agpt-services
extends:
file: ./docker-compose.platform.yml
service: redis
rabbitmq:
<<: *agpt-services
extends:
file: ./docker-compose.platform.yml
service: rabbitmq
rest_server:
<<: *agpt-services
extends:
file: ./docker-compose.platform.yml
service: rest_server
executor:
<<: *agpt-services
extends:
file: ./docker-compose.platform.yml
service: executor
copilot_executor:
<<: *agpt-services
extends:
file: ./docker-compose.platform.yml
service: copilot_executor
websocket_server:
<<: *agpt-services
extends:
file: ./docker-compose.platform.yml
service: websocket_server
database_manager:
<<: *agpt-services
extends:
file: ./docker-compose.platform.yml
service: database_manager
scheduler_server:
<<: *agpt-services
extends:
file: ./docker-compose.platform.yml
service: scheduler_server
notification_server:
<<: *agpt-services
extends:
file: ./docker-compose.platform.yml
service: notification_server
clamav:
<<: *agpt-services
image: clamav/clamav-debian:latest
ports:
- "3310:3310"
volumes:
- clamav-data:/var/lib/clamav
environment:
- CLAMAV_NO_FRESHCLAMD=false
- CLAMD_CONF_StreamMaxLength=50M
- CLAMD_CONF_MaxFileSize=100M
- CLAMD_CONF_MaxScanSize=100M
- CLAMD_CONF_MaxThreads=12
- CLAMD_CONF_ReadTimeout=300
healthcheck:
test: ["CMD-SHELL", "clamdscan --version || exit 1"]
interval: 30s
timeout: 10s
retries: 3
frontend:
<<: *agpt-services
extends:
file: ./docker-compose.platform.yml
service: frontend
# Supabase services (minimal: auth + db + kong)
kong:
<<: *supabase-services
extends:
file: ./db/docker/docker-compose.yml
service: kong
auth:
<<: *supabase-services
extends:
file: ./db/docker/docker-compose.yml
service: auth
environment:
GOTRUE_MAILER_AUTOCONFIRM: true
db:
<<: *supabase-services
extends:
file: ./db/docker/docker-compose.yml
service: db
ports:
- 5432:5432 # We don't use Supavisor locally, so we expose the db directly.
# Studio and its dependencies for local development only
meta:
<<: *supabase-services
profiles:
- local
extends:
file: ./db/docker/docker-compose.yml
service: meta
studio:
<<: *supabase-services
profiles:
- local
extends:
file: ./db/docker/docker-compose.yml
service: studio
depends_on:
meta:
condition: service_healthy
# environment:
# NEXT_PUBLIC_ENABLE_LOGS: false # Disable analytics/logging features
deps:
<<: *supabase-services
profiles:
- local
image: busybox
command: /bin/true
depends_on:
- kong
- auth
- db
- studio
- redis
- rabbitmq
- clamav
- migrate
deps_backend:
<<: *agpt-services
profiles:
- local
image: busybox
command: /bin/true
depends_on:
- deps
- rest_server
- executor
- copilot_executor
- websocket_server
- database_manager