# Mastra Agents
Agents are [[Mastra AI]]'s core primitive: LLM-powered systems that autonomously solve open-ended problems through multi-step reasoning. An agent decides which [[Mastra Tools|tools]] to invoke, maintains [[Mastra Memory|memory]] across turns, and iterates internally until it reaches a conclusion. They suit flexible, exploratory tasks where the steps can't be predetermined, the counterpart to deterministic [[Mastra Workflows|workflows]].
## Key aspects
- Built with instructions, a model, tools, and optional memory
- Multi-step reasoning loop with tool calling
- Structured output: agents can return typed objects matching a schema (Zod, Valibot, ArkType, JSON Schema) instead of plain text
- Processors and guardrails can intercept input/output for validation, PII redaction, moderation, and cost control
- Per-request customization via request context (user tier, locale, A/B variants)
## References
- https://mastra.ai/docs/agents/overview
- https://mastra.ai/docs/agents/structured-output
## Related
- [[Mastra AI]]
- [[Mastra Workflows]]
- [[Mastra Tools]]
- [[Mastra Memory]]
- [[Mastra Harness]]
- [[AI Agents]]