Test an escalation agent with a Jira API mock.

A local Jira Cloud REST API for your agent’s tests. Issues, comments and transitions it makes stay in the project, so a test can check what it filed and where it commented.

See the example
Platform Operations

Open bugs

  • OPS-2In Progress

    CSV export returns an empty file · Rachel Moore

  • OPS-1To Do

    SSO login loops on Safari

Acme Support commented on OPS-2

Zendesk #4101, Ridgeway Robotics: Monthly CSV export is empty.

The project after the fixed agent runs: still two bugs, and a comment on OPS-2. Starting data and checks from scene.yaml.

An agent filed a duplicate bug

Erin Walsh’s monthly CSV export is empty, and Zendesk ticket #4101 says so. Engineering already has the bug: OPS-2, In Progress with Rachel Moore. The agent was told to comment on an open bug or file one. It searched for bugs in To Do, found none, and filed a second one.

The test checks the agent’s calls to Jira: it must search, must not create an issue, and must comment on OPS-2. Changing one line in the agent makes all three pass, with the test unchanged.

Escalation check3 trials / version
CheckOriginal agentFixed agent
Searched for the bug3 of 33 of 3
Filed no duplicate0 of 33 of 3
Commented on OPS-20 of 33 of 3

Scripted agent, no model. Recorded with CLI 0.4.74.

The one-line fix

agent.mjs
- const jql = 'project = OPS AND status = "To Do" AND text ~ "CSV export"';+ const jql = 'project = OPS AND statusCategory != Done AND text ~ "CSV export"';

Run it yourself

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 status = "To Do" to statusCategory != Done in agent.mjs
ancha run scene.yaml --local -n 3 --compare before

Connect your agent to the Jira mock

When ancha runs your agent, it sets:

  • JIRA_BASE_URL
  • JIRA_EMAIL
  • JIRA_API_TOKEN

Point the client you already use at them.

const { JIRA_BASE_URL, JIRA_EMAIL, JIRA_API_TOKEN } = process.env;
const credentials = `${JIRA_EMAIL}:${JIRA_API_TOKEN}`;
const auth = 'Basic ' + Buffer.from(credentials).toString('base64');

const jql = encodeURIComponent('project = OPS AND statusCategory != Done');
const fields = 'summary,status,assignee';
const path = `/rest/api/3/search/jql?jql=${jql}&fields=${fields}`;
const response = await fetch(JIRA_BASE_URL + path, {
  headers: { Authorization: auth, Accept: 'application/json' },
});
const { issues } = await response.json();

Locally, ancha runs your agent as an ordinary process, so keep real Jira credentials out of its environment.

See all 57 endpoints

agile

POST/rest/agile/1.0/backlog/issue
GET/rest/agile/1.0/board
GET/rest/agile/1.0/board/:id
GET/rest/agile/1.0/board/:id/backlog
GET/rest/agile/1.0/board/:id/issue
GET/rest/agile/1.0/board/:id/sprint
POST/rest/agile/1.0/sprint
GET/rest/agile/1.0/sprint/:id
POST/rest/agile/1.0/sprint/:id
GET/rest/agile/1.0/sprint/:id/issue
POST/rest/agile/1.0/sprint/:id/issue

api

GET/rest/api/3/field
POST/rest/api/3/issue
GET/rest/api/3/issue/:key
PUT/rest/api/3/issue/:key
DELETE/rest/api/3/issue/:key
PUT/rest/api/3/issue/:key/assignee
GET/rest/api/3/issue/:key/changelog
GET/rest/api/3/issue/:key/comment
POST/rest/api/3/issue/:key/comment
GET/rest/api/3/issue/:key/comment/:id
PUT/rest/api/3/issue/:key/comment/:id
DELETE/rest/api/3/issue/:key/comment/:id
GET/rest/api/3/issue/:key/transitions
POST/rest/api/3/issue/:key/transitions
GET/rest/api/3/issue/:key/watchers
POST/rest/api/3/issue/:key/watchers
DELETE/rest/api/3/issue/:key/watchers
POST/rest/api/3/issue/bulk
GET/rest/api/3/issue/createmeta/:key/issuetypes
GET/rest/api/3/issue/createmeta/:key/issuetypes/:type
POST/rest/api/3/issueLink
GET/rest/api/3/issueLink/:id
DELETE/rest/api/3/issueLink/:id
GET/rest/api/3/issueLinkType
GET/rest/api/3/issuetype
GET/rest/api/3/label
GET/rest/api/3/myself
GET/rest/api/3/priority
GET/rest/api/3/project
GET/rest/api/3/project/:key
GET/rest/api/3/project/:key/components
GET/rest/api/3/project/:key/statuses
GET/rest/api/3/project/:key/versions
GET/rest/api/3/project/search
GET/rest/api/3/resolution
GET/rest/api/3/search
POST/rest/api/3/search
POST/rest/api/3/search/approximate-count
GET/rest/api/3/search/jql
POST/rest/api/3/search/jql
GET/rest/api/3/serverInfo
GET/rest/api/3/status
GET/rest/api/3/statuscategory
GET/rest/api/3/user
GET/rest/api/3/user/assignable/search
GET/rest/api/3/user/search

Tested together

All 43 tools

Jira API mock FAQ

What is a stateful Jira API mock?

It keeps data between calls: an issue or comment your agent creates is there on the next search. Ancha’s mock serves the Jira Cloud REST API v3 and the Jira Software agile API for projects, issues, comments, transitions, JQL search, boards and sprints, with the projects and issues you seed.

How can I test a Jira agent without a Jira site?

Write the projects and issues into a test, run the agent with ancha, and check its calls. ancha sets JIRA_BASE_URL, JIRA_EMAIL and JIRA_API_TOKEN for the agent. The example on this page needs no Atlassian account, API token or model.

How is this different from a Jira sandbox?

Atlassian’s sandboxes are copies of a production Jira site on Premium and Enterprise plans, for trying out changes. Ancha’s mock starts from the issues a test seeds and needs no Atlassian account, and every trial starts from the same data.

Does JQL behave the way it does on Jira?

JQL runs against the seeded issues. statusCategory != Done finds work in To Do, In Progress and In Review, and a status the workflow does not have returns Jira’s 400 error. POST /rest/api/3/search/jql returns issue ids unless you request fields, as on Jira Cloud.

Can one test use Jira and Zendesk together?

Yes. A test can name several tools, and they share one seeded company. The example on this page reads Zendesk ticket #4101 and works in Jira in the same world, and its checks read the agent’s calls.

Is this connected to my Jira site?

No. Your agent talks to the JIRA_BASE_URL and token that ancha sets, so every issue and comment it writes stays in the simulated project.

Run the example on your machine.

Book a demo

Ancha is not affiliated with Jira.