An architectural pattern for AI agents

DSL-mediated Agents

DSL-mediated Agents are AI agents that read and write documents in a well-defined domain-specific language (DSL) rather than free-form text, so that their work can be formally validated, reviewed by human experts, turned into artifacts by deterministic generators, or passed cleanly to downstream agents.

Read the definition (DOI) Download PDF GitHub

The problem

AI agents reason non-deterministically and usually communicate in free-form text or loosely structured output. Their work can be hard to check, review, reproduce, and hand to the next agent or tool.

The idea

Give the agent a precise language to work in. Its reasoning is still non-deterministic, but its output lands in a form that machines can check and experts can read, review, and approve in the domain's own terms.

The pattern

Agents propose changes in the DSL. Machines check encoded rules; experts assess intended meaning.

Requirements and existing DSL documents Agent Proposed DSL document Validator Domain-expert review Validated, approved DSL document Deterministic generators Downstream agents Deliverables Passes encoded rulesApproved Diagnostics:revise proposal Revisionrequested
  1. A well-defined domain language. A DSL with explicit grammar and semantics, designed for the domain rather than for general programming.
  2. Agents that read and write DSL documents. Inputs may include natural-language requirements, but results are not communicated only as free-form text.
  3. Formal validation. Parsers, type checks, and constraint checkers verify every agent-produced document. Passing establishes conformance to encoded rules, not that the document meets the intended requirements.
  4. Human review where appropriate. The DSL is designed for domain experts to read and assess directly, in language workbenches, IDEs, or web editors.
  5. Deterministic downstream processing. Transformations, compilers, and generators turn validated documents into deliverables, producing the consistent outputs from the same declared inputs.

Worked example: a laboratory protocol

Illustrative only. The notation, volumes, limits, and reagents are invented to show the pattern. They are not intended to reflect real laboratory practice or any real equipment.

Request: Make a six-point two-fold dilution series of sample S1 in a 96-well plate, add the developing reagent, incubate for 15 minutes at 37 C, and read absorbance at 450 nm.

What it is not

Not a language for governing agents

DSLs can also be defined that constrain what an agent may do. Those languages guard the agent. Here, the DSL is what the agent writes: a document describing the domain itself.

Not just structured output

Valid JSON or schema conformance is not enough. The language must express domain concepts with explicit semantics and rules, in a notation experts can read, review, and edit directly.

Not agents writing arbitrary general-purpose code

Code can be a downstream product of the process, but it is not the shared medium.

Get involved

Open questions

  • How should a DSL be designed so agents can use it reliably?
  • What is the right division of labor between agent, validator, and human reviewer?
  • How should DSLs evolve safely when agents propose extensions to the language?
  • How do you measure whether such a system is more reliable than a free-form one?

Join the conversation

Examples, critiques, and related work are welcome.

GitHub Discussions

Email:

Use the term

"DSL-mediated Agents" is free for anyone to use, with no permission needed. Hashtag: #DSLMediatedAgents. A reference back to this page is appreciated.

Cite

Steve Livengood. "DSL-mediated Agents: A Definition." 2026. https://doi.org/10.5281/zenodo.23587494

@misc{livengood2026dslmediated,
  author    = {Livengood, Steve},
  title     = {{DSL-mediated Agents: A Definition}},
  year      = {2026},
  month     = oct,
  publisher = {Zenodo},
  doi       = {10.5281/zenodo.23587494},
  url       = {https://doi.org/10.5281/zenodo.23587494}
}

About

Steve Livengood has spent 40+ years in software architecture, with deep roots in model-driven engineering, DSL design, and developer tooling. LinkedIn · GitHub