Triage a support request
Turn an incoming message into an order ID, a category and a requested resolution.
Give the agent a narrow job
Follow the quickstart to install the SDK and set NULLPROTOCOL_KEY. Create an agent with ID support or replace that ID in the code. Use these instructions:
Instructions
Read incoming shop requests.
Use only the supplied facts.
Use null when the message does not contain an order ID.
Do not promise refunds or invent order details.Read and classify the message
support.py
from nullprotocol import NullProtocol
with NullProtocol() as client:
agent = client.load("support")
result = agent.extract(
"Order 4821 arrived yesterday. One mug is broken. I want a replacement.",
{
"type": "object",
"properties": {
"orderId": {"type": ["integer", "null"]},
"category": {
"type": "string", "enum": ["damaged_item", "delivery", "other"],
},
"requestedResolution": {
"type": "string", "enum": ["replacement", "refund", "unspecified"],
},
},
"required": ["orderId", "category", "requestedResolution"],
"additionalProperties": False,
},
)
if not result.success:
raise RuntimeError(result.error)
print(result.data)A matching extraction has order ID 4821, category damaged_item and requested resolution replacement. Your application then looks up the order and checks that the caller may access it.
Add the next step only when you need it
Keep order lookup and eligibility rules in application code. If an action requires judgement, pass the authorized order facts into a second decide call. Register a handler to create a review ticket; do not let classification itself trigger a refund.