Agent Integration Guide
This guide walks through adding Masar to an LLM-based agent. By the end, your agent will plan before acting, verify after generating, and build memory from every task.
1. Install the SDK
2. Create Masar Tools
Wrap Masar endpoints as tools your agent can call:
3. Add Tools to Your Agent
4. The Agent Workflow
A well-structured agent follows four phases:
Recall: Check memory for similar past tasks. If a pattern exists, use it to skip planning.
Plan: Ask Masar for dependency-ordered instructions. The agent receives concrete steps instead of guessing.
Execute + Verify: The LLM generates output for each instruction. After each step (or at the end), verify the result. If verification fails, use the repair endpoint.
Store: Save the completed episode so future runs benefit from this experience.
5. Example Agent Run
The agent will:
- Call
recall_memoryto check for past helpdesk builds - Call
plan_instructionswith goal"std-helpdesk" - Generate schema using the LLM, following the plan
- Call
verify_schemato check the result - If invalid, use repair suggestions and regenerate
- Call
store_memoryto save the episode
Next Steps
- Memory Lifecycle - Manage your agent's growing memory
- Process API - Use the unified step-by-step endpoint
- Helpdesk Example - Full working example