Liman
Specification

Internal Types

Internal types used in the system.

BaseNode

BaseNode is a base type for all nodes in the system: LLMNode, ToolNode, or Node. If you see this type in a specification, it means the node can be any of these types.

Edge

An Edge defines a connection from one node to another. Edges live in the node's to field and are followed after the node produces its output.

to:
  - ref: Kind/name
  - ref: Kind/name
    when: LimanCE | FunctionRef

A plain string entry is a shorthand for ref.

PropTypeDefault
ref
string
-
when?
LimanCE | FunctionRef
-

The nodes and llm_nodes fields are supported as an alternative form. Bare names in them get the kind from the field itself: nodes targets Node, llm_nodes targets LLMNode. A spec cannot use to together with nodes or llm_nodes - this is a validation error.

LimanCE

LimanCE is a DSL CE (Condition Expression) that is used to determine whether an edge should be followed, based on the current context or state. It is typically a string that uses a simple domain-specific language (DSL) to reference variables, node outputs, or builtin functions.

Builtin Functions

These functions provide access to common operations and context information within LimanCE conditions.

  • $is_error(error_type?: string, ...)
    Checks if the current execution context contains any active error. Returns True if an error is present, False otherwise. Can optionally check for a specific error type (e.g., UnauthorizedError) or multiple error types.
  • $now()
    Returns the current UTC timestamp.
    Example: $now() > some_variable_timestamp

Example

(value == true && another_value != 1) || $is_error(UnauthorizedError);

BNF

<liman-ce> ::= <term> (("&&" | "and" | "||" | "or") <term>)*

<term> ::= <factor> (("==" | "!=" | ">" | "<" | ">=" | "<=" | "in" | "not in") <factor>)*
         | ("!" | "not") <term>
         | "(" <expression> ")"

<factor> ::= <literal> | <variable> | <function_call>

<literal> ::= <string> | <number> | "true" | "false" | "null"

<variable> ::= IDENTIFIER ("." IDENTIFIER)*

<function_call> ::= BUILTIN_IDENTIFIER "(" [<arg_list>] ")"

<arg_list> ::= <variable> ("," <variable>)*

(* --- Token Definitions --- *)
(* IDENTIFIER: A standard variable name, e.g., 'user', 'role'. *)
(* BUILTIN_IDENTIFIER: A function name prefixed with '$', e.g., '$is_error', '$now'. *)

FunctionRef

FunctionRef is a reference to a function that can be called when the edge is followed. It is typically a string that represents the path to the function, such as module.path.to.method. The function should return a boolean value indicating whether the edge should be followed.

InlinedType

Some types can be declared inline, meaning they can be defined directly within a parent node instead of as separate, standalone declarations. This is useful for simple configurations or when you want to keep related declarations together.

When a type is inlined, the system automatically generates a unique name using the pattern {parent_name}__inlined__{id}_{type_name}. The inlined object is only accessible within its parent declaration and cannot be referenced globally through the Registry.

Example

Instead of creating a separate ServiceAccount declaration, you can inline it directly within a node:

kind: LLMNode
node: StartNode
---
auth:
  service_account:
    credentials_provider: CredentialsProvider

This would create a ServiceAccount similar to:

kind: ServiceAccount
name: LLMNode:StartNode__inlined_{id}_ServiceAccount
credentials_provider: CredentialsProvider

The generated ServiceAccount exists only within the scope of the LLMNode and cannot be referenced by other nodes or accessed through the global Registry.

LanguageBundle

LanguageBundle is a string or dictionary with localization support for text. It uses language codes as keys at any depth. Any text without a language code is considered default language text. You can use {template_variable} syntax within the text.

prompts:
  system:
    en: You are a helpful assistant.
    ru: Ты полезный помощник.
  notes:
    en: |
      Notes: {notes}
    de: |
      Notizen: {notes}

This would be converted to the following if en is the fallback and default language:

prompts:
  en:
    system: You are a helpful assistant.
    notes: |
      Notes: {notes}
  ru:
    system: Ты полезный помощник.
    notes: |
      Notes: {notes}
  ru:
    system: You are a helpful assistant.
    notes: |
      Notizen: {notes}

Last updated on