Definition

Declarative compatibility measures the ease with which a framework can be targeted by external "workflow generators" (visual designers, compilers, or LLM-driven architects).


Compilability by Framework

1. LangGraph (High Compatibility)

LangGraph is the primary target for declarative compilers because its execution model (StateGraph) is a 1:1 mapping of the Directed Graph primitive.

  • Mechanism: A JSON schema of nodes and edges can be programmatically iterated to call .add_node() and .add_edge().
  • Tooling: LangGraph Studio and various "Visual-to-Code" compilers target this framework specifically.

2. LangChain LCEL (Moderate Compatibility)

LCEL is optimized for Functional Composition (|), which maps well to linear pipelines but poorly to complex, stateful branching.

  • Constraint: Representing loops or conditional multi-path logic in a declarative-to-LCEL compiler requires significant "glue code."

3. Pi Mono (High Compatibility / Low Abstraction)

Pi Mono is highly compatible with declarative models because it treats the Agent Loop as a raw primitive.

  • Advantage: Provides the most "honest" mapping for custom execution engines generated by tools.

The "Glue" Layer: Standards & Interoperability

Translating a generative workflow description into a target framework requires a "Glue" layer—standards and libraries that act as the intermediate representation (IR).

1. Declarative Standards (The IR)

  • BPMN 2.0 / CMMN: Industry standards for business processes. Target: LangGraph.
  • JSON Agents (PAM): Vendor-agnostic schema for agent identity and graphs. Target: Pi Mono.
  • Serverless Workflow (CNCF): JSON/YAML standard for microservices. Target: LangChain (LCEL).

2. "Glue" Libraries & Frameworks

  • Kestra (Open Source Orchestration): Acts as the "Body" (durable execution) to the agent's "Brain" (reasoning).
  • XState: State machine library used to enforce deterministic control over agentic transitions.
  • Model Context Protocol (MCP): Standardizes the Tool Schema for universal tool/data interoperability.

End-to-End Technical Pipelines

1. XML-to-Graph Compilation (BPMN → Kestra → LangGraph)

  • Format: BPMN 2.0 XML source.
  • Compiler: BPMN-to-YAML Transpiler maps XML <serviceTask> to Kestra HTTP tasks.
  • Runtime: LangGraph FastAPI endpoint executes the cyclic loop and returns a JSON-RPC response.

2. Manifest-Driven Constraint Enforcement (PAM → XState → Pi Mono)

  • Format: JSON Agents (PAM) manifest.
  • Compiler: XState Factory generating createMachine() configs.
  • Runtime: Pi Mono event loop gated by an XState ALLOW_ACTION middleware.