Request object
The only required field needed for an API request is the request field. In this field, you can actually make your full request, pass additional context, etc. and have it parsed by DZ's API.
However, additional properties can be added to the request for greater specificity, direction and clarity - context and instructions.
- request = the human-readable required intent
- context = evidence/facts for this specific request
- instructions = behavioral controls for the request
While request is a standard string field on the root level of the request, context and instructions are objects each containing their own list of optional properties. By default, DZ will use the information saved in your acccount's context to handle responses, however, that behavior can be overwritten based on what's passed in an individual request.
Context property
Here is a full list of the possible properties in the context object:
Field
Type
Values
Definition
source
string
any
Where the request is coming from (e.g. slack, email)
type
string
any
High-level category (e.g. client email, approval, report generation, routing)
entity
string
any
Entities involved (e.g. client, person)
data
string
any
Raw message or content referenced in the request (e.g. email body, ticket information)
Instructions property
Here is a full list of the possible properties in the instructions object:
Field
Type
Values
Definition
confidence_threshold
number
0.0-1.0
Minimum confidence required to return a decision='execute'. Otherwise draft or escalate.
format
string
text, markdown, html, json
Preferred format for the response value.
tone
string
neutral, friendly, formal, direct
Nudges writing style
max_length
number
any
Soft cap on response length in terms of characters.
attribution
string
user, assistant
Whether the response should be framed as coming from you or your assistant.
response_schema
string
any
Key/value object of field names if wanting the response values split into specific fields.
dry_run
boolean
true/false
If true, the request won't execute any external actions, only returns what it would do to be audited in the dashboard.
Examples
Below are some examples of API requests including a mix-and-match of various properties.
Structured output for downstream automation:
cURL
Node.js
Python
curl -X POST https://delegatezero.com/api/v1/decisions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"request": "Draft a client update about this month's analytics.",
"context": {
"entity": "ABC Company",
"data": "Organic traffic up 12%, paid traffic down after campaign pause."
},
"instructions": {
"response_schema": {
"subject": "Email subject line",
"html": "Full HTML email body",
"text": "Plain text version of the email"
}
}
}'
import axios from "axios";
const decision = await axios.post(
"https://delegatezero.com/api/v1/decisions",
{
request: "Draft a client update about this month's analytics.",
context: {
entity: "ABC Company",
data: "Organic traffic up 12%, paid traffic down after campaign pause."
},
instructions: {
response_schema: {
subject: "Email subject line",
html: "Full HTML email body",
text: "Plain text version of the email"
}
}
},
{
headers: {
Authorization: `Bearer ${process.env.API_KEY}`
}
}
);
import requests
import os
response = requests.post(
"https://delegatezero.com/api/v1/decisions",
headers={
"Authorization": "Bearer {os.environ['API_KEY']}",
"Content-Type": "application/json"
},
json={
"request": "Draft a client update about this month's analytics.",
"context": {
"entity": "ABC Company",
"data": "Organic traffic up 12%, paid traffic down after campaign pause."
},
"instructions": {,
"response_schema": {
"subject": "Email subject line",
"html": "Full HTML email body",
"text": "Plain text version of the email"
}
}
}
)
Responding to an internal message with confidence control:
cURL
Node.js
Python
curl -X POST https://delegatezero.com/api/v1/decisions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"request": "Respond to this internal Slack message.",
"context": {
"source": "slack",
"data": "Can we commit to having this ready by Friday?"
},
"instructions": {
"confidence_threshold": 0.85,
"tone": "direct"
}
}'
import axios from "axios";
const decision = await axios.post(
"https://delegatezero.com/api/v1/decisions",
{
request: "Respond to this internal Slack message.",
context: {
source: "slack",
data: "Can we commit to having this ready by Friday?"
},
instructions: {
confidence_threshold: 0.85,
tone: "direct"
}
},
{
headers: {
Authorization: `Bearer ${process.env.API_KEY}`
}
}
);
import requests
import os
response = requests.post(
"https://delegatezero.com/api/v1/decisions",
headers={
"Authorization": "Bearer {os.environ['API_KEY']}",
"Content-Type": "application/json"
},
json={
"request": "Respond to this internal Slack message.",
"context": {
"source": "slack",
"data": "Can we commit to having this ready by Friday?"
},
"instructions": {
"confidence_threshold": 0.85,
"tone": "direct"
}
}
)
Safe evaluation with dry run and strict mode:
cURL
Node.js
Python
curl -X POST https://delegatezero.com/api/v1/decisions \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"request": "Approve this customer exception request.",
"context": {
"entity": "XYZ Startup",
"data": "Asking for a one-time pricing exception."
},
"instructions": {
"dry_run": true
}
}'
import axios from "axios";
const decision = await axios.post(
"https://delegatezero.com/api/v1/decisions",
{
request: "Approve this customer exception request.",
context: {
entity: "XYZ Startup",
data: "Asking for a one-time pricing exception."
},
instructions: {
dry_run: true
}
},
{
headers: {
Authorization: `Bearer ${process.env.API_KEY}`
}
}
);
import requests
import os
response = requests.post(
"https://delegatezero.com/api/v1/decisions",
headers={
"Authorization": "Bearer {os.environ['API_KEY']}",
"Content-Type": "application/json"
},
json={
"request": "Approve this customer exception request.",
"context": {
"entity": "XYZ Startup",
"data": "Asking for a one-time pricing exception."
},
"instructions": {
"dry_run": true
}
}
)
Sorry, we don't have any results for that search. If you need assistance, please contact us.