All projects

AI Reliability / Execution Infrastructure

Agentic Customer Service Platform

A customer-support assistant that answers from the policy, looks up orders, handles refunds and cancellations and hands over to a person. The model reads the request and suggests the action; server code checks the customer, applies the policy, asks for confirmation and runs it once.

0 unsafe executions540 / 540
Safety attempts measuredD2c semantic-safety validation: 30 unsafe proposals, 30 caught by the deterministic guard, 0 executable survivors and 0 executions.
8/8 phases, 6/6 fault classes18 / 18
Operational scenarios passedD2d release gate on the deployed system: concurrency, restart, persistence and injected faults, measured apart from model quality.
100 samples, 82 passed, 18 partial0
Safety failures with live modelsReal-LLM adversarial audit: the 18 partial results are quality warnings. No unauthorized change, skipped confirmation or duplicate effect.

A convincing answer is not permission.

A support assistant that only answers questions can be wrong and cost a reply. One that can refund an order, cancel it or open a ticket can be wrong and cost money. Once an agent can change an account, it becomes a systems problem.

This platform keeps understanding and permission apart. The model reads what the customer wants and proposes an action. It cannot choose which customer it serves, invent an order number, approve its own refund or change account data. Those decisions live in code that can be tested.

Around that runtime sits AgentOps, the console where a support team watches the assistant work, steps in when a customer needs a person and shapes how the assistant behaves, without being able to hand the model more authority.

Built for the support team.

The assistant handles the routine work; the team keeps the hard cases, the knowledge and the rules.

Answer from the policy

Policy and FAQ questions are answered from the knowledge base with hybrid dense and BM25 retrieval. Each answer is checked against its sources and citations, and the assistant says so when the evidence is not enough.

Customers get answers the support team can trace back to a document.

Handle orders end to end

Order and ticket lookups, refunds, cancellations and new support tickets. Consequential actions wait for the customer to confirm, then run once through a typed path.

Routine requests are resolved without a person, and never twice.

Hand over to a person

Sensitive requests go straight to the queue with a priority, a reason and a first-reply deadline. An operator claims the conversation, replies, adds internal notes, resolves it or hands it back to the assistant.

The customer sees one continuous thread, whoever is answering.

Investigate any run

Every run shows what the model proposed, what the control plane decided, what was authorized and what ran, with the evidence behind it. The audit log records who did what and when, for the assistant and the team.

A support lead can answer “why did it do that?” from the console.

Shape and measure it

Knowledge articles, guidance rules, procedures and action modes are edited as published versions. Performance tracks resolution, handoff rate and CSAT, and unanswered questions become new article sections.

The team improves the assistant without touching code or authority.

One refund, interrupted halfway.

The assistant asks the customer to confirm a refund, and the customer answers with a question instead. This is the path the request takes.

  1. Request. The customer asks for a refund. The model proposes the intent; the server resolves which order it means within that customer's scope.
  2. Hold. Policy allows the refund but requires confirmation, so it is saved as one pending action and nothing runs.
  3. Interrupt. The customer replies “Yes, but first, what is your refund policy?”. A yes mixed with a question is a question, so the workflow is suspended, not approved.
  4. Answer. The assistant answers from the refund policy with citations. The answer does not count as approval, and the refund keeps waiting.
  5. Confirm. The customer confirms the same refund. The server checks the order again before anything runs.
  6. Run once. The refund is written through the typed business path under an idempotency key, so a retry cannot apply it twice.

The model proposes. The server decides.

In a typical agent, the order number the model writes goes straight into the tool. Here every step after understanding the request belongs to the server.

StepThe modelThe server
Understand the requestProposes the intentRecords it as a suggestion
Pick the customer and orderCannotResolves them from the signed-in customer
Decide if it is allowedCannotBusiness validation and policy
Approve the actionCannotThe customer confirms one saved action
Run itCannotRevalidates, then a typed tool runs it once
Use memory and documentsReads them as contextNever treats them as permission
LLM    → semantic proposal
Server → auth, scope, target resolution
       → validation, policy, confirmation
       → revalidation → typed tool
       → idempotency + database

From request to action.

The server knows who the customer is before the agent runs. Knowledge and memory help the answer, but only the server's checks can let an action through.

From proposal to permission.

Follow a business-action request. Select a boundary to inspect its controls.

  1. RequestCustomer or operatorInspect
  2. Identity & scopeResolved by the serverInspect
  3. Agent proposalUntrusted model outputInspect
  4. Deterministic gatesServer-owned decisionsInspect
  5. Typed executionAllow or confirmed actionsInspect

Policy chooses one route.

These are alternatives, not a sequence.

  • AllowRisk 0 / 1

    Continue to the typed execution path.

    Inspect execution
  • ConfirmRisk 2

    Wait for explicit approval; revalidate before execution.

    Inspect confirmation
  • HumanRisk 3

    Use the dedicated escalation path. The requested action does not run automatically.

  • DenyBlocked

    Stop. The requested action does not execute.

Inside each boundary

Open the implementation details you need.

RequestCustomer or operator

A chat or console request enters through the HTTP boundary.

Request entry

Identity and customer scope are resolved server-side before any agent work begins.

  1. Customer / Operator

    chat or console request

  2. FastAPI

    HTTP boundary, resolves principal

Identity & scopeResolved by the server

Authentication establishes the principal. Customer scope comes from the server, never from model output.

Authenticated boundary

Identity and customer scope are resolved server-side before any agent work begins.

  1. Authentication, RBAC

    typed principal

  2. ExecutionContext

    server-owned identity + scope

    • actor, customer scope
    • request + conversation ID
Agent proposalUntrusted model output

The runtime orchestrates a typed semantic proposal. Knowledge and memory can inform it, but cannot authorize an action.

Model proposal

The model proposes semantic intent; the server owns every decision that can lead to a mutation.

  1. LangGraph Runtime

    agent orchestration, typed state

  2. LLM Semantic Proposal

    untrusted, Pydantic-typed

Knowledge supports answers

Retrieved evidence can support an answer, but it never grants execution authority.

  1. Knowledge Question

    FAQ or policy request

  2. Hybrid Retrieval

    dense + BM25

  3. Grounding / Citation Validation

    bounded evidence

  4. Bounded Answer

    abstains when evidence is insufficient

Memory supplies context

Customer-scoped memory enriches context; it cannot approve, widen scope or bypass policy.

  1. Memory = context

    consent, TTL, customer scope

  2. Memory ≠ authority

    no permission or approval

Deterministic gatesServer-owned decisions

The server compiles the proposal, resolves the authoritative target and validates live business state before policy decides what may proceed.

Checks before permission

The model proposes semantic intent; the server owns every decision that can lead to a mutation.

  1. Deterministic Compiler

    provenance and admissibility

  2. Authoritative Target Resolution

    authenticated customer scope

  3. Typed / Business Validation

    live state and tool arguments

  4. Policy

    deterministic, fail-closed

Typed executionAllow or confirmed actions

Only a permitted action reaches the business tool. Required confirmation is bound to the exact pending action and revalidated before execution; idempotency and database invariants protect the effect.

From permission to a durable effect

Allow continues to typed execution; Confirm first requires explicit approval and live-state revalidation. Human follows a dedicated escalation path, and Deny stops the requested action.

  1. Confirmation Boundary

    when required, exact pending action

  2. Revalidation

    ownership, expiry, live state

  3. Typed Tool

    execution authority

    • server-owned arguments
    • business effect only here
  4. Idempotency + DB

    one business effect

    • replay protection
    • state invariants
  5. Projection / Audit

    bounded operator evidence

State ownershipDurable state and retrieval stay separate

State ownership

Business state, idempotency receipts, memory and checkpoints are durable; retrieval remains a separate evidence system.

  1. Agent Runtime

    context, memory, retrieval

  2. Separate components

    PostgreSQL

    system of record

    • business records + receipts
    • persistent memory
    • LangGraph checkpoints
    Qdrant

    versioned hybrid index

    • immutable snapshots
    • atomic alias activation
Observation and evaluationEvidence observes; it does not authorize

Observation and evaluation

Telemetry and evaluation observe behavior without becoming authorization inputs.

  1. Separate components

    HTTP boundary

    safe metadata

    Agent runtime

    run + tool spans

  2. Separate components

    OpenTelemetry / Jaeger

    trace inspection

    Operator Console

    metadata-only projections

    Evaluation Harness

    deterministic + live suites

Engineering notesContracts, evaluation and deployment limits
  • Model output is an untrusted proposal: it cannot select an actor, widen customer scope, confirm its own action or override live business state.
  • Confirmation is durable — pending actions survive restarts and stay bound to actor, actor type, customer scope and conversation.
  • Policy is revalidated against live state at confirmation time, so a stale proposal cannot execute against changed records.
  • Request-scoped idempotency keys and database uniqueness keep refunds, cancellations, tickets and escalations to one business effect; a write whose outcome is unknown is never automatically replayed.
  • Remembered text is contextual evidence only — it cannot authorize work or bypass policy.
  • The provider boundary is transport-neutral — a structured decision can be produced through a JSON schema or a function-calling contract — so a local model and a hosted one are swapped by configuration without the policy, confirmation or execution layers changing.
  • Because those layers never move, the canonical evaluation compares decision architectures under one model before it compares model identities: a frozen structured-contract compatibility gate decides which candidates are even eligible, and only qualifying models reach the behavioral matrix.
  • The current D2c semantic-safety evaluation closed the containment funnel at zero: 30 unsafe semantic proposals, 30 deterministic guard interventions, 0 executable survivors, 0 executions — reached through architectural hardening, not prompt-only tuning.
  • A separate D2d operational release gate validates the deployed system itself — concurrency, restart/persistence and a 6/6 fault-injection matrix — independent of model behavior; D2c and D2d are deliberately distinct claims.
  • The current runtime contract is semantic_decision_v3.
Read the architecture

What the runtime guarantees.

These rules hold whatever the model says, so a wrong proposal ends as a refused action rather than a wrong refund.

The model never picks the target

A customer ID or order number written by the model is never trusted because the model wrote it. The server resolves the target within the authenticated customer's scope.

Read the design

A confirmation belongs to one action

Confirmation is bound to one saved pending action. A mixed message suspends the workflow, workflows can resume or be replaced, and state survives a browser or backend restart.

Read the design

Every write happens once

Business writes and their idempotency receipts commit together. An unknown write outcome is not blindly retried, and database constraints back the critical invariants.

Read the design

Memory and evidence never authorize

Memory is kept with consent, an expiry and per-customer scope, and adds context only. Retrieved documents shape the answer. Neither can approve an action or grant a role.

Read the design

Keep authority out of the model.

Proposals instead of tool calls

The model returns a semantic proposal, not a call to execute. A deterministic compiler combines it with server-owned identity, target, policy and confirmation state; only typed tools can commit an effect.

Recheck before running

A confirmed action is revalidated against current business state before it runs, so an order that changed while the customer was reading cannot be refunded on stale data.

Handoff is a database row

Who owns a conversation lives in PostgreSQL, not in the model's state. While a person owns it the model is not called, and an operator's reply is never read as the customer's confirmation.

Security before routing

Prompt-injection and instruction-override attempts are checked before semantic routing. A denied proposal is recorded with its decision, and nothing is authorized or executed.

Evidence kept apart

Safety, operational, resilience and live-model quality results are reported as separate measurements with their own denominators, never merged into one score.

The operator console.

Every screen below is AgentOps running on the local stack with a live model. Open any screenshot to see it full size.

AgentOps overview with 31 conversations, AI resolution rate, handoff rate, CSAT, resolutions per day and three customers waiting for a person.
See how it is doing

Conversations, AI resolution rate, handoff rate and CSAT for the week, with the customers waiting for a person.

A high-priority handoff for an unauthorized card charge, waiting for an operator with its reason and a 15-minute first-reply deadline.
Hand over at once

Sensitive requests go straight to the queue with a priority, a reason and a first-reply deadline.

A duplicate-charge conversation handed to the team and resolved by an operator in the same thread.
Step in and resolve

An operator takes over, replies and resolves; the customer sees one continuous thread.

Run investigation of a refund request: intent, LLM proposal, system decision Require Confirmation, authority Confirmation Required, execution Awaiting Confirmation.
Hold for confirmation

A refund stopped at the confirmation boundary: what the model proposed, what the control plane decided, what may run.

Run investigation of a prompt-injection attempt: the model proposed Refund All Orders, the control plane denied it, nothing was authorized or executed.
Deny an injection

A prompt injection proposes refunding every order. The control plane denies it and nothing runs.

Information flow from customer request through memory and RAG evidence, LLM proposal, decision compiler and policy gate, with the retrieved refund-policy chunks and their scores.
Ground the answer

Retrieved policy chunks ground the answer; memory adds context; neither grants authority.

Audit log of assistant decisions, handoffs, takeovers and closes, grouped by day.
Follow the audit log

Who did what and when, for the assistant and the team, searchable on the server.

The refund procedure as steps: validate, ask for confirmation, call request_refund once, with its linked action and article.
Write the procedure

Each request type is a readable step-by-step procedure, linked to its actions, articles and guidance.

Unanswered customer questions ranked by how often they were asked, with the article each belongs in.
Close knowledge gaps

Questions the assistant could not answer become new article sections.

Versioned operator guidance rules scoped to request types.
Publish guidance

Plain-language guidance changes how requests are read, never what is authorized. Every change is a published version.

Thirty-day resolution, handoff rate and CSAT with resolutions per day.
Measure the outcome

How often the assistant resolves on its own, when people step in, and how customers rate both.

Release evidence: zero unsafe executions, confirmation bypasses, unauthorized and duplicate mutations, with 540/540 semantic validation and the D2d release gate passing.
Keep the release evidence

The release gates behind the control plane, each kept as its own measurement.

Measured separately.

Safety, operations, resilience and live-model quality are tested apart, each with its own denominator, so one good number cannot hide another.

TestResultWhat it means
Semantic safety (D2c)540/540 measured attempts0 unsafe executable survivors and 0 unsafe executions.
Operational release gate (D2d)18/18 scenarios, 8/8 phases, 6/6 fault classesThe deployed system across concurrency, restart and injected faults.
Deterministic resilience28/28 scenariosRuntime correctness, reported on its own.
Live-model audit100 samples: 82 passed, 18 partialPartials are quality warnings. No safety check failed.
Release QA844 backend, 49 frontend, 6/6 PlaywrightPlus an authenticated smoke test.

Across the live-model audit there were no unauthorized changes, skipped confirmations, duplicate effects, memory writes that granted authority or customer-data leaks.

Reference-deployment evidence, released as ready with warnings: the remaining warnings are bounded observability or unverified coverage, not observed safety failures.

Read the release evidence

Run it locally.

  • Python
  • FastAPI
  • LangGraph
  • SQLAlchemy
  • PostgreSQL
  • Alembic
  • Qdrant
  • OpenTelemetry
  • React
  • TypeScript
  • Vite
  • Pydantic
  • Ruff
  • Mypy
  • Vitest
  • Playwright
  • Docker Compose

Docker Compose starts the API, the console, PostgreSQL, Qdrant and Jaeger. Setup applies the migrations, seeds the demo records and loads the bundled knowledge base.

git clone https://github.com/negativexq/agentic-customer-service-platform.git
cd agentic-customer-service-platform
cp .env.example .env
docker compose up --build --detach
# Open http://localhost:5173

OpenTelemetry traces go to Jaeger, with opt-in Prometheus metrics. Pytest, Vitest and Playwright cover the backend, the console and the operator journeys.

In short

What is Agentic Customer Service Platform?
Agentic Customer Service Platform is a customer-support agent that looks up orders, handles refunds and cancellations, opens tickets and escalates to a human. The language model reads the request and proposes the action; server code owns customer identity, policy, confirmation and execution, so a model mistake does not become an account change.
What problem does Agentic Customer Service Platform solve?
A support agent becomes a systems problem once it can change account state: refund an order, cancel it, open a ticket or escalate a case. A convincing model answer is not permission. This project keeps understanding and permission apart, and tests safety, operational behaviour, resilience and answer quality separately instead of folding them into one score.

Follow the implementation.