Build AI Agents in Your SaaS
If you are adding AI agents to a production SaaS, treat this as two separate concerns:- Agent control plane: how your team configures agents, tools, knowledge, and MCP servers.
- Agent runtime plane: how your users actually chat with agents inside your product.
Choose your implementation model
Model 1: Console-first
Use this when you want the fastest rollout.- Configure agents, tools, knowledge bases, and MCP servers in Console.
- Generate session tickets from your backend.
- Open Wacht vanity agent UI (
/vanity/agents?ticket=...) or mount custom chat using frontend hooks.
- Teams shipping first version quickly.
- Ops-heavy teams that want non-engineers to manage agent config.
- Cases where you want strong defaults before heavy customization.
Model 2: API-first
Use this when agent setup must be automated per tenant or per workflow.- Create and update agents with backend SDK methods (
client.ai.createAgent,client.ai.createExecutionContext). - Manage MCP servers through SDK HTTP helpers (
client.post/get/delete) against/ai/mcp-servers, then attach per agent. - Run contexts from your app with tickets and frontend hooks.
- Multi-tenant SaaS onboarding automation.
- Dynamic agent provisioning.
- Strict internal policies around infra-as-code.
Model 3: Hybrid (recommended)
Most teams should combine both:- Bootstrap in Console.
- Automate repetitive setup via Backend API.
- Keep runtime UX inside your product with hooks.
Architecture in practice
What you will implement in this guide set
- Create and run agents using Console + Backend API.
- Embed agent runtime in your app using session tickets and frontend hooks.
- Connect MCP servers and attach them to agents.
- Protect MCP servers with OAuth app token verification.
