Skip to content

DSL Extensions

BLOGE's DSL is extensible. Beyond plain DAGs, provider-owned extension packages add higher-level orchestration constructs that compile back into the same runtime model. Three first class extensions ship today: sessions, state machines, and agents.

Each extension is discovered through the parser SPI (DslExtensionProvider), so the base bloge-dsl module stays small and you only pull in the syntax you actually use.

Sessions

bloge-session-ext adds a pure in-memory session / phase / round runtime for multi-turn, long-running conversational orchestration — the backbone of voice agents and customer-service flows.

bloge
session customerService {
  phase greet {
    round {
      node welcome : WelcomeOperator
    }
  }

  phase resolve {
    round {
      node classify : IntentOperator
      node answer   : AnswerOperator { depends_on = [classify] }
    }
  }

  phase wrapUp {
    round {
      node summarize : SummaryOperator
    }
  }
}
  • phase groups the stages of a conversation (greet → resolve → wrap-up).
  • round is one turn of interaction inside a phase.
  • Durable persistence is provided by bloge-session-durable, which maps session snapshots onto the durable execution / checkpoint stores and owns recovery + graph-hash migrations.

State machines

bloge-state-ext adds a provider-owned state_machine syntax with an event-driven runtime.

bloge
state_machine orderLifecycle {
  initial = created

  state created {
    on placed -> paid
  }

  state paid {
    on shipped   -> fulfilled
    on cancelled -> refunding
  }

  state fulfilled { final }
  state refunding {
    on refunded -> cancelled
  }
  state cancelled { final }
}

Durable state-machine flows run on the generic execution / checkpoint persistence stack via bloge-state-durable.

Cross-extension composition

Sessions and state machines compose. A session phase can embed a state_machine block, and a state_machine state can embed a session block — so a long-running flow can switch between conversational phases and event-driven states without leaving BLOGE.

bloge
session support {
  phase triage {
    state_machine escalation {
      initial = bot
      state bot   { on handoff -> human }
      state human { final }
    }
  }
}

Agents

bloge-agent-ext adds a first-class agent DSL with declarative tool bindings, exit conditions, and pluggable memory strategies backed by AgentLoopOperator. See the dedicated AI Agents & LLM Operators guide for the full agent surface.

bloge
agent customerSupport {
  model        = "gpt-4o"
  max_turns    = 6
  memory       = sliding_window(20)

  tool searchKnowledgeBase : KBSearchOperator {
    description = "Search the knowledge base for a relevant article"
    input { query = tool_args.query }
  }

  exit_condition = finish_reason == "stop" || tool_call("escalateToHuman")
}

How extensions stay clean

  • Each extension owns its syntax, semantic compiler, and nested operator factory.
  • The base DSL never hard-codes extension grammar — providers register through the SPI.
  • Everything compiles down to standard BLOGE runtime models, so execution, resilience, and durability all work the same way regardless of which extension authored the nodes.

Next steps