Support agent
Replies on the Zendesk ticket, comments on the open Jira bug and escalates in Slack.
A local Zendesk Support API for your support agent’s tests. Replies and internal notes stay on the ticket, so a test can check which ticket the agent answered.
Monthly CSV export is empty #4101
erin.walsh@ridgeway-robotics.example
Our monthly CSV export has been empty since Monday.
Acme Support replied
Hi Erin, the fix for the empty CSV export ships on Thursday.
Erin Walsh at Ridgeway Robotics has two open tickets: her monthly CSV export is empty, and, since three hours ago, her invoice shows the wrong billing address. The agent was told to answer the CSV ticket. It searched her open tickets and replied on the first result, the newest one: the invoice.
Both versions post a reply and every call succeeds, so only a check on which ticket catches it. Changing one line in the agent makes both checks pass, with the test unchanged.
| Check | Original agent | Fixed agent |
|---|---|---|
| Replied on the CSV ticket | 0 of 3 | 3 of 3 |
| Left the invoice ticket alone | 0 of 3 | 3 of 3 |
Scripted agent, no model. Recorded with CLI 0.4.74.
- const ticket = results[0];+ const ticket = results.find(ticket => ticket.subject.includes('CSV'));Save agent.mjs and scene.yaml in an empty directory. You need Node.js 24.
npm install -g @ancha-labs/cli
ancha init --agent "node agent.mjs"
ancha run scene.yaml --local -n 3
ancha baseline save before
# change results[0] to results.find(ticket => ticket.subject.includes('CSV')) in agent.mjs
ancha run scene.yaml --local -n 3 --compare beforeWhen ancha runs your agent, it sets:
ZENDESK_API_URLZENDESK_EMAILZENDESK_API_TOKENPoint the client you already use at them.
const { ZENDESK_API_URL, ZENDESK_EMAIL, ZENDESK_API_TOKEN } = process.env;
const credentials = `${ZENDESK_EMAIL}/token:${ZENDESK_API_TOKEN}`;
const auth = 'Basic ' + Buffer.from(credentials).toString('base64');
const query = encodeURIComponent('type:ticket status<solved');
const res = await fetch(`${ZENDESK_API_URL}/search.json?query=${query}`, {
headers: { authorization: auth },
});
const { results } = await res.json();Locally, ancha runs your agent as an ordinary process, so keep real Zendesk credentials out of its environment.
/api/v2/brands/api/v2/groups/api/v2/macros/api/v2/organizations/api/v2/organizations/{id}/api/v2/organizations/{id}/tickets/api/v2/organizations/autocomplete/api/v2/organizations/search/api/v2/search/api/v2/tickets/api/v2/tickets/api/v2/tickets/{id}/api/v2/tickets/{id}/api/v2/tickets/{id}/api/v2/tickets/{id}/comments/api/v2/tickets/{id}/macros/{macro_id}/apply/api/v2/tickets/count/api/v2/users/api/v2/users/api/v2/users/{id}/api/v2/users/{id}/tickets/requested/api/v2/users/me/api/v2/users/search/api/v2/views/api/v2/views/{id}/ticketsReplies on the Zendesk ticket, comments on the open Jira bug and escalates in Slack.
It keeps data between calls: a reply your agent posts is on the ticket when it reads the ticket again. Ancha’s mock serves the Zendesk Support API v2 for tickets, comments, search, users, organizations, groups, macros and views, with the tickets and customers you seed.
Write the tickets and customers into a test, run the agent with ancha, and check what it did. ancha sets ZENDESK_API_URL, ZENDESK_EMAIL and ZENDESK_API_TOKEN for the agent. The example on this page needs no Zendesk account, API token or model.
Zendesk’s sandbox is a copy of your Zendesk account for trying out changes, available on some Zendesk plans. Ancha’s mock starts from the tickets a test seeds and needs no Zendesk account, and every trial starts from the same data, so you can run an agent three times and compare.
Yes. A test can name several tools, and they share one seeded company. The example on the Jira page reads a Zendesk ticket and escalates it in Jira in the same world.
No. Your agent talks to the ZENDESK_API_URL and token that ancha sets, so every reply it posts lands on the simulated ticket.
Run the example on your machine.
Ancha is not affiliated with Zendesk.