Workflows-First Architecture
Build reliable, deterministic AI systems with fluent workflow builders, scoped tool isolation, and progressive agent escalation.
Overview
The isA platform implements a Workflows-First Architecture inspired by Anthropic Research (Building Effective Agents). Rather than defaulting to unconstrained autonomous agent loops with dozens of tools injected into the prompt, the platform prioritizes deterministic, code-orchestrated workflows for predictable tasks and reserves autonomous multi-agent teams for open-ended exploration.
+--------------------------------------------------------------------------------------------------+
| Progressive Escalation Ladder |
| |
| single (augmented LLM) ──► workflow (deterministic) ──► subagents ──► dynamic_team (swarm) |
| [Low Latency / Low Cost] [Open-ended Research] |
+--------------------------------------------------------------------------------------------------+Two-Tier Orchestration Model
| Tier | Engine | Execution Domain | Latency | Lifecycle | Best For |
|---|---|---|---|---|---|
| Tier-1: Micro-Workflows | isA_Agent_SDK | In-process, streaming, memory | < 1s – 5s | Ephemeral | Chaining, Routing, Parallelization, Evaluator-Optimizer loops |
| Tier-2: Macro-Workflows | isa_maestro | Distributed (FastAPI, Redis, Postgres) | Minutes, hours, days | Durable / Persistent | Enterprise APQC compliance, RPA queues, long-running processes, Action Center |
Canonical Workflow Patterns
isA_Agent_SDK provides high-level, typed fluent builders under isa_agent_sdk.dag.workflow.Workflow that compile down to Kahn’s topological sort and parallel wavefront execution:
1. Prompt Chaining (Workflow.chain)
Decomposes a complex task into a sequence of steps where each stage transforms the input for the next. Supports programmatic gates that validate outputs before proceeding:
from isa_agent_sdk.dag.workflow import Workflow
# Define stages with validation gates
pipeline = Workflow.chain([
extract_entities_step,
lambda result: len(result.get("entities", [])) > 0, # Gate: must extract at least 1 entity
format_report_step
], name="entity_extraction_pipeline")
async for event in pipeline.execute({"document": raw_text}):
print(f"[{event.event_type}] {event.data}")If a gate callable returns False, execution halts cleanly with a workflow.gate.reject telemetry event rather than cascading errors downstream.
2. Intent Routing (Workflow.route)
Classifies incoming queries and routes execution to specialized prompts, models, or toolsets:
from isa_agent_sdk.dag.workflow import Workflow
router = Workflow.route(
classifier=classify_intent,
routes={
"billing": handle_billing_step,
"technical": handle_tech_support_step,
"sales": handle_enterprise_quote_step
},
default=handle_fallback_step
)
result = await router.run(user_query)3. Parallelization (Workflow.parallel)
Executes independent subtasks concurrently via parallel wavefronts. Supports both Sectioning (dividing work) and Voting (running multiple models for consensus):
from isa_agent_sdk.dag.workflow import Workflow
# Parallel sectioning: run competitor analysis and sentiment in parallel
analysis = Workflow.parallel([
competitor_analysis_step,
social_sentiment_step,
financial_ratios_step
], reducer=merge_market_signals)
report = await analysis.run(target_company)4. Evaluator-Optimizer (Workflow.evaluator_optimizer)
Implements a generator/critic loop with a functionally decoupled judge:
- The Generator produces an initial artifact.
- The Evaluator (optionally running on a cheaper, fast model like Gemini Flash) scores the output against an explicit rubric.
- If the score is below the threshold, the generator revises the artifact with structured feedback.
- Execution is strictly bounded by
max_revisionsto eliminate infinite looping.
from isa_agent_sdk.dag.workflow import Workflow
code_reviewer = Workflow.evaluator_optimizer(
generator=generate_sql_query,
evaluator=validate_sql_security_and_perf,
min_score=0.90,
max_revisions=3,
rubric="Check for SQL injection vulnerabilities and missing indexes"
)
final_query = await code_reviewer.run("Find top 10 customers by revenue last quarter")Scoped Tool Isolation (No Context Bloat)
Injecting 190+ MCP tools into an agent’s prompt degrades model reasoning and wastes tokens. isA_Agent_SDK enforces per-step tool bounding:
# Step 1: Read-only search (only gets web_search)
search_step = Workflow.step("search", tools=["web_search"])
# Step 2: Synthesis (zero external tools; pure reasoning)
# Passing tools=[] automatically enforces tool_choice="none"
synthesize_step = Workflow.step("synthesize", tools=[])
# Step 3: Transactional execution (only gets execute_trade with strict schema)
trade_step = Workflow.step("execute", tools=["execute_trade"])When tools=[], the underlying LLM client enforces tool_choice="none", preventing the model from hallucinating tool invocations or wasting context.
Unified Telemetry & Observability
Both isA_Agent_SDK and isa_maestro emit canonical, Draft-07 compliant telemetry events that stream directly to Web Console and Mobile:
| Event Type | Payload Attributes | Emitted When |
|---|---|---|
workflow.stage.start | run_id, stage_id, pattern, timestamp | A workflow stage begins execution |
workflow.stage.complete | run_id, stage_id, duration_ms, tokens_consumed | A stage finishes successfully |
workflow.evaluator.score | rubric, score, feedback, iteration | The judge evaluates generator output |
workflow.gate.reject | stage_id, gate_condition, rejected_payload | A gate predicate returns False |
Visual Workflows in isA Console & Mobile
- Web Console: The
WorkflowStageIndicatorrenders stage progression chips in real-time, whileEvaluatorScorecardvisualizes multi-criteria rubric evaluations. - Mobile Client: The
CascadingPrivacyRouterexecutes Tier-0 workflows directly on the device NPU/SLM, projecting deterministic micro-app cards via A2UI widgets.
When to Escalate to Swarms & Macro-DAGs
Use the simplest pattern that solves the problem:
┌─────────────────────────┬──────────────────────────────────────┐
│ Pattern │ When to Choose │
├─────────────────────────┼──────────────────────────────────────┤
│ Augmented LLM │ Simple Q&A, single-step tasks │
│ Micro-Workflow │ 80% of multi-step, predictable tasks │
│ Evaluator-Optimizer │ Code, SQL, high-stakes documents │
│ Subagents / Swarm │ Open-ended research, unknown path │
│ Maestro Macro-Workflow │ Multi-day ERP/CRM, human approval │
└─────────────────────────┴──────────────────────────────────────┘For long-running enterprise business processes across external engines (UiPath RPA, n8n), use isa_maestro which wraps these micro-workflows with persistent database state machines.
DAG Causality & OpenLineage Telemetry
Executing complex DAG pipelines across micro-agents requires continuous end-to-end provenance. If an intermediate step fails or produces corrupted data, diagnostic systems must be able to trace exactly which upstream tasks executed, what datasets were transformed, and what distributed traces correlate with each stage.
The DAG execution engine in isA_Orch (isa_orch.engine.runner.DAGExecutionEngine) integrates natively with OpenLineage and OpenTelemetry to emit standard causal facets during step progression.
Causality Emission Architecture
DAG Runner Lifecycle Hooks
The DAGExecutionEngine manages topological level execution and provides lifecycle hooks that automatically synchronize execution context:
from isa_orch.engine.runner import DAGExecutionEngine
from isa_orch.lineage.emitter import OpenLineageEventEmitter
# Initialize emitter
emitter = OpenLineageEventEmitter(
endpoint="http://isa-data:8084/api/v1/data/lineage/events/openlineage",
namespace="isa_production_pipelines",
producer="https://github.com/xenoISA/isA_Orch",
)
# Initialize engine with lineage hooks
engine = DAGExecutionEngine(
lineage_emitter=emitter,
on_step_start=lambda ctx: print(f"Step {ctx.step_id} starting with trace {ctx.trace_id}"),
on_step_complete=lambda ctx, res: print(f"Step {ctx.step_id} completed with status {res.status.value}"),
on_step_fail=lambda ctx, exc: print(f"Step {ctx.step_id} failed: {exc}"),
)on_step_start(StepRunContext): Injects or extracts the active OpenTelemetry span context, allocates a uniquerunId, and emits aSTARTRunEvent.on_step_complete(StepRunContext, StepExecutionResult): Emits aCOMPLETERunEvent with output dataset facets, execution duration, and token usage metrics.on_step_fail(StepRunContext, Exception): Emits aFAILRunEvent containing anerrorMessagefacet with exception details and stack traces.
OpenLineage OpenTelemetry Causality Facet (otel_causality)
The OpenLineageEventEmitter formats a custom otel_causality run facet on each event, establishing an unambiguous bridge between OpenLineage workflow runs and OpenTelemetry distributed traces:
{
"eventType": "COMPLETE",
"eventTime": "2026-11-30T06:20:00.124592Z",
"run": {
"runId": "d8213e24-9b51-419b-a78b-3729910a5192",
"facets": {
"otel_causality": {
"_producer": "https://github.com/xenoISA/isA_Orch",
"_schemaURL": "https://isa.enterprise.internal/spec/facets/otel_causality/1-0-0.json",
"trace_id": "4bf92f3577b34da6a3ce929d0e0e4736",
"span_id": "00f067aa0ba902b7",
"parent_span_id": "5fb397be34d23b0f",
"parent_span_ids": ["5fb397be34d23b0f", "a90184c0128e49d1"]
},
"parent": {
"_producer": "https://github.com/xenoISA/isA_Orch",
"_schemaURL": "https://openlineage.io/spec/facets/1-0-0/ParentRunFacet.json",
"run": {"runId": "91a0c7e2-4318-4e1a-829e-8c8120491823"},
"job": {"namespace": "isa_production_pipelines", "name": "e2e_reconciliation_dag"}
}
}
},
"job": {
"namespace": "isa_production_pipelines",
"name": "aggregate_daily_settlements_step"
},
"inputs": [
{
"namespace": "s3://isa-data-lake",
"name": "lake/telemetry/spans/year=2026/month=11/day=30"
}
],
"outputs": [
{
"namespace": "iceberg://warehouse",
"name": "finance.daily_settlement_ledger"
}
]
}Multi-Parent Convergence & Causality Tracking
In complex DAGs where a join step waits for multiple parallel branches to converge:
parent_span_id: Points to the primary sequential predecessor.parent_span_ids: Contains the full list of antecedent span IDs across all converging dependencies.
This enables RootCauseSwarm and CypherDiagnosticTool to trace branch convergence causality without losing multi-parent dependencies.