Workflows API
Set checks in Workflows. Call the workflow's address. A workflow decides which checks run at each stage of your agent's loop, and each one answers allow, mask, escalate or block. Your app routes on that answer. We never hold your model key and never call your model.
- Until our data processing agreement is signed with your company, send no personal data to the API.
- During the trial there is no uptime guarantee: the guard can be briefly unavailable.
1Before you start
A workflow decides what runs. A key only decides who may call.
- ·Sign in to the console to create a key. The key is shown once. You can revoke or restore it there. Any active key of your company can call any of its workflows.
- ·A workflow called
defaultis made for you. It runs every live check at every stage, and it starts in shadow mode (section 5). - ·Open Workflows in the console to see your workflows, each with its address, and to make more. Set checks in Workflows. Call the workflow's address.
- ·Call the API from your server, and never put a key in browser code.
What runs in default:
| Stage | Runs in default |
|---|---|
| input | Input guard, AI Act check and privacy filter |
| tool-call | Action check (Auto Mode) |
| tool-response | Input guard |
| output | AI Act check |
The privacy filter runs at the input stage only. You can change default, but you cannot delete or rename it. Back to default in the console puts it back as above.
2Your workflow's address
POST https://api.astroware.ai/v1/workflows/{workflow}/chat/completions. The address is OpenAI-compatible: in an OpenAI client, set base_url to https://api.astroware.ai/v1/workflows/{workflow}.
- Headers
Authorization: Bearer <key>andContent-Type: application/jsonmodel- The stage:
"input","tool-call","tool-response"or"output". Required. messages- A list of messages, as in any OpenAI chat request. Section 3 says which message each stage reads.
- ·The address is made once. It comes from the workflow's name when you create it: lower case, with spaces and other characters turned into hyphens.
Support botgivessupport-bot. It never changes after that, even if you rename the workflow, so your agents keep working. - ·A company can have up to 20 workflows,
defaultincluded. Every company hasdefault. - ·
GET https://api.astroware.ai/v1/workflows/{workflow}/modelslists the four stages, soclient.models.list()works. - ·A body of up to 2 MB, no streaming.
import json
from openai import OpenAI
guard = OpenAI(base_url="https://api.astroware.ai/v1/workflows/default", api_key=ASTROWARE_KEY)
# before your model reads the user's message
r = guard.chat.completions.create(model="input", messages=messages)
# before a tool runs
r = guard.chat.completions.create(model="tool-call", messages=messages)
# before your model reads what the tool sent back
r = guard.chat.completions.create(model="tool-response", messages=messages)
# before your user sees the reply
r = guard.chat.completions.create(model="output", messages=messages)
answer = json.loads(r.choices[0].message.content)
print(answer["decision"])curl https://api.astroware.ai/v1/workflows/default/chat/completions \ -H "Authorization: Bearer $ASTROWARE_KEY" -H "Content-Type: application/json" \ -d '{"model": "input", "messages": [ {"role": "user", "content": "Write to Anna Schmidt at anna.schmidt@example.com about the Q3 report."}]}'
3The four stages
The stage is the model. Call each one at the point in your agent's loop where it belongs.
model | Call it | It reads |
|---|---|---|
| input | Before your model reads the user's message | The conversation. The last user message decides. |
| tool-call | Before a tool runs | The tool_calls of the last assistant message. |
| tool-response | Before your model reads what the tool sent back | The tool messages after the last tool call. |
| output | Before your user sees the reply | The last assistant message. |
If the request does not have the shape its stage reads, the answer is 400, with type stage_mismatch, and the message says what is missing:
model | Message |
|---|---|
| input | model input needs a user message last. |
| tool-call | model tool-call needs an assistant message with tool_calls last. |
| tool-response | model tool-response needs tool messages last. |
| output | model output needs an assistant message last. |
- ·The call does not choose the checks. They are set on the workflow.
- ·For
output, send the user's request and the final reply. An earlier assistant message that hastool_callsand no text gives 400. - ·At the input stage, the privacy filter works within a time limit, which covers about 30,000 characters. If a request takes longer, the call answers 200 with decision escalate, and the other checks still answer.
4The answer
Status 200 and an OpenAI-style chat completion. choices[0].message.content is itself a JSON string. Parse it. These four were recorded on the live API on 23 November 2026, on the default workflow in shadow mode, with made-up data. Each is shown as the parsed content.
The input stage. The message holds a name, an order number and an email address:
{
"model": "input",
"messages": [
{
"role": "user",
"content": "My order 48213 arrived broken, please refund it. I am Maria Rossi, maria.rossi@example.com."
}
]
}{
"decision": "mask",
"mode": "shadow",
"would_decide": "mask",
"workflow": "default",
"checked": "request",
"checks": [
{
"check": "ai_act",
"decision": "allow",
"policy": "none",
"tokens": 34
},
{
"check": "privacy",
"decision": "mask",
"personal_data": [
"code",
"email",
"person"
],
"masked_messages": [
{
"role": "user",
"content": "My order [CODE_1] arrived broken, please refund it. I am [PERSON_1], [EMAIL_1]."
}
],
"map": {
"[CODE_1]": "48213",
"[PERSON_1]": "Maria Rossi",
"[EMAIL_1]": "maria.rossi@example.com"
},
"privacy_mode": "all",
"tokens": 23
},
{
"check": "input_guard",
"decision": "allow",
"engine": "…",
"results": [
{
"decision": "allow",
"p_block": 0.0008,
"threshold": 0.5,
"judged_by": "…"
}
],
"tokens": 23
}
]
}The tool-call stage. Your agent is about to issue the refund:
{
"model": "tool-call",
"messages": [
{
"role": "user",
"content": "My order 48213 arrived broken, please refund it. I am Maria Rossi, maria.rossi@example.com."
},
{
"role": "assistant",
"content": null,
"tool_calls": [
{
"id": "call_1",
"type": "function",
"function": {
"name": "issue_refund",
"arguments": "{\"order_id\": \"48213\", \"amount_eur\": 59.9}"
}
}
]
}
]
}{
"decision": "allow",
"mode": "shadow",
"would_decide": "allow",
"workflow": "default",
"checked": "action",
"checks": [
{
"check": "action",
"decision": "allow",
"engine": "auto-mode-v6",
"calls": [
{
"tool": "issue_refund",
"decision": "allow",
"band": "judged",
"reason": "low risk, or asked for by the person",
"p_yes": 0.8103,
"threshold": 0.5
}
],
"tokens": 50
}
],
"skipped": [
{
"check": "ai_act",
"reason": "action"
},
{
"check": "privacy",
"reason": "action"
}
]
}The tool-response stage. This is what the tool sent back:
{
"model": "tool-response",
"messages": [
{
"role": "user",
"content": "My order 48213 arrived broken, please refund it. I am Maria Rossi, maria.rossi@example.com."
},
{
"role": "assistant",
"content": null,
"tool_calls": [
{
"id": "call_1",
"type": "function",
"function": {
"name": "issue_refund",
"arguments": "{\"order_id\": \"48213\", \"amount_eur\": 59.9}"
}
}
]
},
{
"role": "tool",
"tool_call_id": "call_1",
"content": "{\"status\": \"refunded\", \"order_id\": \"48213\", \"amount_eur\": 59.9}"
}
]
}{
"decision": "allow",
"mode": "shadow",
"would_decide": "allow",
"workflow": "default",
"checked": "tool_result",
"checks": [
{
"check": "input_guard",
"decision": "allow",
"engine": "haloguard-v2+…",
"results": [
{
"tool_call_id": "call_1",
"decision": "allow",
"v2": {
"p_unsafe": 0.0474,
"flag": false,
"threshold": 0.5
},
"judged_by": "haloguard-v2"
}
],
"tokens": 16
}
],
"skipped": [
{
"check": "ai_act",
"reason": "tool_result"
},
{
"check": "privacy",
"reason": "tool_result"
}
]
}The output stage. This is the reply your user is about to see:
{
"model": "output",
"messages": [
{
"role": "user",
"content": "My order 48213 arrived broken, please refund it. I am Maria Rossi, maria.rossi@example.com."
},
{
"role": "assistant",
"content": "The refund of EUR 59.90 for order 48213 is done; the money reaches the card in 3 to 5 working days."
}
]
}{
"decision": "allow",
"mode": "shadow",
"would_decide": "allow",
"workflow": "default",
"checked": "reply",
"checks": [
{
"check": "ai_act",
"decision": "allow",
"policy": "none",
"tokens": 74
}
],
"skipped": [
{
"check": "privacy",
"reason": "reply"
}
]
}workflow is the workflow that answered. checked is the stage, in these words: request for input, action for tool-call, tool_result for tool-response and reply for output.
decision is what your app routes on:
decision | What your app does |
|---|---|
allow | Send the text or run the action as it is. |
mask | Send masked_messages on instead. Putting the originals back into your model's reply with map is your step. |
escalate | Hold it for a person to approve. You also get escalate when a check could not answer, so an outage never reads as a clean allow. |
block | Stop. |
The most severe check decides: block, then escalate, then mask, then allow.
Each entry in checks has the check's own answer:
- ·
input_guard:decisionallow, escalate or block.resultshas one entry for each message it checked (for tool-response, one for each tool result, with itstool_call_id):decision,judged_by, and the scores behind it (p_blockandthresholdat the input stage,v2at tool-response). The scores can change between versions; route ondecision. When the workflow allows a harm category (section 6) and the text falls in it, the answer is allow and the category is named inallowed_category. - ·
ai_act:decisionallow or block, andpolicy(the policy that matched, ornone). A block also carrieslabelandact_area, as on the HaloGuard EU page. - ·
privacy:decisionallow or mask,personal_data(the kinds found), and on maskmasked_messagesandmap.privacy_modeis your company's masking setting. - ·
action:callshas one entry per tool call:tool,decision(allow, escalate or block) andreason.band,p_yesandthresholdsay how that decision was reached. They can change between versions; route ondecision. - ·Each entry also has
tokens: the number of tokens that check read, which is what the price counts (section 8). - ·A check that could not answer says
unavailable, and the answer is escalate. - ·A check that did not run is named in
skipped, with the reason.
usage also carries haloguard_eu_mode: checked, decision, would_decide and mode, and for an action judged, the number of calls that were judged. It holds no text.
Ignore keys you do not know.
5Shadow or enforce
Each workflow has one mode, for all four stages. You set it on the workflow in the console; a call cannot change it.
- ·Shadow (every workflow starts here): an AI Act block, an input guard find and the action check's answer do not stop anything.
decisionlets the traffic through, andwould_decidesays what enforce would have answered. Your company's masking still applies in shadow: a request with personal data still answers mask. The Shadow report on the Usage page counts what would have been blocked or escalated. - ·Enforce:
decisionis what the checks found.
Write your routing once. Switching a workflow from shadow to enforce needs no change to your code, and takes effect on the workflow's next call.
6Harm categories
The input guard flags unsafe text at the input stage and at the tool-response stage, and names one of 30 harm categories for each text it flags. Each input guard box in a workflow has its own settings, so the two can differ.
- ·24 categories a workflow can allow. In the console, open the input guard in your workflow and set a category to Allow. Text the guard flags in that category is answered allow, and
allowed_categorynames it. Every other category stays caught. All 24 start as caught. - ·6 categories a workflow cannot allow. The console shows them and does not let you change them.
- ·If the guard cannot tell which category a flagged text is in, it counts as caught. Nothing is let through because a category was unclear.
- ·At the tool-response stage, allowing
agent_steering(hidden instructions to the agent) switches off the main job of that box.
A workflow cannot allow these 6:
- ·Child sexual abuse material
- ·Chemical weapons
- ·Biological weapons
- ·Radiological and nuclear weapons
- ·Non-consensual sexual content
- ·Human trafficking
A workflow can allow these 24. The second column is the value allowed_category carries:
| Category | allowed_category |
|---|---|
| Violence | violence |
| Terrorism and extremism | terrorism_and_extremism |
| Offensive cyber | offensive_cyber |
| Self-harm and suicide | self_harm_and_suicide |
| Hate speech | hate_speech |
| Harassment and bullying | harassment_and_bullying |
| Fraud and social engineering | fraud_and_social_engineering |
| Illegal drugs | illegal_drugs |
| Weapons and firearms | weapons_and_firearms |
| Animal cruelty | animal_cruelty |
| Property crime and theft | property_crime_and_theft |
| Privacy violations | privacy_violations |
| Disinformation | disinformation |
| Defamation and reputational harm | defamation_and_reputational_harm |
| Non-violent illegal acts | non_violent_illegal |
| Sexual content, general | sexual_content_general |
| Eating disorders | eating_disorders |
| Bias and stereotyping | bias_and_stereotyping |
| Copyright infringement | copyright_infringement |
| Regulated professional advice | regulated_professional_advice |
| Agent steering (hidden instructions to the agent) | agent_steering |
| Politically sensitive | politically_sensitive |
| Unethical acts | unethical_acts |
| General | general |
The cut-off for unsafe is an advanced setting on each input guard box. The standard is 0.50. You can set it from 0.30 to 0.90, in steps of 0.05. A lower cut-off catches more, and flags more harmless text. Back to standard in the console puts it back.
7Errors
The body is {"error": {"message", "type", "param", "code"}}. Branch on the status, not on the message text: the text can change.
As on the HaloGuard EU page, with these differences:
| Status | When |
|---|---|
| 400 | The address names a workflow your company does not have (type is workflow_not_found). The message holds this sentence, with more text around it: No workflow called supprot-bot in your company. Your workflows: default, support-bot. |
| 400 | The request does not have the shape its stage reads (type is stage_mismatch). The message holds one of the sentences in section 3, with more text around it. |
| 403 | A model that is not one of the four stages, or that your key may not call (type is key_model_access_denied) |
| 400 | For the tool-call stage: more than 20 tool calls; tool_calls that is not a non-empty list; a tool call with no function.name; function.arguments that is not JSON, or not a JSON object; a role other than user, assistant, tool or system; a conversation over 400,000 characters |
A check that could not run is not an error: the answer is 200 with decision escalate.
8Limits and price
These are today's settings and can change. They are the same as before workflows.
- ·60 requests a minute per key.
- ·Size: up to 400,000 characters in a conversation. A bigger one gives 400.
- ·Trial: the same $5 budget for your company as HaloGuard EU, shared by up to 5 active keys.
- ·Price: $30 / billion input tokens, the same as HaloGuard EU. Output tokens are free on all models. Tokens of your text are counted each time they go through a model: text sent to two models, or through two checks in a workflow, is counted twice.
9Your data
We see only what you send and keep none of its text. Usage records hold no text. For an action check, we send the tool call, with the earlier tool calls and the user messages in that request, to an AI provider in the EU, which judges whether the person asked for the action and keeps no copy. When the AI Act check is unsure about a message, we send that message, with earlier messages of the conversation, to the same provider, which decides and keeps no copy. Our Terms and our data processing agreement say how your data is processed, and by whom. Until our data processing agreement is signed with your company, send no personal data to the API.
10Not promised
No uptime guarantee: the guard can be briefly unavailable (a 503). Speed is not promised. The limits and budget above are today's settings and can change.
Auto Mode judges whether an action fits what the person asked for. It does not check what the tool returns. The input guard at the tool-response stage looks at that.
11Older calls
Calls made before workflows keep working: model "eu-mode" at https://api.astroware.ai/v1/chat/completions, and the single models haloguard-eu, privacy, haloguard-input and auto-mode. An eu-mode call runs its key's own setting, unless the key is linked to a workflow; then it runs that workflow. The stage is still read from the last message. The EU Mode API page describes it. New calls should go to a workflow's address.