Typed inputs and outputs
Agents in AEL, the Agent Engineering Language, take typed inputs and return typed outputs, with your own input builders and output checks and a choice of raw or typed results. They take and produce text, structured data, images, audio, files and video frames, and process live camera or sensor streams with bounded buffers and backpressure.
Inputs
The parameters of an agent or a node are its inputs. You write them with ordinary types:
# nodes/review.node.ael
struct ReviewRequest {
document: Str<4000>,
strict: bool,
max_findings: u16,
locale: Option<Str<16>>,
}
node review(request: ReviewRequest) -> Review {
config {
prompt: file("prompts/review.md");
model: binding("primary_model");
}
return write_review(request);
}
- Every input has a maximum size: text and lists have a fixed capacity, written in their type.
- A missing optional value,
Option::None, is different from a value that is present. - An unknown field, a value out of range, text that is too long or invalid, and a wrong enum variant are errors that name the field they concern.
- The same decoding and the same checks apply wherever the input comes from: the console, an HTTP route or another agent. JSON gives the rules for input that arrives as JSON.
Input builders and input checks
- An input check is a helper function that accepts or rejects a typed input before any work starts, with a typed error.
- An input builder is a helper function that turns a typed input into what the model receives. The result may be text, or other parts such as images, audio or files when the model accepts them.
Structured input needs no special prompt field: the input builder decides what the model sees. The size of the model's input is checked before the call is sent.
Outputs
A model's answer becomes a typed output only through these steps, in this order:
- receive the answer, within a size limit;
- decode it into the node's output type;
- check its structure: every field present, every value in range;
- run your output checks, in the order you declare;
- apply your transformation, if you declare one;
- check the structure again;
- accept it, or apply your failure policy.
A result that fails a step never becomes a typed value. An answer that was cut off, or a stream that ended early, never counts as complete. The output type is the authority: AEL checks it even if the prompt already asks for the right shape. Budgets, retries and validation describes output checks and repairs.
Raw or typed results
A node can take the model's raw output instead and parse it with your own code. In that mode the answer has a raw output type, not your application type: raw text is never presented as a checked value. What your parser returns goes through the structural check before it becomes typed.
Several inputs
A node or agent can take several inputs that arrive together, separately or continuously. When it takes more than one, it chooses how they are combined:
| Rule | Meaning |
|---|---|
| All | Wait until every required input has arrived. |
| Any | Handle each input as it arrives. |
| Keyed | Combine inputs that share a key, within an expiry. |
| Window | Combine the inputs that arrive within a time window. |
| Latest | Use the most recent value, if it is fresh enough. |
There is no default: a node with several inputs has to choose, so it never combines a stale camera frame with a new reading by accident. An observation older than its declared freshness is refused.
Media and files
Text, structured data and media are separate kinds of input part:
- Images, audio, files and video frames travel as references to stored data, not as text inside a message. A reference records the content type, the size, a fingerprint, an expiry and where the data came from.
- Access is checked every time a reference is used, against the run's tenant and permissions.
- The content type, size, dimensions, duration and sample rate are checked against what the input declares, before the data is decoded.
- Your own steps can prepare media, such as extracting the text of a document, transcribing audio or sampling video frames, and they keep a record of where each result came from.
A model endpoint accepts only some kinds of media; a kind it cannot take is an error before the call. See Models and providers.
Streams
A stream is a bounded sequence of typed chunks, such as a live camera or sensor feed.
- A stream declares its limits: chunk size, buffered bytes, rate, duration and freshness.
- Backpressure slows the sender when the receiver is behind. When the buffer is full, the stream follows its declared policy: reject, drop the oldest, drop the newest, or pause the source when it can be paused.
- Chunks carry timestamps and sequence numbers; duplicates and stale chunks are rejected or discarded by a declared rule.
- A stream ends with an explicit completion, error or cancellation.
Limits
- Every input, output, reference and stream has a fixed maximum size. Nothing grows without bound.
- Large media always travel as references, never inside a message.
- On the smallest boards, agents take compact observations, such as samples or detected features, rather than raw video.
The JSON Schemas of these formats are listed under Agent inputs and outputs.