Stream Agent Build
Stream Agent Build with the DialNexa API. Streams build progress as newline-delimited JSON and returns the generated draft configuration without saving or publishing an agent.
curl --request POST \
--url https://api.dialnexa.com/v1/agent-builder/run/stream \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"structured_input": {
"company_and_offering": {
"description": "Company and offering",
"value": "Acme provides appointment scheduling software."
},
"target_customer": {
"description": "Target customer",
"value": "Small business owners who requested a demo."
},
"primary_goal": {
"description": "Call goal",
"value": "Arrange a product demo."
},
"success_criteria": {
"description": "Success criteria",
"value": "Confirm interest and a preferred callback time."
},
"information_to_collect": {
"description": "Information to collect",
"value": "Name and preferred callback time."
},
"objections_and_faqs": {
"description": "Questions",
"value": "Explain that the demo is free."
},
"agent_tone": {
"description": "Tone",
"value": "Friendly, concise, and professional."
},
"additional_context": {
"description": "Context",
"value": "Do not promise pricing or unavailable appointment slots."
}
}
}
'import requests
url = "https://api.dialnexa.com/v1/agent-builder/run/stream"
payload = { "structured_input": {
"company_and_offering": {
"description": "Company and offering",
"value": "Acme provides appointment scheduling software."
},
"target_customer": {
"description": "Target customer",
"value": "Small business owners who requested a demo."
},
"primary_goal": {
"description": "Call goal",
"value": "Arrange a product demo."
},
"success_criteria": {
"description": "Success criteria",
"value": "Confirm interest and a preferred callback time."
},
"information_to_collect": {
"description": "Information to collect",
"value": "Name and preferred callback time."
},
"objections_and_faqs": {
"description": "Questions",
"value": "Explain that the demo is free."
},
"agent_tone": {
"description": "Tone",
"value": "Friendly, concise, and professional."
},
"additional_context": {
"description": "Context",
"value": "Do not promise pricing or unavailable appointment slots."
}
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
structured_input: {
company_and_offering: {
description: 'Company and offering',
value: 'Acme provides appointment scheduling software.'
},
target_customer: {
description: 'Target customer',
value: 'Small business owners who requested a demo.'
},
primary_goal: {description: 'Call goal', value: 'Arrange a product demo.'},
success_criteria: {
description: 'Success criteria',
value: 'Confirm interest and a preferred callback time.'
},
information_to_collect: {
description: 'Information to collect',
value: 'Name and preferred callback time.'
},
objections_and_faqs: {description: 'Questions', value: 'Explain that the demo is free.'},
agent_tone: {description: 'Tone', value: 'Friendly, concise, and professional.'},
additional_context: {
description: 'Context',
value: 'Do not promise pricing or unavailable appointment slots.'
}
}
})
};
fetch('https://api.dialnexa.com/v1/agent-builder/run/stream', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.dialnexa.com/v1/agent-builder/run/stream",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'structured_input' => [
'company_and_offering' => [
'description' => 'Company and offering',
'value' => 'Acme provides appointment scheduling software.'
],
'target_customer' => [
'description' => 'Target customer',
'value' => 'Small business owners who requested a demo.'
],
'primary_goal' => [
'description' => 'Call goal',
'value' => 'Arrange a product demo.'
],
'success_criteria' => [
'description' => 'Success criteria',
'value' => 'Confirm interest and a preferred callback time.'
],
'information_to_collect' => [
'description' => 'Information to collect',
'value' => 'Name and preferred callback time.'
],
'objections_and_faqs' => [
'description' => 'Questions',
'value' => 'Explain that the demo is free.'
],
'agent_tone' => [
'description' => 'Tone',
'value' => 'Friendly, concise, and professional.'
],
'additional_context' => [
'description' => 'Context',
'value' => 'Do not promise pricing or unavailable appointment slots.'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.dialnexa.com/v1/agent-builder/run/stream"
payload := strings.NewReader("{\n \"structured_input\": {\n \"company_and_offering\": {\n \"description\": \"Company and offering\",\n \"value\": \"Acme provides appointment scheduling software.\"\n },\n \"target_customer\": {\n \"description\": \"Target customer\",\n \"value\": \"Small business owners who requested a demo.\"\n },\n \"primary_goal\": {\n \"description\": \"Call goal\",\n \"value\": \"Arrange a product demo.\"\n },\n \"success_criteria\": {\n \"description\": \"Success criteria\",\n \"value\": \"Confirm interest and a preferred callback time.\"\n },\n \"information_to_collect\": {\n \"description\": \"Information to collect\",\n \"value\": \"Name and preferred callback time.\"\n },\n \"objections_and_faqs\": {\n \"description\": \"Questions\",\n \"value\": \"Explain that the demo is free.\"\n },\n \"agent_tone\": {\n \"description\": \"Tone\",\n \"value\": \"Friendly, concise, and professional.\"\n },\n \"additional_context\": {\n \"description\": \"Context\",\n \"value\": \"Do not promise pricing or unavailable appointment slots.\"\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.dialnexa.com/v1/agent-builder/run/stream")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"structured_input\": {\n \"company_and_offering\": {\n \"description\": \"Company and offering\",\n \"value\": \"Acme provides appointment scheduling software.\"\n },\n \"target_customer\": {\n \"description\": \"Target customer\",\n \"value\": \"Small business owners who requested a demo.\"\n },\n \"primary_goal\": {\n \"description\": \"Call goal\",\n \"value\": \"Arrange a product demo.\"\n },\n \"success_criteria\": {\n \"description\": \"Success criteria\",\n \"value\": \"Confirm interest and a preferred callback time.\"\n },\n \"information_to_collect\": {\n \"description\": \"Information to collect\",\n \"value\": \"Name and preferred callback time.\"\n },\n \"objections_and_faqs\": {\n \"description\": \"Questions\",\n \"value\": \"Explain that the demo is free.\"\n },\n \"agent_tone\": {\n \"description\": \"Tone\",\n \"value\": \"Friendly, concise, and professional.\"\n },\n \"additional_context\": {\n \"description\": \"Context\",\n \"value\": \"Do not promise pricing or unavailable appointment slots.\"\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.dialnexa.com/v1/agent-builder/run/stream")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"structured_input\": {\n \"company_and_offering\": {\n \"description\": \"Company and offering\",\n \"value\": \"Acme provides appointment scheduling software.\"\n },\n \"target_customer\": {\n \"description\": \"Target customer\",\n \"value\": \"Small business owners who requested a demo.\"\n },\n \"primary_goal\": {\n \"description\": \"Call goal\",\n \"value\": \"Arrange a product demo.\"\n },\n \"success_criteria\": {\n \"description\": \"Success criteria\",\n \"value\": \"Confirm interest and a preferred callback time.\"\n },\n \"information_to_collect\": {\n \"description\": \"Information to collect\",\n \"value\": \"Name and preferred callback time.\"\n },\n \"objections_and_faqs\": {\n \"description\": \"Questions\",\n \"value\": \"Explain that the demo is free.\"\n },\n \"agent_tone\": {\n \"description\": \"Tone\",\n \"value\": \"Friendly, concise, and professional.\"\n },\n \"additional_context\": {\n \"description\": \"Context\",\n \"value\": \"Do not promise pricing or unavailable appointment slots.\"\n }\n }\n}"
response = http.request(request)
puts response.read_body"{\"type\":\"phase_start\",\"phase\":\"thinking\"}\n{\"type\":\"thinking_delta\",\"delta\":\"Reading your requirements\",\"label\":\"Understanding your needs\",\"phase\":\"thinking\"}\n"Before you begin
Use a server-side API key for the intended workspace.Stream Agent Build request
The request panel lists supported query parameters and body fields. For a request body, the example below supplies the required fields. Replace sample values with your own inputs.curl --request POST 'https://api.dialnexa.com/v1/agent-builder/run/stream' \
--header "Authorization: Bearer $DIALNEXA_API_KEY" \
--header 'Content-Type: application/json' \
--data '{
"structured_input": {
"company_and_offering": {
"description": "Company and offering",
"value": "Acme provides appointment scheduling software."
},
"target_customer": {
"description": "Target customer",
"value": "Small business owners who requested a demo."
},
"primary_goal": {
"description": "Call goal",
"value": "Arrange a product demo."
},
"success_criteria": {
"description": "Success criteria",
"value": "Confirm interest and a preferred callback time."
},
"information_to_collect": {
"description": "Information to collect",
"value": "Name and preferred callback time."
},
"objections_and_faqs": {
"description": "Questions",
"value": "Explain that the demo is free."
},
"agent_tone": {
"description": "Tone",
"value": "Friendly, concise, and professional."
},
"additional_context": {
"description": "Context",
"value": "Do not promise pricing or unavailable appointment slots."
}
}
}'
Verify the result
Expect HTTP200 with Content-Type: application/x-ndjson. Parse complete lines as JSON. A complete event contains data; an error event can arrive after HTTP headers have already been sent. There is no success envelope around the stream.
Progress events include phase_start, phase_complete, thinking_delta, and building_event. The final result includes status, missingQuestions, evaluation, and draftAgent. A completed stream is not proof that an agent was saved.
This operation also accepts the matching /v1/assistant path. The request and result contracts are shared. Use one path consistently for your integration.
Retry safety
This operation does not modify workspace resources. Retry after a transient connection failure.Errors and recovery
401: Missing, expired, or invalid API key.
Related endpoints
- Get Agent Builder Inventory
- Build Agent Configuration
- Generate Agent Objectives
- Generate Agent Tone
- API authentication
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
Structured blueprint submission - each field has a description (field guidance) and value (user answer)
Show child attributes
Show child attributes
Build attempt number (1-2). Validation runs only on attempt 1; attempt 2 skips re-validation.
1 <= x <= 2Engine for the generated agent. "s2s" builds the realtime pipeline on the same single-prompt agent; anything else builds the cascaded pipeline.
cascaded, s2s Kind of agent to build. "cfa" writes a conversation-flow document (a step graph), "ivr" writes a touch-tone menu; anything else builds a single-prompt agent.
spa, cfa, ivr Response
NDJSON stream of thinking updates and final result
One JSON object per line. Event types: phase_start, phase_complete, thinking_delta, building_event, complete, error. The complete event contains data with status, events, missingQuestions, evaluation, draftAgent, promptText, welcomeMessage, technicalProfile, and error.
curl --request POST \
--url https://api.dialnexa.com/v1/agent-builder/run/stream \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"structured_input": {
"company_and_offering": {
"description": "Company and offering",
"value": "Acme provides appointment scheduling software."
},
"target_customer": {
"description": "Target customer",
"value": "Small business owners who requested a demo."
},
"primary_goal": {
"description": "Call goal",
"value": "Arrange a product demo."
},
"success_criteria": {
"description": "Success criteria",
"value": "Confirm interest and a preferred callback time."
},
"information_to_collect": {
"description": "Information to collect",
"value": "Name and preferred callback time."
},
"objections_and_faqs": {
"description": "Questions",
"value": "Explain that the demo is free."
},
"agent_tone": {
"description": "Tone",
"value": "Friendly, concise, and professional."
},
"additional_context": {
"description": "Context",
"value": "Do not promise pricing or unavailable appointment slots."
}
}
}
'import requests
url = "https://api.dialnexa.com/v1/agent-builder/run/stream"
payload = { "structured_input": {
"company_and_offering": {
"description": "Company and offering",
"value": "Acme provides appointment scheduling software."
},
"target_customer": {
"description": "Target customer",
"value": "Small business owners who requested a demo."
},
"primary_goal": {
"description": "Call goal",
"value": "Arrange a product demo."
},
"success_criteria": {
"description": "Success criteria",
"value": "Confirm interest and a preferred callback time."
},
"information_to_collect": {
"description": "Information to collect",
"value": "Name and preferred callback time."
},
"objections_and_faqs": {
"description": "Questions",
"value": "Explain that the demo is free."
},
"agent_tone": {
"description": "Tone",
"value": "Friendly, concise, and professional."
},
"additional_context": {
"description": "Context",
"value": "Do not promise pricing or unavailable appointment slots."
}
} }
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
structured_input: {
company_and_offering: {
description: 'Company and offering',
value: 'Acme provides appointment scheduling software.'
},
target_customer: {
description: 'Target customer',
value: 'Small business owners who requested a demo.'
},
primary_goal: {description: 'Call goal', value: 'Arrange a product demo.'},
success_criteria: {
description: 'Success criteria',
value: 'Confirm interest and a preferred callback time.'
},
information_to_collect: {
description: 'Information to collect',
value: 'Name and preferred callback time.'
},
objections_and_faqs: {description: 'Questions', value: 'Explain that the demo is free.'},
agent_tone: {description: 'Tone', value: 'Friendly, concise, and professional.'},
additional_context: {
description: 'Context',
value: 'Do not promise pricing or unavailable appointment slots.'
}
}
})
};
fetch('https://api.dialnexa.com/v1/agent-builder/run/stream', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.dialnexa.com/v1/agent-builder/run/stream",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'structured_input' => [
'company_and_offering' => [
'description' => 'Company and offering',
'value' => 'Acme provides appointment scheduling software.'
],
'target_customer' => [
'description' => 'Target customer',
'value' => 'Small business owners who requested a demo.'
],
'primary_goal' => [
'description' => 'Call goal',
'value' => 'Arrange a product demo.'
],
'success_criteria' => [
'description' => 'Success criteria',
'value' => 'Confirm interest and a preferred callback time.'
],
'information_to_collect' => [
'description' => 'Information to collect',
'value' => 'Name and preferred callback time.'
],
'objections_and_faqs' => [
'description' => 'Questions',
'value' => 'Explain that the demo is free.'
],
'agent_tone' => [
'description' => 'Tone',
'value' => 'Friendly, concise, and professional.'
],
'additional_context' => [
'description' => 'Context',
'value' => 'Do not promise pricing or unavailable appointment slots.'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.dialnexa.com/v1/agent-builder/run/stream"
payload := strings.NewReader("{\n \"structured_input\": {\n \"company_and_offering\": {\n \"description\": \"Company and offering\",\n \"value\": \"Acme provides appointment scheduling software.\"\n },\n \"target_customer\": {\n \"description\": \"Target customer\",\n \"value\": \"Small business owners who requested a demo.\"\n },\n \"primary_goal\": {\n \"description\": \"Call goal\",\n \"value\": \"Arrange a product demo.\"\n },\n \"success_criteria\": {\n \"description\": \"Success criteria\",\n \"value\": \"Confirm interest and a preferred callback time.\"\n },\n \"information_to_collect\": {\n \"description\": \"Information to collect\",\n \"value\": \"Name and preferred callback time.\"\n },\n \"objections_and_faqs\": {\n \"description\": \"Questions\",\n \"value\": \"Explain that the demo is free.\"\n },\n \"agent_tone\": {\n \"description\": \"Tone\",\n \"value\": \"Friendly, concise, and professional.\"\n },\n \"additional_context\": {\n \"description\": \"Context\",\n \"value\": \"Do not promise pricing or unavailable appointment slots.\"\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.dialnexa.com/v1/agent-builder/run/stream")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"structured_input\": {\n \"company_and_offering\": {\n \"description\": \"Company and offering\",\n \"value\": \"Acme provides appointment scheduling software.\"\n },\n \"target_customer\": {\n \"description\": \"Target customer\",\n \"value\": \"Small business owners who requested a demo.\"\n },\n \"primary_goal\": {\n \"description\": \"Call goal\",\n \"value\": \"Arrange a product demo.\"\n },\n \"success_criteria\": {\n \"description\": \"Success criteria\",\n \"value\": \"Confirm interest and a preferred callback time.\"\n },\n \"information_to_collect\": {\n \"description\": \"Information to collect\",\n \"value\": \"Name and preferred callback time.\"\n },\n \"objections_and_faqs\": {\n \"description\": \"Questions\",\n \"value\": \"Explain that the demo is free.\"\n },\n \"agent_tone\": {\n \"description\": \"Tone\",\n \"value\": \"Friendly, concise, and professional.\"\n },\n \"additional_context\": {\n \"description\": \"Context\",\n \"value\": \"Do not promise pricing or unavailable appointment slots.\"\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.dialnexa.com/v1/agent-builder/run/stream")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"structured_input\": {\n \"company_and_offering\": {\n \"description\": \"Company and offering\",\n \"value\": \"Acme provides appointment scheduling software.\"\n },\n \"target_customer\": {\n \"description\": \"Target customer\",\n \"value\": \"Small business owners who requested a demo.\"\n },\n \"primary_goal\": {\n \"description\": \"Call goal\",\n \"value\": \"Arrange a product demo.\"\n },\n \"success_criteria\": {\n \"description\": \"Success criteria\",\n \"value\": \"Confirm interest and a preferred callback time.\"\n },\n \"information_to_collect\": {\n \"description\": \"Information to collect\",\n \"value\": \"Name and preferred callback time.\"\n },\n \"objections_and_faqs\": {\n \"description\": \"Questions\",\n \"value\": \"Explain that the demo is free.\"\n },\n \"agent_tone\": {\n \"description\": \"Tone\",\n \"value\": \"Friendly, concise, and professional.\"\n },\n \"additional_context\": {\n \"description\": \"Context\",\n \"value\": \"Do not promise pricing or unavailable appointment slots.\"\n }\n }\n}"
response = http.request(request)
puts response.read_body"{\"type\":\"phase_start\",\"phase\":\"thinking\"}\n{\"type\":\"thinking_delta\",\"delta\":\"Reading your requirements\",\"label\":\"Understanding your needs\",\"phase\":\"thinking\"}\n"