Docs

Help desk / Assistant

Analytics with Code Mode

Ask the Assistant for counts, trends, rankings and exports. In Code Mode it writes and runs a short program over your tickets and setup, then answers with a table, a CSV file or a live page with charts.

Ask the Assistant a question about your data and it answers with the numbers: how many tickets each category got last month, the median time to resolve in each department, who opened the most requests, which campaign recipients haven't answered. For questions like these, the Assistant writes a short program, runs it in a sandbox over your data, and gives you the result as a table, a file you can download, or a live page with charts. This is Code Mode.

You don't turn Code Mode on. It's in every conversation, and the Assistant uses it when a question needs it. You don't need to write code or say "code mode".

Prerequisites

  • The Org Admin or Org Manager role, or the Supervisor role in a department. Supervisors read less data. See What it can read.
  • To read a department's tickets, you must be an Agent or Supervisor of the department, or of its parent, also when you are an Org Admin.

Ask an analytics question

  1. Ask in plain English

    Open a new conversation on the Assistant page, or press ⌘J on any page. Say what you want to know, for which tickets, and in what form. For example: "How many tickets did each IT category get last month, and which categories took longest to resolve? Save the full table as a CSV."

  2. The Assistant runs a program

    The Assistant writes a TypeScript program that reads your data with its tools, then counts, groups and sorts it, and runs it in the sandbox. The reply's tool activity folds it into one line, such as "Ran 1 program".

  3. Read the answer

    The answer comes back as a table, with the numbers the program computed. A file the program saved shows as a card with a preview and Download.

    An analytics answer from the Assistant's Code Mode: the tool activity with one program, a summary, and a CSV file card with a preview
  4. Check how it was computed

    Click the tool activity, then the program, to read its code. Each tool the program called shows as its own row, with its parameters and result. If a definition isn't what you meant, say so, and the Assistant runs it again.

  5. Keep it

    Download the file, or ask for a page: "Build me a page with this as a bar chart." See Charts and live pages.

How Code Mode works

  • One program, one result. The Assistant writes a TypeScript program. The program calls the Assistant's own read tools, such as the tool that lists tickets, as many times as it needs, and does the arithmetic. Only the program's result goes back to the Assistant, so it can work through thousands of tickets without reading each one into the conversation.
  • Exact numbers. Counts, averages, medians, percentages and date math are computed by the program, not estimated by the AI.
  • Each read is recorded. Every tool call inside a program is checked against your permissions and recorded like any other tool call.
  • A closed sandbox. The program runs in an isolated sandbox with no access to the internet, files or anything else, unless it declares a website to call. See Scripts that call outside APIs.
  • When the Assistant uses it. For arithmetic, dates and statistics; for filtering, sorting, grouping and joining; and for questions that need many reads, such as one lookup for each ticket. For one or two reads with nothing to compute, it calls the tools directly.

Limits

LimitValue
Time for one program90 seconds
Tool calls running at the same time8
Tickets in one read100. The program reads page after page
The result the program hands back to the Assistant6,000 characters. Bigger results go into a file
One saved file1 million characters
All files in one conversation128 million characters

In a large organization, a question over a long period can run out of time. Narrow it to a department or a shorter period, or ask the Assistant to split the work.

What it can read

A program can call every tool the Assistant has that only reads. These are the main ones:

DataWhat a program getsWho
TicketsThe key, title, request text, status, source, created, modified and resolved times, requester, assignee, department, category, priority (and whether AI suggested it), tags and additional ticket field values. Filters: text search, status, department, requester, assignee, created date range and ticket field valuesEveryone, for tickets in departments they can read
Ticket commentsEvery comment, with internal notes if askedEveryone, as for tickets
What the agent did on a ticketWhich runbook matched, whether the agent followed it, which knowledge it retrieved, and its activityEveryone, as for tickets
Departments, categories, ticket fieldsNames, settings and categoriesEveryone
PeopleProfiles and IdP group membershipsEveryone
Runbooks, tools, applicationsThe lists and their settingsEveryone
Access rulesEach rule with its app, whether it needs approval and its time limitOrg Admins and Managers
CampaignsCampaigns, and each recipient's response and its stateOrg Admins and Managers
Automation opportunitiesAccess rules to create and runbook templates to use, ranked, from up to 90 days of ticketsOrg Admins and Managers
Knowledge gapsThe latest saved knowledge gap reportEveryone, for their departments
Audit LogConfiguration changes in a date rangeOrg Admins and Managers
AlertsOpen errors and warnings from the last 14 daysOrg Admins and Managers
KnowledgeSearch results from your knowledge sourcesEveryone
Your organization's toolsAny tool that only reads, such as an Okta user lookup or a script toolEveryone, for the tools they can run

Auto-solved and escalated tickets carry the Auto-Solved and Escalated tags, so a program can compute auto-solve rates from the tags.

Data it doesn't have

  • SLA status. A program doesn't see a ticket's Response and Resolution SLA. Use the tickets list's SLA filters and sort. See SLAs.
  • Access grants. Who has access until when is on the Access grants page.
  • The Analytics page's charts and ratings. The program computes its own numbers from tickets, which can differ from Analytics when the definitions differ. Thumbs-up and thumbs-down ratings on tickets aren't available.
  • Tickets by resolved date. Tickets are filtered by when they were created. For "resolved last month", the program reads a wider created range and keeps the tickets resolved in the month.

Questions to try

AskWhat the program uses
"What's the auto-solve rate for each department over the last 30 days?"Tickets by department and created date, and the Auto-Solved and Escalated tags
"How many tickets did each category get this quarter? Save it as a CSV."Tickets in the quarter, grouped by category
"What's the mean and median time to resolve by priority in IT since September?"Created and resolved times, and priority
"Who were the top 10 requesters last month, and what did they ask for most?"Requester, category and title
"How many open tickets does each agent have, and how old is the oldest?"Status, assignee and created time
"Tickets by source (Slack, Teams, email) per week since June, as a table."Source and created time
"How many VPN tickets have we had each week this year?"Text search and created time
"Break down Facilities tickets by the Location field."Additional ticket field values
"Which recipients of the laptop survey haven't answered? Save them as a CSV."Campaign responses and their state
"Which access rules need no approval?"Access rules and their approval settings
"For last week's tickets, how often did the agent follow the runbook it matched?"Runbook history, one read for each ticket

Ask for better numbers

  • Give the period and the scope: "created in October", "IT and its sub-departments", "excluding tickets from bots".
  • Define the measure when it could mean two things: "time to resolve from creation to resolution, in hours", "auto-solved means tagged Auto-Solved and never escalated".
  • Ask for the format: a table in the chat, a CSV for a spreadsheet, or a page with charts.
  • Check the program in the tool activity when a number surprises you.
  • Build on the last answer: "now split that by month", "only the ones with no assignee". The Assistant keeps the conversation's files and context.

Files

Only a program can save a file. It saves the data it computes as .csv, .json, .md or .txt, up to 1 million characters each. All the files in one conversation can hold 128 million characters in total. Each save counts toward that total, including a new version of a file that already exists.

The file appears in the conversation as a card with its size, line count, and a 12-line preview, plus a copy button and Download. A .csv file previews as a table: the first row is the header, and the table shows the next 12 rows. When the file has more rows, a button at the bottom of the table says how many rows are hidden (for example 40 more rows · Download all 52) and downloads the file.

Files belong to the conversation they were saved in. A new conversation starts with none. A program in the same conversation can read the files saved earlier, so you can build on a file in a later question.

Text that a tool returns for you to read, such as the knowledge gap report, appears in the reply, not as a file.

Charts and live pages

For charts, or a view your team can open again, ask the Assistant for an artifact: a page in the dashboard that runs your tools when someone opens it. For example: "Build a page that shows open tickets per department as a bar chart, with a button to refresh."

  • Org Admins and Managers can build and open artifacts. Supervisors can't.
  • The page draws its own charts. It reads its data live each time it opens, and can refresh on a button or on a timer of 30 seconds or more.
  • Numbers that the Assistant writes into the page itself, such as a table copied from the conversation, are a snapshot. They change only when the Assistant changes the page.
  • A page runs as the person viewing it, so two people can see different numbers.

Building a page waits for your approval on a Create Artifact card in Read only mode.

Scripts that call tools that make changes

A program can also make changes in bulk, for example "assign every unassigned IT ticket older than a week to me" or "add these 40 people to the Figma Editors group". When the program calls a tool that your approval mode stops, one approval card appears before the program runs. The card lists each of these tools under This program calls tools that need approval, with one of these badges:

  • write: the tool changes something.
  • hard to undo: the tool makes a change that is hard to reverse.
  • needs approval: the tool is set to Required approval.

The card then shows the full program. Approve runs the program once, exactly as written. Nothing runs before you approve, so the card cannot show a preview of the result. A program cannot call a built-in tool set to Required approval. The Assistant asks for that tool on its own card.

A program can call a tool from a custom API source or an external MCP server by its alias, tools.<source>.<tool> (for example, tools.linear.get_issue). A read-only tool from these sources runs without a card. Any other tool from these sources puts the program on the approval card in every approval mode, also when the tool is set to Required approval. Risotto treats every tool from an external MCP server as a tool that makes changes, so a program that calls one always shows the card. The card and the tool activity show each tool by its own name.

Scripts that call outside APIs

A program can also call an outside API over HTTPS, for example to test a vendor API before the Assistant writes a script tool for it. The program declares each domain it calls, and can call only those, on the public internet. It can use a credential from your Credential Vault, which Risotto adds to the request only when the request leaves the sandbox. The program never sees the value. If the Assistant needs a credential that is not in the vault, it asks you to add it on a secure credential card.

A program that declares a domain or uses a credential always shows the approval card first, in every approval mode, even if it only reads. The card adds these rows:

  • Reaches over HTTP: each domain, and whether the program makes only GET requests or also POST, PUT, PATCH, and DELETE requests.
  • Uses vault credentials: each credential the program uses and, for a department credential, the hosts it may reach. Risotto adds the value only to requests to those hosts and their subdomains. See Department credentials.

A Supervisor's program can call an outside API only with a vault credential that lists the hosts it may reach.

Something wrong or missing? Report an issue · View as Markdown