Support ticket answer with policy evidence
Answer customer tickets with cited policy chunks and replayable evidence.
Support agents need answers that cite the right policy version and avoid leaking hidden account context.
Most apps glue together retrieval, prompts, redaction, writes, and audit logs in application code. That code is hard to replay after the fact.
Synapsor stores the session context, capability policy, hybrid search inputs, and evidence bundle with the run.
Example names and seed ids are developer-defined. SESSION values are set by your backend. ARG values come from the SDK/HTTP call. Handles such as wrp://..., evidence://..., and agent-run://... are returned by Synapsor and should be stored for audit/replay.
Read the value-source guideThe app gets a drafted response plus the evidence bundle id used to support it.
Production checks
- Ticket rows are filtered by tenant_id from hidden session context.
- Evidence bundle includes policy chunk ids and versions.
- Replay uses the captured run context, not the current prompt text.
- API key scope pins the request to the provisioned database branch.
CREATE TABLE tickets (
id INT PRIMARY KEY,
tenant_id VARCHAR NOT NULL,
customer_email VARCHAR NOT NULL,
subject VARCHAR NOT NULL,
body TEXT NOT NULL,
status VARCHAR NOT NULL
);
CREATE TABLE policy_chunks (
id INT PRIMARY KEY,
tenant_id VARCHAR NOT NULL,
version VARCHAR NOT NULL,
body TEXT NOT NULL
);CREATE AGENT WORKFLOW support.ticket_answer_flow
SESSION REQUIRE tenant_id, principal, current_ticket_id
ALLOWED CAPABILITIES (
support.answer_ticket
)
EVIDENCE REQUIRED
CHECKPOINT EVERY STEP
RETENTION RUNS 90 DAYS, EVIDENCE 90 DAYS;
CREATE AGENT CONTEXT support.ticket_context
ROOT tickets AS ticket
LOOKUP ticket.id = SESSION current_ticket_id
BIND tenant_id FROM SESSION tenant_id
BIND principal FROM SESSION principal
SEARCH policy_chunks AS policy_hits USING HYBRID(policy_chunks.body)
QUERY ARG question
FILTER policy_chunks.tenant_id = SESSION tenant_id
TOP 5
OUTPUT SLOTS
ticket_id AS ticket.id,
subject AS ticket.subject,
status AS ticket.status
EVIDENCE ON;
CREATE AGENT CAPABILITY support.answer_ticket
DESCRIPTION 'Answer customer tickets with governed context and evidence'
ARG question VARCHAR REQUIRED
HIDDEN tenant_id FROM SESSION tenant_id
HIDDEN principal FROM SESSION principal
HIDDEN current_ticket_id FROM SESSION current_ticket_id
USE CONTEXT support.ticket_context
EXECUTION READ ONLY
RETURNS JSON '{"type":"object","properties":{"draft":{},"evidence_bundle":{}}}'
PROFILE MINIMAL
INLINE EVIDENCE handles_only;import os
from synapsor import Synapsor
db = Synapsor("https://synapsor.ai", api_key=os.environ["SYNAPSOR_API_KEY"])
db.set_session({
"tenant_id": "acme",
"principal": "support_agent_17",
"session_id": "ticket_481_reply",
"current_ticket_id": "481",
})
run = db.agent_runs.start(
workflow="support.ticket_answer_flow",
input={"ticket_id": "481", "question": "Can we waive the late fee?"},
)
result = run.invoke_capability(
"support.answer_ticket",
step_key="answer_ticket",
arguments={"question": "Can we waive the late fee?"},
response_envelope=True,
)
print(result["evidence_bundle_id"])
print(result["result"]["draft"])