- they provide protection at the insert time for the current agent version. You’re sure incorrect data won’t be inserted.
- we’re using schemas for matching items. For example, withotu providing the schema AgentView can’t know which
displayComponentbelongs to which item
Input and Output
Here’s an example of how you can define input and output schemas for your agent:Steps
Items between input and output are called “steps”. By default they’re not validated against any schema. If you want to enabled validation setvalidateSteps flag to true:
Tool calls
Tool calls are pretty special in a sense that there always come in pairs. There’s a tool call item and tool result items, usually related to each other by tool call id. AgentView allows to represent this in the schema:.meta({ callId: true }) marks the field as a tool call id.
Tool call step defined provides a bunch of validations.
- only one tool call with a given call id is allowed
- there might be only one tool result for this id, must be in the same run, and must go after the tool call
Loose validation
Whenever you define the schema asz.object, any field that is not defined in the schema won’t be saved.
Let’s look at this schema:
z.looseObject:
Multiple runs
Your agent can have multiple run definitions. Each run goes with its own input, output and step schemas. Here’s how AgentView does the matching:- Whenever you add or update the run, AgentView first matches the run input item against all the available run definitions in the config, to find the run.
- If it finds a match, it will use the found run schemas to validate the rest of the items in the run.