What You’ll Build
You’re building a support bot for SimpleSaaS—a fake subscription app. The bot can:
- Answer FAQs from a fixed knowledge base
- Check subscription status by calling a tool
- Escalate to human when things feel risky or unclear
This isn’t a general-purpose agent. It’s narrow, focused, and knows when to ask for help.
Why Focus on One Job?
Most tutorials show you how to build an agent that does everything. That’s dangerous. Agents with too much freedom can:
- Make decisions you didn’t expect
- Call tools in ways you didn’t plan
- Fail silently when they should ask for help
We’re building something smaller and safer. It has clear boundaries and knows when to escalate.
Live Demo
Try the agent yourself. Use the chat panel below to ask questions:
SimpleSaaS Support
● OnlineExample Scenarios
Here are three scenarios the agent handles:
Scenario 1: Simple FAQ
User: “What is SimpleSaaS?”
Agent: Answers directly from the knowledge base. No tools needed.
Trace shows: Single step - direct answer
Scenario 2: Check Subscription
User: “What’s my current plan?”
Agent: Calls get_subscription_status tool, then answers.
Trace shows: Two steps - tool call, then answer
Scenario 3: Billing Dispute
User: “I want a refund for last month”
Agent: Detects sensitive keyword “refund”, escalates to human.
Trace shows: Escalation step with reason
The Agent Trace
Every action the agent takes is logged. Here’s what a trace looks like:
Example Agent Trace
Arguments
{
"user_id": "user-123"
} Result
{
"plan": "Pro",
"status": "active",
"expires": "2025-12-01"
} What You Need
Before we start coding, make sure you have:
- Python 3.8+ or Node.js 18+
- An API key for an LLM provider (OpenAI, Anthropic, etc.)
- A code editor (VS Code recommended)
- Basic familiarity with calling APIs
Don’t have an API key? Most providers offer free tiers for testing.
Tutorial Structure
This tutorial has 8 pages:
- Overview and Live Demo (you’re here)
- What Is an AI Agent? - Core concepts
- Designing the Support Agent - Planning
- Defining Tools and Prompts - Setup
- Building the Agent Loop - Implementation
- Adding Memory and Guardrails - Safety
- Building the Final UI - Interface
- Extensions and Reflection - Next steps
Each page builds on the previous one. You’ll write code, test it, and see it work.
Key Concepts You’ll Learn
By the end, you’ll understand:
- Agent Loop: The cycle of receive → decide → act → repeat
- Tool Calling: How agents use functions to get information
- Memory: Short-term (conversation) and long-term (user preferences)
- Guardrails: Rules that keep the agent safe
- Escalation: Knowing when to ask for help
These concepts apply to any agent you build, not just support bots.
Ready to Start?
The next page explains what an AI agent actually is. We’ll contrast it with simple LLM calls and show you the basic loop structure.