Skip to main content
This page documents the ABL type system, lookup tables for reference-based validation, and attachment handling for file and media uploads.

Data Types

ABL has a type system used for variable declarations, gather field types, tool parameter signatures, and runtime validation. Types are divided into primitives and complex types.

Primitive types

Primitive types represent single scalar values.

String

Strings are the most common type in ABL. They are used for text input, identifiers, messages, and any unstructured data.

Number

Numbers represent all numeric values, including integers and floating-point numbers. ABL does not distinguish between integer and float types.

Boolean

Booleans represent true/false values. In conditions, the following values are treated as falsy: false, 0, "", "false", null, undefined, empty arrays, and empty objects. Everything else is truthy.

Date

Dates represent calendar dates without a time component. They are stored as ISO 8601 date strings (YYYY-MM-DD).

Datetime

Datetimes include both date and time with timezone information. They are stored as ISO 8601 datetime strings.

Complex types

Complex types represent structured or composite values.

array<T>

An ordered collection of elements, optionally typed by item type.
In memory declarations:
Array type definition (IR)

object <{...}>

A structured record with named, typed fields.
In tool return types:
Object type definition (IR)

enum<[…]>

A constrained set of allowed string values.
Enum type definition (IR)

union<[…]>

A value that can be one of several types. Useful for fields that accept different formats.
Union type definition (IR)

nullable<T>

Wraps another type to indicate it can also be null.
Nullable type definition (IR)

Type definitions in ABL contexts

Variable declarations

In MEMORY: session and persistent variable declarations, use the TYPE property:

Gather fields

Gather fields use the type property with primitive type names:

Tool parameters

Tool parameters declare types inline in the signature:
Supported parameter types:

Tool return types

Tool return types use object literal notation with field names and types:
The ToolReturn structure supports nested objects and arrays:

Variable sources

Variables in ABL have a source that indicates their origin:

Type coercion at runtime

The runtime applies type coercion in these contexts: For detailed coercion rules in expression evaluation, see Expressions & functions — Type coercion rules.

Complete TypeDefinition reference

The full TypeDefinition type is a union of primitive type names and complex type objects:
TypeDefinition is the structural type algebra used for MEMORY: variables and tool signatures. GATHER fields and ENTITIES: entries use a broader entity type set that additionally includes text, free_text, integer, float, currency, email, phone, enum, pattern, and location. Those extra type names are not part of TypeDefinition.

Lookup Tables

Lookup tables provide reference-based validation for gather fields and expressions. They define sets of valid values that the runtime uses to validate user input, suggest corrections, and perform fuzzy matching. The LOOKUP_TABLES: block declares named tables with their data source and matching configuration.

Overview

ABL supports three lookup table sources:
  • Inline — static values defined directly in the ABL file.
  • Collection — values stored in a tenant-scoped database collection.
  • API — values fetched from an external HTTP endpoint.

Inline lookup tables

Inline tables define their values directly in the ABL file. Use them for small, stable reference sets.

Syntax

When to use inline tables

  • The value set is small (fewer than ~100 entries).
  • The values rarely change.
  • No external dependency is acceptable.

Collection lookup tables

Collection tables read values from a tenant-scoped database collection. The platform resolves the table_name to the correct storage location based on the current tenant.

Syntax

When to use collection tables

  • The value set is large or changes frequently.
  • Values are managed through an admin interface or data pipeline.
  • Different tenants have different valid values.

API lookup tables

API tables fetch values from an external HTTP endpoint at runtime. The response is expected to contain an array of objects; the field property specifies which object field to match against.

Syntax

When to use API tables

  • Values come from a third-party system that maintains its own data.
  • Real-time accuracy is important (for example, live exchange rates, inventory).
  • The dataset is too large to store locally.

Lookup table properties

Table names must match ^[a-z_][a-z0-9_]*$ and field names ^[a-zA-Z_][a-zA-Z0-9_.]*$. A small inline map table can also be written in shorthand: my_table: { key1: value1, key2: value2 }.

Fuzzy matching

When fuzzy_match: true, the runtime uses string similarity algorithms to find the closest match when an exact match is not found. This handles typos, abbreviations, and minor variations.

Similarity threshold

The fuzzy_threshold controls how similar a user’s input must be to a valid value for the match to be accepted:

Example: fuzzy matching for airport codes

With this configuration:
  • "jfk" matches JFK (case-insensitive exact match).
  • "SFP" matches SFO (fuzzy match, 1 character difference).
  • "XYZ" doesn’t match any value (below threshold).

Field mapping

The field property specifies which field in the data source to match with. For collection and API sources, the data is typically an array of objects. The field tells the runtime which property to compare:
User input is matched with the code field of each object in the response.

Using lookup tables

A GATHER field references a lookup table through its semantics.lookup metadata, which names the table used to validate and normalize the collected value (applying the table’s case-sensitivity, fuzzy matching, and threshold):
Tool parameters can source a value from a lookup table via SOURCE: lookup(<table>) in a .tools.abl parameter block (see Tools); this resolves to a {{lookup:<table>:<key>}} value at runtime.

Timeout and error handling

For API-sourced tables, specify a timeout_ms to control how long the runtime waits for the external service:
If the API call times out or returns an error, the runtime:
  1. Logs a warning.
  2. Falls back to accepting the user’s input without validation.
  3. Emits a trace event indicating the lookup failure.

Attachments

Attachments define file and media upload fields that the agent collects from the user. The ATTACHMENTS: block declares named attachment fields with their content category, processing options, and validation constraints. Attachments work alongside GATHER fields to collect structured data through conversation.

Overview

ABL supports four attachment categories, each with specialized processing capabilities:

Attachment field properties

The DSL keyword for the MIME allowlist is allowed_types (it populates the field’s allowed MIME types). allowed_mime_types is not recognized by the .agent.abl parser.

Document attachments

Document attachments handle file uploads such as PDFs, Word documents, spreadsheets, and plain text files. When OCR is enabled, the runtime extracts text content from the uploaded document and makes it available in the session context.

Common document MIME types

Image attachments

Image attachments handle photo and screenshot uploads. OCR extracts text from images (useful for scanned documents, receipts, and ID cards).

Common image MIME types

Audio attachments

Audio attachments handle voice recordings and audio messages. When transcription is enabled, the runtime converts the audio to text.

Common audio MIME types

Video attachments

Video attachments handle video file uploads. Two processing features are available:
  • Transcription extracts speech from the video’s audio track.
  • Keyframe extraction captures representative frames from the video for visual analysis.

Common video MIME types

OCR processing

When ocr_enabled: true, the runtime processes uploaded documents and images through an OCR pipeline that:
  1. Detects text regions in the file.
  2. Extracts text content.
  3. Stores the extracted text in the session context under the attachment field name.
The extracted text is accessible in expressions and template strings:

Transcription processing

When transcription_enabled: true, the runtime processes audio and video files through a transcription pipeline:
  1. Extracts the audio track (for video files).
  2. Runs speech-to-text transcription.
  3. Stores the transcript in the session context.

Keyframe extraction

When key_frame_extraction: true, the runtime extracts representative frames from video files:
  1. Analyzes the video for scene changes.
  2. Captures keyframes at scene boundaries.
  3. Stores the keyframes as an array of image references.

File size and MIME type validation

The runtime validates uploaded files against the declared constraints before processing:
  • If the file exceeds max_file_size_mb, the upload is rejected with an error message.
  • If the file’s MIME type is not in allowed_types, the upload is rejected.
  • If allowed_types is omitted, all standard MIME types for the category are accepted.

Complete attachment example


  • Expressions & functions — type coercion in expressions and built-in type-checking functions
  • Memory & Constraints — TYPE declarations in session and persistent variables, attachment data in session
  • GATHER — gather field types and lookup-based validation
  • NLU — entity extraction that may reference lookup tables