Skip to main content

Module language

Module language 

Source
Expand description

Expressive language (.rag) — the declarative blueprint surface of the recursive runtime.

In TinyAgents’ recursive architecture, a model can author the very workflow it is standing inside. .rag is the safe boundary for that self-authoring: a capability-by-name blueprint format that lowers into the exact same crate::graph and crate::harness runtime as hand-written Rust, yet can only reference capabilities — never define or execute code — so an agent-emitted plan is parsed, validated, and bound against a registry before it ever runs.

The expressive language is a compact, side-effect-free way to describe an agent graph: its state channels, nodes, routes, and capability references. It compiles into the same crate::graph and crate::harness structures as hand-written Rust through a fixed pipeline:

source -> lexer -> tokens -> parser -> AST -> compiler -> Blueprint

The language deliberately cannot embed arbitrary code; it only references capabilities (models, tools, routers) by name, which the compiler binds and validates against a registry. This makes it the safe boundary for agent-authored graph plans.

Submodules:

  • ast — source AST node types produced by the parser.
  • span — byte+line/column source spans with merge.
  • source — source files and the source map that resolve offsets to line/column and slice snippets.
  • diagnostic — structured diagnostic::Diagnostics and the caret renderer.
  • types — token and AST type definitions plus the compiled types::Blueprint.
  • lexer — source text into tokens with source spans.
  • parser — tokens into a validated AST.
  • resolver — registry-backed binding of every reference in a plan, producing spanned diagnostics for unknown/disallowed capabilities.
  • compiler — AST lowering into a types::Blueprint, with an optional provenance-tagging path (compiler::compile_with_provenance).
  • diff — structured, human-readable diffs of two blueprints (diff::blueprint_diff), backing generated-workflow review.
  • testkit — deterministic helpers to compile source to a blueprint and assert on it.

Re-exports§

pub use diagnostic::Diagnostic;
pub use diagnostic::Label;
pub use diagnostic::Severity;
pub use diff::BlueprintDiff;
pub use diff::ChannelDiff;
pub use diff::FieldChange;
pub use diff::NodeDiff;
pub use diff::blueprint_diff;
pub use resolver::Resolver;
pub use resolver::resolve_source;
pub use source::SourceFile;
pub use source::SourceId;
pub use source::SourceMap;
pub use span::Span;
pub use types::*;

Modules§

ast
Source AST for the expressive language (.rag).
capability_resolver
Capability binding: resolves and validates every capability reference (model/tool/subgraph/router/reducer/agent/script) a Blueprint makes against an allowlist, so declarative .rag source can only reach capabilities Rust has already registered and allowed.
compiler
Compiler: lowers a Program AST into validated Blueprints and wires a blueprint into a durable runtime graph.
diagnostic
Structured diagnostics for the .rag language and a source-aware renderer.
diff
Structured, human-readable diffs of two compiled Blueprints.
lexer
Lexer: turns .rag source text into a stream of SpannedTokens.
parser
Parser: turns a SpannedToken stream into a Program AST.
resolver
Registry-backed reference resolution for the expressive language (.rag).
source
Source files and the source map: the substrate diagnostics render against.
span
Source spans: a byte range plus a 1-based line/column anchor.
testkit
Deterministic helpers for compiling .rag source to a Blueprint and asserting on the result.
types
Token and AST types for the expressive language, plus the compiled Blueprint artifact.