The problem with one giant prompt
My first instinct for SentriX was the obvious one: dump a policy document and an ISO standard into a single prompt, ask the model to score compliance, and call it done. It worked for a demo. It fell apart the moment I tried to make it real.
The issue is that "score this document against ISO 27001" is not one task, it's at least five: understand the document's structure, map its clauses to the standard's controls, judge whether each control is actually satisfied, cite evidence for that judgment, and roll everything into a score that means something. Cram all of that into one prompt and you get a model that's half paying attention to each step. It hallucinates evidence, conflates unrelated clauses, and gives you a confident number with no way to audit how it got there.
Compliance scoring is exactly the kind of task where you need to audit the reasoning, not just trust the output. That's what pushed me toward a multi-agent design instead of a single mega-prompt.
Designing agent boundaries
Once I accepted that this needed to be broken up, the real question became: where do the boundaries go? It's tempting to slice by "step in my head" and end up with agents that are really just prompt fragments with extra latency. I tried to slice by responsibility and failure mode instead — each agent should own something that can succeed or fail independently, without taking down the rest of the pipeline.
That's how I landed on a 7-agent pipeline that scores a policy document against 6 ISO standards simultaneously. Roughly, the boundaries look like:
- an agent that parses and structures the input document
- per-standard scoring agents that evaluate against each of the 6 ISO standards
- an evidence validation agent that checks whether cited passages actually support the score given
- a remediation agent that drafts policy fixes for the gaps found
The evidence validation step is the one I almost skipped, and I'm glad I didn't. It's a second pass that goes back over each score and asks "does this citation actually say what the scoring agent claims it says?" It's cheap to add and it catches a specific, embarrassing failure mode: a model that's right about the verdict but wrong about why, which is worse than being wrong outright in a compliance context, because it looks trustworthy.
Keeping typed contracts between agents
The thing that made this maintainable instead of a pile of string-passing was treating agent boundaries as real interfaces, not prompt handoffs. Every agent takes a strongly-typed input and returns a strongly-typed output. No agent reaches into another agent's internals, and no agent assumes anything about how the previous one produced its result — only about the shape of what it received.
The payoff shows up when you add a new agent. Because the pipeline core only knows about the typed contract, not the implementation behind it, dropping in a new agent doesn't require touching the orchestration logic at all. A rough sketch of the pattern:
interface AgentInput {
document: ParsedPolicy;
standard: ISOStandard;
}
interface AgentOutput {
score: number;
evidence: Citation[];
confidence: number;
}
interface ComplianceAgent {
run(input: AgentInput): Promise<AgentOutput>;
}Any new agent just implements that interface and gets registered. The pipeline doesn't care if it's calling Claude, Groq, or a local heuristic function underneath — which turned out to matter a lot for the next problem.
Why AI models disagree, and what to do about it
The uncomfortable truth about using LLMs for scoring is that they don't agree with themselves run to run, and they definitely don't agree with a different model. If your whole system depends on one model's output for a graded score, you have a single point of failure that's also nondeterministic. That's a bad combination for something meant to produce an auditable compliance number.
So SentriX uses a 3-tier hybrid scoring engine instead of trusting one source:
- ML semantic scoring runs first, using semantic similarity between the document and the standard's requirements.
- Groq AI runs second, giving a fast independent read where semantic scoring alone isn't confident enough.
- NLP heuristic scoring is the fallback tier, a rule-based pass that doesn't depend on any external model being available at all.
The point isn't that any one tier is "best." It's that the tiers are ordered by capability but designed so that a lower tier failing, timing out, or disagreeing doesn't block the pipeline. If the ML scorer is uncertain, Groq gets consulted. If Groq's API has a bad moment, the heuristic tier still produces a usable, if less nuanced, score. Nothing in the pipeline waits on a single model being perfectly available. That was the design goal I cared about most — graceful degradation over a fragile "it works until the API call fails" system.
Why SSE beats polling for a pipeline like this
Seven agents scoring six standards is not fast. If the UI just spins with no feedback, it reads as broken even when it isn't. I initially considered polling — hit an endpoint every couple seconds, ask "are you done yet" — but that adds latency to every update and leaves the client guessing at a good interval.
SSE fits this much better. The server pushes progress the moment an agent finishes, so the UI can show which agent is running, which standard it's scoring, and stream partial results in as they land, instead of waiting for the whole pipeline to finish before showing anything. For a long-running, multi-stage backend process, one persistent connection where the server pushes as often as it wants beats a client polling blind.
What broke, and what I'd redo
Nothing about this was clean on the first pass. Early on, agent boundaries were too fine-grained — I split "parse document" and "extract sections" into two separate agents before realizing they always ran together and never failed independently, which is exactly the criterion I said I'd use for splitting things. I merged them back.
I also underestimated the evidence validation step until I saw a scoring agent confidently cite a passage that, on inspection, was about a completely different control. That single failure mode convinced me validation wasn't optional polish — it was load-bearing for the whole idea of "compliance scoring you can trust."
If I were starting over, I'd design the typed contracts between agents before writing any single agent's logic, instead of retrofitting types after the second or third agent existed. It would have saved a few rounds of refactoring once the interface had to change shape.
The repo
SentriX is still evolving, but the pipeline, the hybrid scoring engine, and the SSE streaming are all in place and working end to end. If you want to see the agent implementations or the typed contracts described above, the code is here:
github.com/vaaiiibbhav/SentriX
It's a solo project built while I'm still a student, so treat it as exactly that: a real attempt at a hard orchestration problem, not a polished product. Issues and feedback are welcome.