Get an agent's flow
curl --request GET \
--url https://sandbox.voice.miraiminds.co/v2/agents/{agent_id}/flow \
--header 'Authorization: Bearer <token>'import requests
url = "https://sandbox.voice.miraiminds.co/v2/agents/{agent_id}/flow"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const url = 'https://sandbox.voice.miraiminds.co/v2/agents/{agent_id}/flow';
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error(err));{
"object": "flow",
"agent_id": "agt_01K2M4P7QRSTVWXYZ0A1B2C3",
"agent_revision": 5,
"flow_revision": "7ad7828b147804858dad",
"flow": {
"nodes": [
{
"id": "persona",
"type": "globalNode",
"data": {
"name": "Persona and rules",
"prompt": "You are Ashu, a service advisor at Mirai Motors.\nSpeak everyday Hindi in Devanagari; common English words such as service, slot and workshop are fine.\nSay one or two short sentences, then listen.\nNever promise a discount, a price or a pickup.\nWhen the condition of one of your functions is met, call it at once without saying anything first.",
"is_start": false,
"allow_interrupt": true,
"add_global_prompt": true,
"extraction_enabled": false,
"extraction_variables": []
}
},
{
"id": "identity",
"type": "startCall",
"data": {
"name": "Confirm the customer",
"prompt": "You have asked whether you are speaking with {{name}}. Wait for the answer.\nIf they confirm, call confirmed_identity.\nIf it is someone else or a wrong number, call wrong_person.\nDo not mention the car or the service before they confirm.",
"greeting": "नमस्ते, मैं मिराई मोटर्स से आशु बोल रहा हूं. क्या मेरी बात {{name}} जी से हो रही है?",
"is_start": true,
"allow_interrupt": true,
"add_global_prompt": true,
"extraction_enabled": false,
"extraction_variables": []
}
},
{
"id": "offer_slot",
"type": "agentNode",
"data": {
"name": "Book the service",
"prompt": "Tell them their {{vehicle}} is due for service on {{due_date}}, and ask which day they can bring it to the workshop.\nWhen they name a day, read it back once and call slot_booked.\nIf they are busy, ask once when to call them back, then call not_now.\nIf they do not want to book at all, call not_now.",
"is_start": false,
"allow_interrupt": true,
"add_global_prompt": true,
"extraction_enabled": true,
"extraction_variables": [
{
"name": "preferred_day",
"type": "string",
"prompt": "The day the customer chose for the service, in their words, for example Saturday or 20 August."
},
{
"name": "callback_time",
"type": "string",
"prompt": "When the customer asked to be called back, in their words. Empty if they did not ask."
}
]
}
},
{
"id": "goodbye",
"type": "endCall",
"data": {
"name": "Close",
"prompt": "In one sentence, repeat what was agreed. Thank them and say goodbye. Do not ask anything else.",
"is_start": false,
"allow_interrupt": false,
"add_global_prompt": true,
"extraction_enabled": false,
"extraction_variables": []
}
},
{
"id": "not_customer",
"type": "endCall",
"data": {
"name": "Wrong person",
"prompt": "Apologise for the trouble and say goodbye. Do not mention the car or the service.",
"is_start": false,
"allow_interrupt": true,
"add_global_prompt": true,
"extraction_enabled": false,
"extraction_variables": []
}
}
],
"edges": [
{
"id": "e1",
"source": "identity",
"target": "offer_slot",
"data": {
"label": "confirmed_identity",
"condition": "The caller confirmed they are the customer you asked for."
}
},
{
"id": "e2",
"source": "identity",
"target": "not_customer",
"data": {
"label": "wrong_person",
"condition": "The caller is someone else, or says it is a wrong number."
}
},
{
"id": "e3",
"source": "offer_slot",
"target": "goodbye",
"data": {
"label": "slot_booked",
"condition": "The customer named a day for the service and you read it back."
}
},
{
"id": "e4",
"source": "offer_slot",
"target": "goodbye",
"data": {
"label": "not_now",
"condition": "The customer does not want to book now, and you have asked once when to call back if they were busy."
}
}
]
}
}{
"error": {
"code": "not_found",
"message": "agent agt_01K2M4P7QRSTVWXYZ0A1B2C3 has no flow; it is a prompt agent"
}
}Flows
Get an agent's flow
The agent’s graph, with what you need to save it back: agent_revision (send it as if_revision) and flow_revision, a fingerprint that changes whenever the graph does. A single-prompt agent has no graph, so it is a 404.
GET
/
v2
/
agents
/
{agent_id}
/
flow
Get an agent's flow
curl --request GET \
--url https://sandbox.voice.miraiminds.co/v2/agents/{agent_id}/flow \
--header 'Authorization: Bearer <token>'import requests
url = "https://sandbox.voice.miraiminds.co/v2/agents/{agent_id}/flow"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const url = 'https://sandbox.voice.miraiminds.co/v2/agents/{agent_id}/flow';
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch(url, options)
.then(res => res.json())
.then(json => console.log(json))
.catch(err => console.error(err));{
"object": "flow",
"agent_id": "agt_01K2M4P7QRSTVWXYZ0A1B2C3",
"agent_revision": 5,
"flow_revision": "7ad7828b147804858dad",
"flow": {
"nodes": [
{
"id": "persona",
"type": "globalNode",
"data": {
"name": "Persona and rules",
"prompt": "You are Ashu, a service advisor at Mirai Motors.\nSpeak everyday Hindi in Devanagari; common English words such as service, slot and workshop are fine.\nSay one or two short sentences, then listen.\nNever promise a discount, a price or a pickup.\nWhen the condition of one of your functions is met, call it at once without saying anything first.",
"is_start": false,
"allow_interrupt": true,
"add_global_prompt": true,
"extraction_enabled": false,
"extraction_variables": []
}
},
{
"id": "identity",
"type": "startCall",
"data": {
"name": "Confirm the customer",
"prompt": "You have asked whether you are speaking with {{name}}. Wait for the answer.\nIf they confirm, call confirmed_identity.\nIf it is someone else or a wrong number, call wrong_person.\nDo not mention the car or the service before they confirm.",
"greeting": "नमस्ते, मैं मिराई मोटर्स से आशु बोल रहा हूं. क्या मेरी बात {{name}} जी से हो रही है?",
"is_start": true,
"allow_interrupt": true,
"add_global_prompt": true,
"extraction_enabled": false,
"extraction_variables": []
}
},
{
"id": "offer_slot",
"type": "agentNode",
"data": {
"name": "Book the service",
"prompt": "Tell them their {{vehicle}} is due for service on {{due_date}}, and ask which day they can bring it to the workshop.\nWhen they name a day, read it back once and call slot_booked.\nIf they are busy, ask once when to call them back, then call not_now.\nIf they do not want to book at all, call not_now.",
"is_start": false,
"allow_interrupt": true,
"add_global_prompt": true,
"extraction_enabled": true,
"extraction_variables": [
{
"name": "preferred_day",
"type": "string",
"prompt": "The day the customer chose for the service, in their words, for example Saturday or 20 August."
},
{
"name": "callback_time",
"type": "string",
"prompt": "When the customer asked to be called back, in their words. Empty if they did not ask."
}
]
}
},
{
"id": "goodbye",
"type": "endCall",
"data": {
"name": "Close",
"prompt": "In one sentence, repeat what was agreed. Thank them and say goodbye. Do not ask anything else.",
"is_start": false,
"allow_interrupt": false,
"add_global_prompt": true,
"extraction_enabled": false,
"extraction_variables": []
}
},
{
"id": "not_customer",
"type": "endCall",
"data": {
"name": "Wrong person",
"prompt": "Apologise for the trouble and say goodbye. Do not mention the car or the service.",
"is_start": false,
"allow_interrupt": true,
"add_global_prompt": true,
"extraction_enabled": false,
"extraction_variables": []
}
}
],
"edges": [
{
"id": "e1",
"source": "identity",
"target": "offer_slot",
"data": {
"label": "confirmed_identity",
"condition": "The caller confirmed they are the customer you asked for."
}
},
{
"id": "e2",
"source": "identity",
"target": "not_customer",
"data": {
"label": "wrong_person",
"condition": "The caller is someone else, or says it is a wrong number."
}
},
{
"id": "e3",
"source": "offer_slot",
"target": "goodbye",
"data": {
"label": "slot_booked",
"condition": "The customer named a day for the service and you read it back."
}
},
{
"id": "e4",
"source": "offer_slot",
"target": "goodbye",
"data": {
"label": "not_now",
"condition": "The customer does not want to book now, and you have asked once when to call back if they were busy."
}
}
]
}
}{
"error": {
"code": "not_found",
"message": "agent agt_01K2M4P7QRSTVWXYZ0A1B2C3 has no flow; it is a prompt agent"
}
}Authorizations
Your workspace secret key, sk_live_ followed by 32 hex characters. Create one in the console under Developers.
Path Parameters
The agent's id (agt_…).
Response
The graph
A node graph: the conversation as nodes with their own instructions and transitions between them. See x-semantics.flow for the rules.
Show child attributes
Show child attributes
sha256 of the canonical graph, first 20 hex characters; also sent to the worker as assistant.flowRevision.
⌘I