Repository navigation
Expand file tree
/
Copy pathdocker-compose.yml
More file actions
490 lines (436 loc) · 14.4 KB
/
Copy pathdocker-compose.yml
File metadata and controls
490 lines (436 loc) · 14.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
# AgentSpore - Docker Compose
# Run: docker-compose up -d
# With Frontend: docker-compose --profile frontend up -d
# With Agents API: docker-compose --profile agents up -d
# With Scheduler (autonomous agents): docker-compose --profile scheduler up -d
# With Reddit agent: docker-compose --profile reddit-agent up -d
# Full stack: docker-compose --profile frontend --profile agents --profile scheduler --profile reddit-agent up -d
services:
# PostgreSQL database
db:
image: postgres:16-alpine
container_name: agentspore-db
restart: unless-stopped
environment:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
POSTGRES_DB: sporeai
volumes:
- postgres_data:/var/lib/postgresql/data
ports:
- "5432:5432"
healthcheck:
test: ["CMD-SHELL", "pg_isready -U postgres -d sporeai"]
interval: 10s
timeout: 5s
retries: 5
networks:
- sporeai-network
# Flyway database migrations
flyway:
image: flyway/flyway:10
container_name: agentspore-flyway
# CREATE INDEX CONCURRENTLY (V108) hangs on Flyway's transactional advisory lock
command: -url=jdbc:postgresql://db:5432/sporeai -user=postgres -password=postgres migrate -postgresql.transactional.lock=false
volumes:
- ./db/migrations:/flyway/sql:ro
depends_on:
db:
condition: service_healthy
networks:
- sporeai-network
# Redis for caching and queues
redis:
image: redis:7-alpine
container_name: agentspore-redis
restart: unless-stopped
ports:
- "6379:6379"
volumes:
- redis_data:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 5s
retries: 5
networks:
- sporeai-network
# FastAPI Backend (main API)
backend:
build:
context: ./backend
dockerfile: Dockerfile
container_name: agentspore-backend
restart: unless-stopped
environment:
# App
DEBUG: "true"
UVICORN_WORKERS: "${UVICORN_WORKERS:-4}"
# Database
DATABASE_URL: "postgresql+asyncpg://postgres:postgres@db:5432/sporeai"
# Redis
REDIS_URL: "redis://redis:6379"
# OpenRouter LLM
LLM_API_KEY: "${OPENROUTER_API_KEY:-}"
LLM_BASE_URL: "https://openrouter.ai/api/v1"
LLM_MODEL: "${LLM_MODEL:-anthropic/claude-3.5-sonnet}"
# GitHub (production Git provider)
GITHUB_ORG: "${GITHUB_ORG:-AgentSpore}"
GITHUB_PAT: "${GITHUB_PAT:-}"
GITHUB_APP_ID: "${GITHUB_APP_ID:-}"
GITHUB_APP_PRIVATE_KEY: "${GITHUB_APP_PRIVATE_KEY:-}"
GITHUB_APP_INSTALLATION_ID: "${GITHUB_APP_INSTALLATION_ID:-}"
# GitHub OAuth
GITHUB_OAUTH_CLIENT_ID: "${GITHUB_OAUTH_CLIENT_ID:-}"
GITHUB_OAUTH_CLIENT_SECRET: "${GITHUB_OAUTH_CLIENT_SECRET:-}"
GITHUB_OAUTH_REDIRECT_URI: "${GITHUB_OAUTH_REDIRECT_URI:-http://localhost:8000/api/v1/agents/github/callback}"
# OpenViking (shared agent memory)
OPENVIKING_URL: "${OPENVIKING_URL:-}"
OPENVIKING_API_KEY: "${OPENVIKING_API_KEY:-}"
# CORS
CORS_ORIGINS: '["http://localhost:3000","http://localhost:8080","http://localhost:5173","*"]'
ports:
- "8000:8000"
dns:
- 8.8.8.8
- 1.1.1.1
depends_on:
flyway:
condition: service_completed_successfully
redis:
condition: service_healthy
networks:
- sporeai-network
volumes:
- ./backend/app:/app/app:ro # Hot-reload in dev
- ./skill.md:/app/skill.md:ro # skill.md for agents
# A4 deployment worker (A4_BUILDER=fake|buildkit, default fake). Same image as backend; no Docker socket.
# Start with: docker compose --profile a4 up a4-worker (idle unless A4_DEPLOY_ENABLED=true)
a4-worker:
build:
context: ./backend
dockerfile: Dockerfile
container_name: agentspore-a4-worker
restart: unless-stopped
command: ["/app/.venv/bin/python", "-m", "app.workers.a4"]
init: true
stop_grace_period: 30s
healthcheck:
disable: true
environment:
DEBUG: "true"
DATABASE_URL: "postgresql+asyncpg://postgres:postgres@db:5432/sporeai"
REDIS_URL: "redis://redis:6379"
A4_DEPLOY_ENABLED: "${A4_DEPLOY_ENABLED:-false}"
A4_BUILDER: "${A4_BUILDER:-fake}"
A4_BUILDER_OUT_DIR: /var/lib/a4-out
A4_BUILDKIT_ADDR: "${A4_BUILDKIT_ADDR:-tcp://buildkitd:1234}"
A4_PKG_MIRROR_HOST: "${A4_PKG_MIRROR_HOST:-10.213.77.12}"
A4_RECYCLE_GATE_URL: "${A4_RECYCLE_GATE_URL:-http://a4-restart-gate:2375}"
A4_REGISTRY_URL: "${A4_REGISTRY_URL:-http://a4-registry:5000}"
A4_RUNTIME: "${A4_RUNTIME:-off}"
A4_LAUNCHER_URL: "${A4_LAUNCHER_URL:-http://a4-launcher:8080}"
depends_on:
flyway:
condition: service_completed_successfully
redis:
condition: service_healthy
networks:
- sporeai-network
- a4-control
- a4-registry-net
volumes:
- ./backend/app:/app/app:ro
- type: bind
source: ${A4_BUILDKIT_CERT_DIR:-./deploy/a4-builder/client-tls-empty}
target: /run/a4-builder-tls
read_only: true
bind:
create_host_path: false
tmpfs:
- /var/lib/a4-out:size=4g
deploy:
resources:
limits:
memory: 6g # 4g tmpfs counts against it, plus worker headroom
profiles:
- a4
# RedditScout — autonomous agent that discovers ideas on Reddit and builds MVPs
reddit-agent:
build:
context: ./agents
dockerfile: Dockerfile
container_name: agentspore-reddit-agent
restart: unless-stopped
command: ["uv", "run", "python", "-m", "reddit_bot"]
volumes:
- reddit_agent_data:/data
environment:
# OpenRouter (pydantic-ai reads OPENAI_API_KEY)
OPENAI_API_KEY: "${OPENROUTER_API_KEY:-}"
OPENAI_BASE_URL: "https://openrouter.ai/api/v1"
LLM_MODEL: "${LLM_MODEL:-anthropic/claude-3.5-sonnet}"
# AgentSpore backend
BACKEND_URL: "http://backend:8000"
# Agent identity
AGENT_NAME: "RedditScout"
# Persistent state
STATE_FILE: "/data/agent_state.json"
# Schedule (hours)
DISCOVER_INTERVAL_HOURS: "${REDDIT_DISCOVER_INTERVAL_HOURS:-6}"
HEARTBEAT_INTERVAL_HOURS: "${REDDIT_HEARTBEAT_INTERVAL_HOURS:-4}"
# Reddit API (optional; without them uses RSS feed)
# Register an app: https://www.reddit.com/prefs/apps
REDDIT_CLIENT_ID: "${REDDIT_CLIENT_ID:-}"
REDDIT_CLIENT_SECRET: "${REDDIT_CLIENT_SECRET:-}"
# Collection parameters
MAX_POSTS_PER_SUBREDDIT: "25"
MIN_OPPORTUNITY_SCORE: "6"
depends_on:
backend:
condition: service_started
redis:
condition: service_healthy
networks:
- sporeai-network
profiles:
- reddit-agent
# CodeReviewerAgent — autonomous agent that reviews code in repos and chats
code-reviewer:
build:
context: ./agents
dockerfile: Dockerfile
container_name: agentspore-code-reviewer
restart: unless-stopped
command: ["uv", "run", "python", "-m", "code_reviewer"]
volumes:
- code_reviewer_data:/data
environment:
# LLM (pydantic-ai reads OPENAI_*)
OPENAI_API_KEY: "${OPENROUTER_API_KEY:-}"
OPENAI_BASE_URL: "https://openrouter.ai/api/v1"
# Model tiers:
# fast — shallow file scan, chat messages
# standard — regular code review
# strong — security review and deep analysis
LLM_MODEL_FAST: "${LLM_MODEL_FAST:-z-ai/glm-5}"
LLM_MODEL_STANDARD: "${LLM_MODEL_STANDARD:-anthropic/claude-sonnet-4-5}"
LLM_MODEL_STRONG: "${LLM_MODEL_STRONG:-anthropic/claude-sonnet-4-6}"
# AgentSpore backend
BACKEND_URL: "http://backend:8000"
# Agent identity
AGENT_NAME: "CodeReviewerAgent"
# Persistent state
STATE_FILE: "/data/reviewer_state.json"
# Schedule (hours)
REVIEW_INTERVAL_HOURS: "${REVIEWER_REVIEW_INTERVAL_HOURS:-2}"
HEARTBEAT_INTERVAL_HOURS: "${REVIEWER_HEARTBEAT_INTERVAL_HOURS:-4}"
# Projects per cycle
MAX_PROJECTS_PER_CYCLE: "${REVIEWER_MAX_PROJECTS:-3}"
depends_on:
backend:
condition: service_started
redis:
condition: service_healthy
networks:
- sporeai-network
profiles:
- code-reviewer
# DeveloperAgent — reads GitHub issues, fixes or disputes them
developer:
build:
context: ./agents
dockerfile: Dockerfile
container_name: agentspore-developer
restart: unless-stopped
command: ["uv", "run", "python", "-m", "developer"]
volumes:
- developer_data:/data
environment:
# LLM
OPENAI_API_KEY: "${OPENROUTER_API_KEY:-}"
OPENAI_BASE_URL: "https://openrouter.ai/api/v1"
# Model tiers:
# fast — issue analysis (valid/dispute/discuss)
# standard — fix or comment generation
# strong — security fixes (critical/high severity)
LLM_MODEL_FAST: "${LLM_MODEL_FAST:-z-ai/glm-5}"
LLM_MODEL_STANDARD: "${LLM_MODEL_STANDARD:-anthropic/claude-sonnet-4-5}"
LLM_MODEL_STRONG: "${LLM_MODEL_STRONG:-anthropic/claude-sonnet-4-6}"
# AgentSpore backend
BACKEND_URL: "http://backend:8000"
# Agent identity
AGENT_NAME: "DeveloperAgent"
# Persistent state
STATE_FILE: "/data/developer_state.json"
# Schedule
WORK_INTERVAL_HOURS: "${DEVELOPER_WORK_INTERVAL_HOURS:-1}"
HEARTBEAT_INTERVAL_HOURS: "${DEVELOPER_HEARTBEAT_INTERVAL_HOURS:-4}"
# Issues per cycle
MAX_ISSUES_PER_CYCLE: "${DEVELOPER_MAX_ISSUES:-5}"
dns:
- 8.8.8.8
- 1.1.1.1
depends_on:
backend:
condition: service_started
redis:
condition: service_healthy
networks:
- sporeai-network
profiles:
- developer
# FinanceScoutAgent — generates fintech ideas and builds MVPs via full skill.md cycle
finscout:
build:
context: ./agents
dockerfile: Dockerfile
container_name: agentspore-finscout
restart: unless-stopped
command: ["uv", "run", "python", "-m", "finscout"]
volumes:
- finscout_data:/data
environment:
# LLM (pydantic-ai reads OPENAI_*)
OPENAI_API_KEY: "${OPENROUTER_API_KEY:-}"
OPENAI_BASE_URL: "https://openrouter.ai/api/v1"
# Model tiers:
# fast — dedup, heartbeat
# standard — idea analysis
# strong — MVP code generation (CODEGEN tier)
LLM_MODEL_FAST: "${LLM_MODEL_FAST:-z-ai/glm-5}"
LLM_MODEL_STANDARD: "${LLM_MODEL_STANDARD:-anthropic/claude-sonnet-4-5}"
LLM_MODEL_STRONG: "${LLM_MODEL_STRONG:-anthropic/claude-sonnet-4-6}"
# AgentSpore backend
BACKEND_URL: "http://backend:8000"
# Agent identity
AGENT_NAME: "FinanceScout"
# Persistent state
STATE_FILE: "/data/finscout_state.json"
# Schedule (hours)
WORK_INTERVAL_HOURS: "${FINSCOUT_WORK_INTERVAL_HOURS:-24}"
HEARTBEAT_INTERVAL_HOURS: "${FINSCOUT_HEARTBEAT_INTERVAL_HOURS:-4}"
# Projects to build per cycle
MAX_PROJECTS_PER_CYCLE: "${FINSCOUT_MAX_PROJECTS:-1}"
dns:
- 8.8.8.8
- 1.1.1.1
depends_on:
backend:
condition: service_started
redis:
condition: service_healthy
networks:
- sporeai-network
profiles:
- finscout
# ScienceScout — arXiv-based autonomous agent
sciencescout:
build:
context: ./agents
dockerfile: Dockerfile
container_name: agentspore-sciencescout
restart: unless-stopped
command: ["uv", "run", "python", "-m", "sciencescout"]
volumes:
- sciencescout_data:/data
environment:
# LLM (pydantic-ai reads OPENAI_*)
OPENAI_API_KEY: "${OPENROUTER_API_KEY:-}"
OPENAI_BASE_URL: "https://openrouter.ai/api/v1"
# Model tiers:
# fast — paper filtering, heartbeat
# standard — paper analysis for commercial potential
# strong — MVP code generation (CODEGEN tier)
LLM_MODEL_FAST: "${LLM_MODEL_FAST:-z-ai/glm-5}"
LLM_MODEL_STANDARD: "${LLM_MODEL_STANDARD:-anthropic/claude-sonnet-4-5}"
LLM_MODEL_STRONG: "${LLM_MODEL_STRONG:-anthropic/claude-sonnet-4-6}"
# AgentSpore backend
BACKEND_URL: "http://backend:8000"
# Agent identity
AGENT_NAME: "ScienceScout"
# Persistent state
STATE_FILE: "/data/sciencescout_state.json"
# Schedule (hours)
WORK_INTERVAL_HOURS: "${SCIENCESCOUT_WORK_INTERVAL_HOURS:-12}"
HEARTBEAT_INTERVAL_HOURS: "${SCIENCESCOUT_HEARTBEAT_INTERVAL_HOURS:-4}"
# Projects to build per cycle
MAX_PROJECTS_PER_CYCLE: "${SCIENCESCOUT_MAX_PROJECTS:-1}"
# arXiv parameters
MAX_PAPERS_PER_QUERY: "${SCIENCESCOUT_MAX_PAPERS:-50}"
MIN_OPPORTUNITY_SCORE: "${SCIENCESCOUT_MIN_SCORE:-7}"
ARXIV_CATEGORIES: '${SCIENCESCOUT_CATEGORIES:-["cs.AI","cs.LG","cs.CL","cs.CV","physics.comp-ph","q-bio.BM","stat.ML","eess.SP","cond-mat.mtrl-sci"]}'
dns:
- 8.8.8.8
- 1.1.1.1
depends_on:
backend:
condition: service_started
redis:
condition: service_healthy
networks:
- sporeai-network
profiles:
- sciencescout
# Next.js Frontend
frontend:
build:
context: ./frontend
dockerfile: Dockerfile
container_name: agentspore-frontend
restart: unless-stopped
environment:
NEXT_PUBLIC_API_URL: "${NEXT_PUBLIC_API_URL:-http://localhost:8000}"
ports:
- "3000:3000"
depends_on:
- backend
networks:
- sporeai-network
profiles:
- frontend
# Adminer for DB management
adminer:
image: adminer:4
container_name: agentspore-adminer
restart: unless-stopped
ports:
- "8081:8080"
depends_on:
- db
networks:
- sporeai-network
profiles:
- tools
# RedisInsight for Redis monitoring
redis-insight:
image: redis/redisinsight:latest
container_name: agentspore-redisinsight
restart: unless-stopped
ports:
- "5540:5540"
depends_on:
- redis
networks:
- sporeai-network
profiles:
- tools
volumes:
postgres_data:
redis_data:
reddit_agent_data:
code_reviewer_data:
developer_data:
finscout_data:
sciencescout_data:
networks:
sporeai-network:
driver: bridge
# Worker <-> a4-restart-gate (deploy/a4-builder.compose.yml) only; no route out, never a4-builder.
a4-control:
name: a4-control
internal: true
# Worker <-> a4-registry (deploy/a4-registry.compose.yml) only; no route out.
a4-registry-net:
name: a4-registry-net
internal: true