Workflow Studio
The Workflow Studio is the operator-facing surface for the additive
orchestration control plane introduced by the seven-phase refactor in
orchestration-refactor-rollout.md.
It composes the five existing graph builders, the three (then five)
adapters, and the new hash-locked WorkflowSpec registry into a
single replayable workflow concept.
What ships
| Layer | File / Path |
|---|---|
| Spec contract | alphaswarm/agents/orchestration/spec.py |
| Registry + persist_spec | alphaswarm/agents/orchestration/registry_specs.py |
| Runtime | alphaswarm/agents/orchestration/runtime.py |
| Adapter ABC + metaclass | alphaswarm/agents/orchestration/base.py |
| Adapter registry | alphaswarm/agents/orchestration/registry.py |
| Adapters (5) | alphaswarm/agents/orchestration/adapters/ |
| ORM | alphaswarm/persistence/models_workflows.py |
| Migration | alembic/versions/0046_workflow_versioning.py |
| REST | alphaswarm/api/routes/workflows.py |
| Celery tasks | alphaswarm/tasks/orchestration_tasks.py |
| DataMCP tools | alphaswarm/data/mcp/tools/orchestration.py, alphaswarm/data/mcp/tools/automation.py |
| Cache entry | workflows category in alphaswarm/cache/keys.py |
| Frontend routes | alphaswarm_client/src/routes/workflows/ |
| Frontend components | alphaswarm_client/src/components/workflows/ |
Spec shape
A workflow selects exactly one
OrchestrationAdapter by alias
and hands it adapter-specific params. The adapter dispatches
internally — composite flows (Crew + Graph + Debate) belong inside
their own adapter, not at the spec layer.
name: research.dialectical_with_fusion_v1
description: "Bull/Bear debate + fusion + weight-centric execution"
adapter: LangGraphAdapter
adapter_kind: graph
params:
builder: dialectical # one of build_* in alphaswarm/agents/graph/
builder_kwargs:
max_rounds: 2
schedule:
cron: "30 13 * * 1-5"
timezone: UTC
enabled: false # operator flips after the studio + schedule flags
guardrails:
cost_budget_usd: 3.0
max_calls: 60
max_duration_seconds: 900
annotations: [research, dialectical]
template_target: research
WorkflowSpec.snapshot_hash() is the SHA256 of the canonical JSON
form (sorted keys, no whitespace). Re-snapshotting a spec with the
same hash returns the existing workflow_spec_versions row;
changing any field inserts a NEW row (parallel to
agent_spec_versions, bot_versions, rl_experiment_versions,
analysis_spec_versions).
Operator flow
- Operator flips
ALPHASWARM_ORCHESTRATION_STUDIO_ENABLED=true(see the rollout doc). - Frontend navigates to
/workflows. List + detail render through<EntityPicker kind="workflows" />so the dropdown shares the same cache invalidation path as every other entity picker. - Operator hits Run → POST
/workflows/{name}/run→ enqueuesalphaswarm.tasks.orchestration_tasks.run_workflow. The route returns atask_id; the studio attaches via the existinguseLiveStreamhook for_progress.emitframes (rule 4). - Operator hits Replay on a historical run → POST
/workflows/runs/{run_id}/replayre-dispatches with the capturedspec_version_idfor deterministic reproduction. - Operator hits the topbar KillSwitch's "Halt workflows" action →
POST
/workflows/haltmirrors the five canonical halt endpoints (/agents/halt,/paper/stop-all,/bots/halt-all,/rl/halt-all,/quant-agents/halt).
Halt fan-out
The Phase 2 WorkflowRuntime checks should_halt(state) between
every adapter transition. should_halt is the OR of:
has_kill_switch()— Redis-backed global flag (the existing topbar KillSwitch flips this).state["halt_token"]— per-run boolean the Phase 6/workflows/haltendpoint sets on every activeWorkflowRunrow insideALPHASWARM_ORCHESTRATION_HALT_CHECK_TIMEOUT_SECONDSof the API call.
Long-running adapters (CrewProcessAdapter, LangGraphAdapter,
DialecticalDebateAdapter) poll context.is_halted() between
inner steps so the SLA holds even mid-debate.
Adapter catalog (Phases 2-5)
| alias | kind | source | description |
|---|---|---|---|
LangGraphAdapter | graph | alphaswarm | The default state-machine adapter. Uses LangGraph to define nodes (agent calls, data tools) and edges (conditional transitions). Perfect for multi-turn research loops. |
CrewProcessAdapter | crew | finrobot | Sequential or Hierarchical crew process. Wraps CrewAI to dispatch tasks to a predefined team of agents. Ideal for linear data-mining pipelines. |
DialecticalDebateAdapter | debate | tradingagents | Dialectical multi-agent debate. Pit a 'Bull' agent against a 'Bear' agent, then use a 'Judge' (Fusion) agent to synthesize the final target weight. |
SignalFusionAdapter | fusion | vibe_trading | Multi-alpha signal fusion. Combines signals from multiple sub-workflows or strategies into a single confidence-weighted output. |
WeightCentricExecutionAdapter | execution | finrl | FinRL-X execution adapter. Maps high-level target weights to concrete broker orders while honoring RiskLimits. |
Halt fan-out and Safety
The Phase 2 WorkflowRuntime ensures that any "Run" can be stopped immediately, even if it's currently deep in a multi-agent debate.
Global Kill Switch
The has_kill_switch() check queries a Redis-backed global flag. When the operator hits the topbar Kill Switch, this flag is flipped to true, and every WorkflowRuntime transition will halt.
Per-Run Halt
The POST /workflows/halt endpoint targets specific run_ids. It sets a halt_token in the run's state. Long-running adapters like CrewProcessAdapter and LangGraphAdapter are instrumented to poll context.is_halted() between inner steps.
Budget Guardrails
Every WorkflowSpec can define budget limits:
cost_budget_usd: Halts if the cumulative LLM cost (tracked inagent_runs_v2) exceeds this limit.max_duration_seconds: Halts if the wall-clock time exceeds the threshold.
Workflow Studio UI
The Studio provides a visual timeline of the workflow execution:
- Node Spans: OTEL-instrumented durations for each adapter step.
- Breadcrumbs: A JSONL audit trail of state transitions and intermediate agent outputs.
- Cost Accumulator: Real-time USD cost tracking for the current run.
- Live Stream: Progress frames from
_progress.emitrendered as a scrollable log.
Replay and Versioning
AlphaSwarm rejects in-place mutations of workflow behavior. If you change a prompt, a hyperparameter, or the adapter configuration:
persist_spec(new_spec)computes the new SHA-256 hash.- A new
workflow_spec_versionsrow is inserted. - The previous version remains active for any historical
run_ids.
To reproduce a specific historical outcome, the Replay feature loads the pinned version of the spec, ensuring that the exact same logic is executed against the same (or fresh) data.
See also
- orchestration-refactor-rollout.md — operator runbook + per-flag rollback.
- multi-agent-patterns.md — detailed look at the seven adapter topologies.
- data-mcp.md —
data.orchestration.*anddata.automation.*tool catalog. - agentic-development.md — where
WorkflowSpecsits in the four-runtime + skill-artifact framework.