Skip to content
dimmiDocs

AI agent

Preview an AI agent turn

POST/api/v1/ai/agents/{agent}/preview

Authorization

Authorizationstringrequired

An API token, sent as Bearer <token>.

Needs the ai:write ability

Path parameters

agentstringrequired

Id of the AI agent, starting with aia_, such as aia_01jx2m8k4t. Find it with GET /ai/agents.

Body

application/json
action_mocksobject

What each action answers instead of really being called, as an object keyed by action id; each value has status (HTTP status, 100 to 599) and body (any JSON), such as {"aac_abc123": {"status": 200, "body": {"order": {"status": "shipped"}}}}. An action with no mock answers with the result of its last live test.

active_stateobject
Show child attributes
branchesobject

Copy it unchanged from the state the last preview turn handed back: an object of step id to the side that step took.

called_action_idsstring[] | null

Copy it unchanged from the state the last preview turn handed back: the list of ids of the actions already called, such as ["aac_01jx2m8k4t"].

completed_step_idsstring[] | null

Copy it unchanged from the state the last preview turn handed back: the list of ids of the procedure's steps already done.

pendingobject[] | null

Copy it unchanged from the state the last preview turn handed back: the list of writes still waiting to be confirmed or approved, each with action_id, tool, args, state and summary.

Show child attributes
action_idstringrequired

Id of the action whose write is waiting, starting with aac_, such as aac_01jx2m8k4t, copied from the last turn's state. Put it in confirmed_action_ids to confirm it.

argsobject

The arguments the waiting write would be called with, as an object, copied unchanged from the last turn's state, such as {"order_id": "1042"}.

statestring

Why the write waits, copied from the last turn's state: awaiting_confirmation (the customer must confirm) or pending_approval (a teammate must approve).

summarystring

The short text that says what the waiting write would do, copied unchanged from the last turn's state.

toolstringrequired

The tool name of the action whose write is waiting, copied unchanged from the last turn's state.

procedure_idstring

Id of the procedure the conversation is in, starting with prc_, such as prc_01jx2m8k4t, copied from the state the last preview turn handed back.

statusstring

Where the procedure stands, copied from the state the last preview turn handed back: active, completed, handed_off or exited. Only active carries the procedure on.

step_outputsobject

Copy it unchanged from the state the last preview turn handed back: an object of what the procedure's steps have produced so far.

confirmed_action_idsstring[] | null

Ids of the waiting writes you confirm or approve this turn, taken from action_id in the pending list of the state the last preview turn handed back (send that state as active_state). At most 10, such as ["aac_01jx2m8k4t"]. You may send these without a message.

Maximum items: 10

historyobject[] | null

The turns so far, oldest first, at most 40, as returned by earlier calls.

Maximum items: 40

Show child attributes
rolestringrequired

Who wrote this earlier message: customer or agent, such as "customer".

Available options:customeragent

textstringrequired

What that earlier message said, at most 4000 characters, such as Hi, where is my order?

Maximum length: 4000

messagestring

What the customer writes, up to 4000 characters.

Maximum length: 4000

personaobject
Show child attributes
attributesobject

The made-up customer's custom attributes, as an object of attribute key to value. They count as trusted. Such as {"plan": "pro"}.

channelstring

The channel the made-up customer writes from: widget, email, slack, whatsapp, instagram, facebook or api. Left out or empty, it is widget. Such as "email".

Available options:widgetemailslackwhatsappinstagramfacebookapi

companyobject

The custom attributes of the made-up customer's company, as an object of attribute key to value, such as {"plan": "enterprise"}.

emailstring

The made-up customer's email address, at most 320 characters, such as ada@example.com.

Maximum length: 320

external_idstring

Your own system's id of the made-up customer, at most 200 characters, such as user_8421. Giving one makes them a known user, not a lead.

Maximum length: 200

inbox_idstring

Id of the inbox the made-up conversation is placed in, starting with inbox_, such as inbox_01jx2m8k4t. Find it with GET /inboxes.

Maximum length: 64

namestring

The made-up customer's name, at most 200 characters, such as Ada Lovelace.

Maximum length: 200

verifiedboolean

true when the made-up customer is signed in, so their identity and email count as verified; false or left out for an unverified visitor.

source_conversation_idstring

A real conversation (conv_...) whose messages the preview replays as the turns so far. The conversation is not changed.

stream_idstring

An id you make up, at most 64 characters, so the turn reports its progress live on your own realtime channel while it happens. Only useful to a client listening on that channel; leave it out otherwise. Such as "sim-7f3a2c".

Maximum length: 64

versionstring

draft tests the working copy, live the published one. Left out, it is draft.

Available options:draftlive

Response 200

OK
dataobjectrequired
Show child attributes
action_callsobject[] | nullrequired

The actions the agent called this turn, in order, each with what it was called with and what it answered. No call reached the workspace's own systems.

Show child attributes
action_idstringrequired

Id of the workspace action the simulation called (starts with aac_).

argsobject

The arguments the action was called with, as a JSON object. Left out when there were none.

blockedboolean

True when the call was stopped before it ran; a blocked call does not count as called in a test's assertions. Left out when false.

succeededbooleanrequired

True when the mocked call answered with success. Nothing real is run in a simulation.

toolstringrequired

The action's tool name, the name the AI calls it by.

active_stateobjectrequired
Show child attributes
branchesobjectrequired

Branches of the procedure taken so far in the simulated conversation, as an object of strings. Send the whole state back with the next turn.

called_action_idsstring[] | nullrequired

Ids of the actions called so far in the simulated conversation. Send the whole state back with the next turn.

completed_step_idsstring[] | nullrequired

Ids of the procedure steps completed so far. Send the whole state back with the next turn.

pendingobject[] | nullrequired

Writes that wait on the customer's confirmation or a teammate's approval; empty for none.

Show child attributes
action_idstringrequired

Id of the action whose write is waiting, such as aac_....

argsobjectrequired

The arguments the action was called with, as an object.

statestringrequired

What the write waits on: awaiting_confirmation for the customer's yes, pending_approval for a teammate's approval.

summarystringrequired

One line saying what the write would do.

toolstringrequired

Name of the tool the agent called for the action.

procedure_idstring

Id of the procedure the simulated conversation is running, such as prc_.... Left out when it runs none.

statusstring

Where the procedure stands: active, completed, handed_off or exited. Left out when no procedure runs.

step_outputsobjectrequired

What the procedure's steps produced so far, as an object. Send the whole state back with the next turn.

handoffobjectrequired
Show child attributes
notestring

Note the agent left for the team at the handover. Left out when there is none.

prioritystring

Priority the handover set on the conversation. Left out when it set none.

reasonstringrequired

Why the simulated turn handed over, such as customer_requested, unknown, frustration, safety or max_replies.

team_idstring

Id of the team the handover sent the conversation to, such as team_.... Left out when it chose none.

objectstringrequired

The kind of record this is, the same for every record of its kind, such as article.

outcomestringrequired

How the turn ended, such as answered, unknown, handoff, refused or error.

procedure_traceany

The procedure the agent followed this turn and the steps it took, as a JSON object. Left out when it followed none.

replystringrequired

What the agent wrote to the customer this turn. Empty when it wrote nothing.

run_idstringrequired

Id of the run that answered this turn.

transferobjectrequired
Show child attributes
agent_idstringrequired

Id of the agent the conversation was passed to (starts with aia_).

from_namestringrequired

Name of the agent that passed the conversation on.

namestringrequired

Name of the agent the conversation was passed to.

summarystringrequired

What the first agent told the next one about the conversation so far.

Response error

Error
codestringrequired

Stable code for programs to tell errors apart, such as validation_failed or internal_error.

errorsobject

Each rejected field mapped to its messages. Only present when the input was invalid.

messagestringrequired

What went wrong, in words safe to show a person.