Introduction
The OfficeFlow agent is a customer support assistant named Emma, designed to help customers of OfficeFlow Supply Co., a paper and office supplies distributor serving small-to-medium businesses across North America. This agent serves as the primary example throughout the Building Reliable Agents course, demonstrating how to build, evaluate, and improve production-ready AI agents.Agent Persona
Emma is a customer support specialist with 3 years at OfficeFlow, known for being:- Helpful and efficient - Focuses on solving customer problems quickly
- Genuinely caring - Treats every interaction as an opportunity to build trust
- Knowledgeable - Has access to product databases and company knowledge bases
- Human - Uses natural language, shows empathy, and avoids robotic responses
Core Capabilities
The agent can help with:Product Information
Product Information
- Answer questions about office supplies, paper products, writing instruments, organizational tools, and desk accessories
- Provide detailed product specifications and details
- Recommend products based on customer needs and budget
Inventory & Availability
Inventory & Availability
- Check current stock levels in real-time
- Help customers find available alternatives
- Communicate availability using strategic language (e.g., “in stock” vs “running low”)
Company Policies & Information
Company Policies & Information
- Search knowledge base for policy information
- Answer questions about shipping, returns, ordering processes
- Provide contact information for specialized departments
What the Agent Cannot Handle
Emma is designed with clear boundaries and will redirect customers to appropriate channels for:- Order Placement → Web portal or [email protected]
- Order Status & Tracking → Account portal or [email protected]
- Returns & Refunds → [email protected]
- Account Changes → [email protected]
- Technical Support → [email protected]
Key Design Principles
1. Check Database First
The agent is instructed to always check the database first before asking clarifying questions. This creates a better user experience:2. Strategic Stock Communication
The agent never reveals exact stock quantities. Instead, it uses strategic language:- > 20 units: “In stock” or “Available”
- 10-20 units: “In stock, but running low”
- 5-9 units: “Only a few left in stock”
- 1-4 units: “Very limited stock remaining”
- 0 units: “Currently out of stock”
3. Concise Communication
The agent prioritizes brevity:- Get straight to the answer
- Avoid unnecessary filler or repetition
- If something can be said in one sentence, don’t use three
Tools & Architecture
The agent has access to two primary tools:query_database
Executes SQL queries against the inventory database for product information, stock levels, and pricing.
search_knowledge_base
Performs semantic search using embeddings to retrieve relevant policy documents and company information.
Technical Stack
- Python
- TypeScript
- LLM Provider: OpenAI (gpt-5-nano model)
- Tracing: LangSmith for observability
- Database: SQLite3 for product inventory
- Embeddings: text-embedding-3-small for RAG
- Vector Store: In-memory with NumPy
Agent Evolution
The OfficeFlow agent went through multiple iterations, each addressing specific production challenges:- v0: Basic implementation with no observability
- v1: Added LangSmith tracing for debugging
- v2: Enhanced tool descriptions to fix schema discovery
- v3: Added stock quantity communication policy
- v4: Implemented RAG with full document retrieval
- v5: Added conciseness directive to reduce verbosity
System Prompt Structure
The agent’s system prompt follows a clear structure:- Role & Persona - Who Emma is and her background
- Capabilities - What she can help with
- Boundaries - What she cannot handle
- Communication Style - How to interact with customers
- Critical Instructions - Key behavioral guidelines (check database first, stock policy, etc.)
- Tools - Descriptions of available functions
- Examples - Sample interactions demonstrating expected behavior
Running the Agent
- Python
- TypeScript
- Load the knowledge base and generate/cache embeddings
- Start an interactive chat session
- Display the thread ID for tracing in LangSmith
- Accept user input until you type ‘quit’ or ‘exit’
Next Steps
Agent Versions
Explore the progressive improvements from v0 to v5
Analyzing Agents
Learn how to analyze agent behavior using traces