Jido.Composer (Jido Composer v0.4.0)

Copy Markdown View Source

Composable agent topologies for the Jido ecosystem.

Two patterns that nest arbitrarily: Workflow (deterministic FSM) and Orchestrator (LLM-driven ReAct loop). Both produce Jido.Agent modules sharing a uniform Node interface (context → context). Human-in-the-loop gates and durable checkpoint/resume are first-class.

Quick Start — Workflow

defmodule MyPipeline do
  use Jido.Composer.Workflow,
    name: "pipeline",
    nodes: %{
      fetch:     FetchAction,
      transform: TransformAction,
      store:     StoreAction
    },
    transitions: %{
      {:fetch, :ok}      => :transform,
      {:transform, :ok}  => :store,
      {:store, :ok}      => :done,
      {:_, :error}       => :failed
    },
    initial: :fetch
end

agent = MyPipeline.new()
{:ok, result} = MyPipeline.run_sync(agent, %{url: "https://example.com"})

Quick Start — Orchestrator

defmodule MyAssistant do
  use Jido.Composer.Orchestrator,
    name: "assistant",
    model: "anthropic:claude-sonnet-4-20250514",
    nodes: [SearchAction, WriteAction],
    system_prompt: "You help with research and writing."
end

agent = MyAssistant.new()
{:ok, _agent, answer} = MyAssistant.query_sync(agent, "Summarize recent news")

Quick Start — Composition

Orchestrators and workflows are both agents, so they nest naturally:

defmodule EditorialReview do
  use Jido.Composer.Orchestrator,
    name: "editorial_review",
    model: "anthropic:claude-sonnet-4-20250514",
    nodes: [GrammarCheckAction, FactCheckAction],
    system_prompt: "Review content for grammar and facts."
end

defmodule PublishingPipeline do
  use Jido.Composer.Workflow,
    name: "publishing",
    nodes: %{
      fetch:   FetchAction,
      review:  EditorialReview,  # orchestrator as a workflow step
      publish: PublishAction
    },
    transitions: %{
      {:fetch, :ok}    => :review,
      {:review, :ok}   => :publish,
      {:publish, :ok}  => :done,
      {:_, :error}     => :failed
    },
    initial: :fetch
end

The DSL detects EditorialReview is an agent and wraps it as an AgentNode automatically.

Control Spectrum

LevelPatternExample
Fully deterministicWorkflowETL pipeline
+ human gateWorkflow + HumanNodeApproval workflows
+ adaptive stepWorkflow containing OrchestratorCode review pipeline
+ deterministic toolOrchestrator containing WorkflowCustomer support
Fully adaptiveOrchestratorResearch agent

Module Organization

ModulePurpose
Jido.Composer.WorkflowDeterministic FSM workflow DSL
Jido.Composer.OrchestratorLLM-driven orchestrator DSL
Jido.Composer.NodeUniform context -> context behaviour
Jido.Composer.Node.ActionNodeWraps a Jido.Action as a node
Jido.Composer.Node.AgentNodeWraps a Jido.Agent as a node
Jido.Composer.Node.FanOutNodeParallel branch execution
Jido.Composer.Node.HumanNodeHuman approval gate
Jido.Composer.ContextLayered context (ambient/working/fork)
Jido.Composer.NodeIOTyped output envelope
Jido.Composer.SuspensionGeneralized pause/resume metadata
Jido.Composer.ResumeResume suspended agents
Jido.Composer.CheckpointPersistence for long-running flows

Guides