~/bpabatao
← back to index

Billing-Data Knowledge Agent

A retrieval agent over Oracle Utilities CCS billing systems that answers from curated documentation first and only reaches for generated SQL behind a flag.

Role
Sole author
Period
2026
Stack
AWS Bedrock · RetrieveAndGenerate · Fargate · S3 · Oracle CCS · TypeScript
questionkb agentcurated corpusretrieve + generatedefault pathgenerated sqlflag + permissionkill-switch to curated-onlys3 corpusscheduled refreshoracle ccstenant-scopednever claims absenceanswercited + badged
A question routes through the knowledge-base agent to a curated corpus first, with generated SQL against tenant-scoped CCS only as a flagged fallback

Problem

Answering a question about a utility account meant knowing which of several tenant systems held the answer, which schema it used, and which of its account types applied. That knowledge lived with a handful of people, and the questions arrived constantly.

A language model over the data is the obvious idea and the dangerous one. On billing records the failure mode is not a bad sentence, it is a confident wrong number, or a claim that something does not exist when the query simply missed it.

Constraints

The corpus describes real customers, including person identifiers such as SSN fields, so the schema had to be modelled explicitly rather than left for the model to infer. Tenants must never see each other's data, and an answer that cannot be grounded has to say so instead of guessing.

Decisions

Architecture

Curated first. Questions route through Bedrock's RetrieveAndGenerate over a curated corpus - an account-type catalog covering collective, secondary, usage, registration and service states - and answers cite the source they came from, with a badge marking whether that source is authoritative for the environment being asked about.

The SQL path sits behind an environment kill-switch and a separate grantable permission - flip the switch and the agent runs curated-only - and a source selector lets the asker choose documentation, live data, or automatic.

The guardrails are the product. The prompt is guarded against inventing terms, confusing environments, or mislabelling a count column.

The corpus does not go stale: a scheduled Fargate task refreshes it, with a least-privilege task role for the bucket, the knowledge base and the secrets it reads.

Outcome

view resume ↗ (opens in new tab)email me