Data bank and data mapper concepts
The data bank is the set of values a plugin can use while it runs: slots the user gave, outputs from earlier steps, and facts about the user. A data mapper is the short YAML you write to pick values out of the data bank and build what the next step needs. Read this page first if you’re about to fill in an Input Mapping, Output Mapping, Strategy Mapping, Output Mapper or Body Mapping field.
What’s in the data bank?
Each part of a plugin has its own data bank. A value from one part reaches another only when you map it across. The data bank has two top-level keys, plus a few keys that exist only in one place.
Using a key outside the places listed causes a reference error. In an HTTP action, input arguments are referenced by name alone, such as title, not data.title.
meta_info.user in compound actions
A compound action has meta_info.user only when it’s started from a conversation. A compound action started by a schedule or a webhook has no conversational user, so resolve the user yourself and map it in.
Don’t give a slot and an output key the same name. Each key in a data bank should be unique, or the reasoning engine can confuse them.
What does a data mapper do?
A data mapper builds a new object. Each key is a field you want in the result, and each value is an expression that reads from the data bank:
This fragment builds an object with three fields: two from slots and one from the user’s profile. The $TRIM() call is a DSL function. DSL expressions can run inside any mapper value.
Use a data mapper when you need to:
- Keep types. Lists stay lists and numbers stay numbers. In a Mustache template they become text, which needs workarounds such as
$STRINGIFY_JSON(). - Reshape data. Rename, merge or conditionally include fields, pull nested values up, or build nested objects for an API.
- Loop and filter. Turn a list into another list with
MAP(),FILTER()orSORT(). - Keep less. An output mapping replaces the action’s result. Only the fields you map are kept: later steps and the reasoning engine see just those, and, for the last activity in a process, so does the user.
Where do you map data?
The same mapper syntax appears in every one of these fields. What changes is which data bank you read from and where the result goes.
In a compound action, a later step reads an earlier step’s output through its output_key:
Each surface’s own page covers its options: Activities, Resolver Strategies, Pass data to dynamic resolvers with Strategy Mapping, Return and Data Mapper in HTTP Actions.
Two rules that catch new builders
A bare value is a data bank reference. status: approved looks for a key named approved; it doesn’t send the text “approved”. Quote constants: status: '''approved''' for text and count: '5' for a number. The quoting table is in String constants in YAML.
An output mapping replaces the result. If you map title: response.title, later steps get only title. Every field you leave out is gone, so map everything the next step or the AI agent needs.
Data mapper, Mustache, DSL or a script?
Decision frameworks explains when a mapping gets too complex and a script is the better choice.
Test a mapper and look up syntax
- Test with sample data in the DSL and Data Mapper Playground before you add a mapper to a plugin.
- Copy a working pattern from Common DSL and Data Mapper patterns or Data Mapper common examples.
- Look up an operator such as
MAP()orCONDITIONAL()in the Data Mapper Reference, or a function such as$TRIM()in the DSL Reference. - Follow data across every boundary of a real plugin in Map data and context.