Create an AI Block
Add an AI block to a pipeline, then describe the job in YAML.- summarize reports, logs, feedback, or operational data
- extract structured fields from text
- classify rows or events into business categories
- generate code or SQL for a controlled workflow
- turn upstream block outputs into plain-language recommendations
- automate a decision step before the next pipeline block runs
Use an Agent Block
Create an Agent block when you want a Mage Pro pipeline step to run through Mage Pro AI Sidekick. Agent blocks are useful when the block should understand pipeline context, inspect upstream block outputs, and produce a final answer with the same project awareness users expect from Sidekick.agent and are saved as YAML under the agents/ folder. New Agent block YAML does not need a top-level type: agent field; existing AI blocks that already use YAML type: agent still run for compatibility. Agent blocks run as part of the pipeline and return the final Sidekick answer as the block output. While Sidekick works, Mage prints progress and streamed response events to the block logs so users can see that the agent is running.
Use Agent blocks when the task benefits from pipeline context:
- “Read the upstream customer output and explain the highest churn risk.”
- “Review this pipeline run’s logs and summarize what failed.”
- “Compare the two upstream datasets and write a short executive summary.”
- “Use the runtime variables and upstream rows to draft a customer follow-up.”
Fields
prompt and instructions
The main instruction for a standard AI block is prompt. YAML-backed Agents use instructions for the saved default prompt stored in the agents/ folder. Keep either field clear and specific. Multi-line prompts are easier to read and maintain.
message
An optional user-style request for type: agent blocks. Use instructions for saved standing instructions on YAML-backed Agents, or prompt on standalone AI blocks, and use message for the specific request to answer on this run.
settings
Controls how the AI runtime should behave. For agent blocks, speed: fast is a good default when you want a quick operational answer.
runtime
Optional context that travels with the block run. Use it for business labels, report names, or request metadata that helps the AI understand the job.
output
Use output when you need the response to follow a predictable shape or control agent block logs.
For Agent blocks, output.level controls how much Sidekick runtime output Mage prints while the block runs:
default: print streamed answer, narration/status, tool call, and error events.all: print every runtime event, including completion and other low-level events.none: do not print Sidekick runtime output; the final answer still becomes the block output.
format when a non-agent AI block should return structured data.
validation
Use validation when the answer has to meet a business rule before it moves downstream.
tools
Use tools when a standard AI block should choose and trigger another pipeline as part of the workflow.
Upstream Data
AI and Agent blocks can sit downstream of regular Mage blocks. For Agent blocks, Sidekick receives references to upstream block outputs and can inspect those outputs through Mage instead of copying raw datasets into the prompt.Examples
Minimal Summary
Structured Extraction
Agent Block With Upstream Outputs
Agent Block With No Message
Best Practices
- Give the block one clear job.
- Put reusable instructions in
instructionsfor YAML-backed Agents orpromptfor standalone AI blocks. - Put the run-specific ask in
messagefor Agent blocks. - Use upstream blocks for data and the AI block for interpretation.
- Use structured output when downstream blocks need predictable fields.
- Keep runtime context business-focused, such as segment, audience, or report name.
- Use Agent blocks when project context or upstream block output matters.