Building an Intelligent OnCall Agent: Architecture and Lessons from an Enterprise AI Ops Assistant
This article explains why a production OnCall agent must go beyond a chatbot, how to split knowledge, conversation, and operations agents, and how to design RAG, controlled tooling, APIs, and evaluation so incident response stays auditable and reliable.
Building an Intelligent OnCall Agent: Architecture and Lessons from an Enterprise AI Ops Assistant
1. Why an Intelligent OnCall Agent
Traditional on-call is a familiar pain: an alert fires, an engineer responds in the middle of the night, then spends most of the time hunting through docs, dashboards, and servers instead of fixing the issue. A routine incident can take tens of minutes or hours. Knowledge lives in scattered documents, chat logs, and personal experience, so new hires ramp slowly and expertise walks out the door when people leave.
A production OnCall agent should be an enterprise operations assistant, not a demo. Its value is three things:
- Automatic answers — Common questions are answered from the knowledge base so people are interrupted less.
- Guided troubleshooting — The agent follows predefined SOPs, runs diagnostics, and narrows root cause quickly.
- Knowledge that compounds — Sessions and investigations feed back into the knowledge base.
Those goals drive architecture: this is a system that must integrate with monitoring, ticketing, and logs, not a standalone chat app.
2. Overall Architecture: Three Agents and a Coordinator
Stuffing every capability into one giant agent fails: context balloons, instructions conflict, and debugging is hard. Split by responsibility and coordinate through a scheduler.
- Knowledge-base agent — Full RAG: load, chunk, embed, retrieve, rerank; retry or ask clarifying questions when retrieval is weak.
- Conversation agent — User-facing entry: intent, multi-turn state, context trimming, slot filling; routes to knowledge or ops.
- Operations agent — Turns natural language into controlled ops: metrics, log snippets, read-only diagnostics.
Typical flow: an alert arrives; the conversation agent parses the alert and the user’s ask. Consultations go to RAG. Incidents go to the ops agent following SOPs. When historical cases are needed, it calls the knowledge-base agent.
3. Knowledge-Base Agent
RAG is the foundation. Easy mistakes:
- Chunking should match the content. Ops docs are SOPs, FAQs, and config notes. Use heading hierarchy plus a sliding window, keep heading paths as metadata, and filter on them at retrieval time.
- Hybrid retrieval. Vector recall plus keyword recall, then a reranker. Pure vectors miss host names and metric names in alerts; hybrid improves hit rate.
- Citations must be traceable. Attach source snippets and links so on-call engineers can verify. Example:
answer = {"text": "This alert is often caused by connection-pool exhaustion…","sources": [{"doc": "db-faq.md#sec3", "score": 0.87}],"confidence": 0.82,}
- Fail closed. Below a confidence threshold, say the knowledge base has no evidence and hand off to a human or ask a follow-up—do not let the model invent an answer.
4. Conversation Agent: Engineering the Front Door
This agent is the gatekeeper.
- Classify intent first. A light classifier for consult / troubleshoot / chit-chat / action request avoids sending everything through heavy paths.
- Context: summary plus recent turns. Compress early turns; keep the last few turns verbatim to balance tokens and completeness.
- Confirm risky actions. Any write or high-risk command needs an explanation and user confirmation before execution.
- Structured conversation logs. For audit and for later prompt and retrieval tuning.
5. Operations Agent: Control First
The worst failure is doing the wrong thing. Least privilege and allowlists:
- Allowlisted tools. Only reviewed diagnostics (metrics, logs, config). Execution tools default to read-only.
- Strict parameter validation. Tool arguments must pass schema checks so hallucinated parameters cannot cause damage.
- Full audit trail. Caller, time, parameters, and a result summary for every tool call.
- SOPs plus bounded exploration. Known incidents follow deterministic SOPs; unknown ones may let the model explore, with depth and step limits.
6. Interfaces and Reliability
Expose two models: sessions for human chat and events for alert-driven runs. Agents talk over async messages and a queue so alert storms can be smoothed.
- Idempotency — Duplicate alerts must not start duplicate investigations.
- Timeouts and fallback — If the model is down, fall back to keyword FAQ matching.
- Evaluation loop — Replay historical tickets to measure answer accuracy and diagnosis hit rate.
7. Closing
A useful OnCall agent puts LLM reasoning inside a bounded, auditable, measurable system. The hard parts are knowledge quality, agent coordination, permissions, and continuous evaluation—not a single model trick. Getting that right improves on-call and yields a reusable agent engineering approach.
