Orchestration — координационный слой над уже существующими доменными модулями. Он управляет workflow, ожиданиями, retries, handoff, human gates и recovery, но не присваивает себе доменную истину Writer, Researcher, Curator, Skeptic, Dossier, Source Watch, Investigator или Experiment.
┌──────────────────────────┐
│ Human / UI │
└────────────┬─────────────┘
│
┌────────────▼─────────────┐
│ Orchestration API/MCP │
│ auth • policy • revision │
└────────────┬─────────────┘
│
┌─────────────────────────────▼─────────────────────────────┐
│ ORCHESTRATION CORE │
│ │
│ Workflow Service • State Machine • Routing Policy │
│ Step/Handoff Svc • Human Gates • Retry Policy │
│ Idempotency Svc • Compensation • Reconciliation │
│ Audit/Event Log • Outbox • Projection Builder │
└─────────────┬───────────────────────┬─────────────────────┘
│ │
canonical│ │dispatch
│ ▼
┌──────────▼─────────┐ ┌──────────────────────────────┐
│ Postgres + Outbox │ │ Execution Engine Adapter │
│ source of truth │ │ Temporal / Prefect / other │
└──────────┬─────────┘ └──────────────┬───────────────┘
│ │
│ ▼
│ ┌───────────────────────┐
│ │ Worker / Queue Layer │
│ │ bounded concurrency │
│ └───────────┬───────────┘
│ │
┌─────────────────────┼──────────────────────────────┼─────────────────────┐
│ │ │ │
▼ ▼ ▼ ▼
Writer/Researcher Curator/Skeptic Investigator Experiment
│ │ │ │
└─────────────────────┴──────────────┬───────────────┴─────────────────────┘
▼
Dossier
{
"workflow_run_id": "wf_...",
"workflow_type": "ARTICLE_RESEARCH|INVESTIGATION|...",
"scope_ref": "dossier_...",
"status": "PENDING|RUNNING|WAITING|REVIEW|COMPLETED|FAILED|CANCELLED|PARTIAL",
"current_step_refs": [],
"policy_version": "orch-policy-v1",
"revision": 17,
"created_by": "...",
"engine_ref": "optional"
}{
"step_run_id": "step_...",
"workflow_run_id": "wf_...",
"step_type": "MODULE_CALL|HUMAN_GATE|TIMER|ROUTER|COMPENSATION",
"owner": "researcher",
"status": "READY|DISPATCHED|RUNNING|WAITING|SUCCEEDED|FAILED|STALE|CANCELLED",
"attempt": 2,
"idempotency_key": "...",
"input_hash": "...",
"result_ref": "...",
"expected_revision": 16
}DRAFT
↓ start
PENDING
↓
RUNNING ───────────────┐
│ │
├─ needs module ───> WAITING_MODULE ──┐
├─ human gate ─────> WAITING_HUMAN ───┤
├─ retry delay ────> WAITING_RETRY ───┤
├─ stale input ────> NEEDS_REPLAN ────┤
│ │ │
└────────────────────┴─────────────────┘
↓
RUNNING
↓
REVIEW / COMPLETED
↘ FAILED
↘ PARTIAL
↘ CANCELLED
| Capability | Core contract | Engine responsibility |
|---|---|---|
| dispatch | start(step_ref, revision, idempotency_key) | deliver to worker |
| timer | schedule(resume_at, step_ref) | durable wake-up |
| retry | policy decides whether retry is legal | execute approved backoff schedule |
| heartbeat | record liveness signal/ref | detect lost worker |
| resume | core validates current canonical revision | continue execution |
| cancel | core creates cancellation intent | stop dispatch where possible |
| replay | core enforces idempotency/reconciliation | re-execute safely |
Сильный кандидат для durable execution, retries, timers, replay и long-running workflows. Использовать через адаптер; не отдавать ему domain policy.
Удобен для Python-heavy execution и operational workflows. Проверять durable semantics и recovery на нашем golden set.
Полезен для локальных reasoning graphs внутри шага, но не должен автоматически становиться глобальным orchestration system of record.
| Module | Typical orchestration action | Result ownership |
|---|---|---|
| Writer | request draft / revise draft | Writer owns draft artifact |
| Researcher | research request / fill evidence gap | Researcher owns research run + evidence refs |
| Curator | promotion request | Curator owns permanent-RAG promotion decision |
| Skeptic | verification request | Skeptic owns verification verdict |
| Dossier | read/append working context | Dossier owns case state |
| Source Watch | subscribe / react to change event | Source Watch owns watch/freshness events |
| Investigator | causal investigation request | Investigator owns hypotheses/causal verdicts |
| Experiment | controlled test request | Experiment owns design/run/result integrity |
{
"handoff_id": "ho_...",
"workflow_run_id": "wf_...",
"from": "orchestration",
"to": "skeptic",
"scope": {"dossier_id":"...","artifact_ref":"..."},
"request_type": "VERIFY_CAUSAL_CLAIMS",
"input_refs": ["..."],
"required_output_schema": "skeptic.verdict.v1",
"deadline_policy": "NO_AUTO_APPROVAL",
"idempotency_key": "...",
"trace_id": "..."
}
Orchestration itself должен быть лёгким. Основная нагрузка — module jobs, особенно Qwen 30B, causal analysis, experiments, parsing и indexing. Поэтому scheduling обязан учитывать реальную загрузку server2.
Priority 0 CONTROL PLANE
API / state transitions / audit / outbox
must remain responsive
Priority 1 QWEN 30B INTERACTIVE / USER-BLOCKING
Writer / Researcher / Investigator reasoning
Priority 2 MODULE BACKGROUND
Curator indexing, Source Watch classification,
Skeptic batch verification
Priority 3 HEAVY NUMERICAL / EXPERIMENT
DoWhy / pgmpy / EconML / benchmark / bootstrap
server2
├── orchestration-api
├── orchestration-core
├── orchestration-worker-control
├── orchestration-worker-general
├── postgres
│ ├── orchestration schema
│ ├── event log
│ └── outbox
├── execution-engine (candidate adapter)
├── redis / broker (only if selected stack needs it)
├── observability
│ ├── structured logs
│ ├── metrics
│ └── traces
└── module APIs
├── writer
├── researcher
├── curator
├── skeptic
├── dossier
├── source-watch
├── investigator
└── experiment
BEGIN validate expected_revision validate policy/capability mutate canonical workflow/step state append audit/event insert outbox command COMMIT outbox dispatcher ↓ execution engine / module API ↓ result callback ↓ validate + idempotent attach ↓ next canonical transition
1. canonical core implemented enough for spike 2. Temporal / Prefect / alternative adapter spikes 3. golden failure/recovery suite 4. server2 practical benchmark 5. compare operational burden + recovery semantics 6. ADR: REUSE / ADAPT / BUILD 7. freeze MVP engine choice
AI_orchestration_10_план_реализации_MVP.html
В нём: repo layout, migrations, coding phases, engine spike, golden tests, server2 benchmark, ADR, rollout/shadow mode и Definition of Orchestration MVP Done.