Architecture
Package ownership, staged runtime shape, and the boundaries that keep the system inspectable.
Runtime shape
The current runtime is a staged specialist graph that feeds a guarded execution path:
- Research Coordinator
- Fundamental Analyst
- Macro and News Analyst
- Regime Agent
- Strategy Selector
- Risk Agent
- Specialist Consensus Layer
- Manager Agent
- Execution Guard
- Paper Broker
The details can evolve, but the important rule is that reasoning and execution still pass through explicit contracts instead of ad hoc chat messages.
Package ownership
agentic_trader/agents/: specialist, manager, and operator-facing reasoning surfacesagentic_trader/llm/: provider access and role-based model routingagentic_trader/market/: market data loading, calendar logic, and feature preparationagentic_trader/providers/: provider boundaries and canonical aggregationagentic_trader/memory/: retrieval, embeddings, and memory assemblyagentic_trader/storage/: DuckDB persistence and query surfacesagentic_trader/engine/andagentic_trader/execution/: guard logic, intents, outcomes, and broker seamsagentic_trader/workflows/: run-once, service, replay, and backtest orchestration
Frontend boundary
The repo currently has two Next.js shells:
webgui/for the operator-facing local UIdocs/for developer-facing documentation
Neither should become a second runtime. Thin route handlers, shared contracts, and explicit CLI delegation are preferred over duplicating orchestration in TypeScript.
Design rules
- Prefer explicit typed inputs over prompt-only inference.
- Keep missing data visible.
- Preserve source attribution and timestamps.
- Avoid UI-only fixes for backend truth problems.
- Keep failures visible instead of smoothing them into fake confidence.
When to split files
This repo does not need abstraction for its own sake, but it does benefit from modular files when:
- a page or component becomes hard to scan
- one file mixes unrelated responsibilities
- testing or reasoning improves when logic is extracted
- a frontend shell starts coupling data access, copy, and rendering too tightly
What counts as architecture drift
Examples of drift we want to avoid:
- adding web-only runtime semantics
- introducing a hidden orchestration layer outside the Python runtime
- treating docs as a parallel source of truth instead of synced project memory
- burying execution safety in prompts that should live in code