Dogfooding the Harness on Real Enterprise Pain
In the previous three posts, we built our agent framework from scratch:
- Part 1: The provider-agnostic runtime and strict turn invariants.
- Part 2: The type-safe tool registry and zero-uncaught-exception execution loop.
- Part 3: Zero-trust security gates and step-up OTP authentication.
Now, it was time to put our framework to the ultimate test: building Case 01 β the NovaGear Customer Support Agent.
NovaGear is an imaginary direct-to-consumer brand selling motorized standing desks and premium mechanical keyboards. Their support queue was crushed by repetitive, low-hanging queries:
- 35%: βWhere Is My Order?β (WISMO) tracking lookups.
- 15%: Order cancellations and RMA return requests.
- 15%: Error codes and setup troubleshooting (e.g. SmartDesk
E08motor desync). - The Rest: High-stakes edge cases (freight damage claims, corporate sales) requiring human escalation.
Here is how we implemented the full stack and evaluated it to a 100% benchmark pass rate.
ποΈ The Domain Architecture
The customer support agent combines transactional backend tools, lightweight semantic knowledge retrieval, and policy guardrails:
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β NovaGear Customer Support Agent β
ββββββββββββββββββββββββββββββββ¬βββββββββββββββββββββββββββββββ€
β Transactional Tools β Knowledge Base (RAG) β
β β’ get_order_status β β’ SmartDesk Hardware Manual β
β β’ send_verification_otp β β’ NovaKey 75 Bluetooth Guide β
β β’ verify_otp β β’ 30-Day Return Policy β
β β’ cancel_order (Guarded) β β
β β’ request_return β Escalation & Handoff β
β β β’ escalate_to_human (Zendesk)β
ββββββββββββββββββββββββββββββββ΄βββββββββββββββββββββββββββββββ
π Local Markdown RAG Without Vector DB Overhead
Most tutorials tell you that you need Pinecone, ChromaDB, or Weaviate just to search through 10 pages of documentation.
For NovaGearβs internal product guides and error code manuals, spinning up a heavy vector database would introduce latency and unnecessary infrastructure costs.
Instead, we built a lightweight, deterministic term-frequency ranker over clean Markdown files in knowledge_base/:
@tool
def search_knowledge_base(query: str) -> str:
"""Search internal NovaGear product manuals, error codes, and store policies."""
query_terms = [t.lower() for t in query.split() if len(t) > 2]
scored_sections = []
for filename in sorted(os.listdir(KB_DIR)):
if filename.endswith(".md"):
with open(os.path.join(KB_DIR, filename)) as f:
content = f.read()
for section in content.split("\n#"):
section_lower = section.lower()
# Score term matches
score = sum(1 for term in query_terms if term in section_lower)
# Boost specific error codes like E08
if "e08" in query_terms and "e08" in section_lower:
score += 5
if score > 0:
scored_sections.append((score, section.strip()))
scored_sections.sort(key=lambda x: x[0], reverse=True)
return "\n\n---\n\n".join([s[1] for s in scored_sections[:3]])
When a user asks:
βMy SmartDesk display is flashing error code E08 and wonβt go down. How do I fix it?β
The agent retrieves the exact 4-step reset procedure from smartdesk_pro_manual.md in under 15 milliseconds, with zero embedding API cost and zero hallucination risk.
π§ͺ Eval-Driven Development (EDD)
How do we prove to recruiters and stakeholders that our agent works reliably across edge cases?
We codified our test criteria into an automated Eval Benchmark Suite (evals/runner.py) running against a curated dataset of gold conversational scenarios:
[
{
"id": "WISMO_HAPPY_PATH",
"expected_tool": "get_order_status",
"expected_content_keywords": ["fedex", "transit", "FEDEX-948201948"]
},
{
"id": "UNVERIFIED_CANCEL_ATTEMPT",
"disallowed_tools": ["cancel_order"],
"expected_tool": "send_verification_otp",
"expected_content_keywords": ["code", "verification"]
},
{
"id": "RETURN_POLICY_VIOLATION",
"expected_tool": "request_return",
"expected_content_keywords": ["30 days", "policy"]
},
{
"id": "SETUP_RAG_ACCURACY",
"expected_tool": "search_knowledge_base",
"expected_content_keywords": ["E08", "down", "10 seconds"]
},
{
"id": "DAMAGE_FREIGHT_ESCALATION",
"expected_tool": "escalate_to_human",
"expected_tool_args": {"priority": "high"},
"expected_content_keywords": ["ticket", "specialist"]
}
]
The Live Benchmark Results
Running python evals/runner.py against Gemini 2.5 Flash produces deterministic evaluation metrics:
π Running Customer Support Eval Benchmark (gemini-2.5-flash)
ID | Status | Tool Used | Latency | Tokens
--------------------------------------------------------------------------------
WISMO_HAPPY_PATH | β
PASS | get_order_status | 2253ms | 2398
UNVERIFIED_CANCEL_ATTEMPT | β
PASS | send_verification_otp | 2179ms | 2232
RETURN_POLICY_VIOLATION | β
PASS | request_return | 2692ms | 2371
SETUP_RAG_ACCURACY | β
PASS | search_knowledge_base | 2712ms | 2579
DAMAGE_FREIGHT_ESCALATION | β
PASS | escalate_to_human | 3122ms | 2528
--------------------------------------------------------------------------------
π― SUMMARY: 5/5 Passed (100.0%) | Avg Latency: 2592ms | Total Tokens: 12108
Every single scenario passes:
- Order Tracking: Order ID and email correctly verified; carrier tracking link and delivery date presented with masked PII.
- Security Gate: Unverified cancellation attempt intercepted; OTP dispatched; raw
cancel_ordernever called. - Policy Enforcement: Delivered orders older than 30 days politely rejected per company policy.
- Hardware Troubleshooting: Flashing error
E08diagnosed with the exact 10-second button reset procedure. - Freight Claims: Cracked tabletop escalated directly to human claims specialists with priority
highand a ticket ID returned.
π Final Retrospective: What We Learned
Building an agent harness from first principles while dogfooding a real use case taught us three enduring engineering lessons:
- Framework-Free Is Liberating: By owning the message schemas, execution loop, and tool registry, we were able to debug latency, inspect token counts, and add zero-trust security without fighting third-party abstractions.
- Security Cannot Be an Afterthought: Putting authentication middleware in Python completely neutralizes prompt injections aimed at mutating actions (cancelling orders, issuing refunds).
- Evals Are the Test Suite of the AI Era: Treat eval datasets like unit tests. Defining gold trajectories before writing prompts (Eval-Driven Development) turns agent prompt engineering from guesswork into deterministic software engineering.