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 such node in the specification, it means that the node can be any of these types.

Edge

An Edge allows you to define a connection between nodes using a DSL condition

when: LimanCE | FunctionRef
target: BaseNode | BaseNode[]
id: Optional[ID]
depends: Optional[ID | ID[]]
PropTypeDefault
when
LimanCE | FunctionRef
-
target
BaseNode | BaseNode[]
-
id?
EdgeID
-
depends?
EdgeID | EdgeID[]
-

EdgeID

Any string or number that is used to identify an edge in the node. It must be unique within the same parent node.

<edge-id> ::= <string> | <number>

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.

LanguageBundle

LanguageBundle is string or dict with text supported localization It uses language codes as keys on any depth any text without the language code is considered as a default language text It's possible to use {template_variable} syntax there

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

would be converted to 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}