AI support agent with order lookup
A webhook hands a customer message to a tool-using agent that can look up the order over HTTP, then the answer is emailed back.
Drag to pan, pinch to zoom. This is the real graph the template installs.
Purpose
A webhook hands a customer message to a tool-using agent that can look up the order over HTTP, then the answer is emailed back.
How it works
What it does
- Support request — a webhook (
/hooks/<tenant>/support-agent) receives{message, email, order_id?}. - Support agent — an
ai.agentwith an HTTP tool (get_order) reasons over the message, calling the order API only when it needs to. Every model turn and tool call is recorded in the run trace. - Email the answer — the agent's final text is emailed to the customer.
Nodes 3
- 01Support requesttrigger.webhookTrigger
- 02Support agentai.agentAI
- 03Email the answermail.sendDestination
View template JSON
{
"format": "mantle-workflow/v1",
"id": "ai-support-agent-email",
"name": "AI support agent with order lookup",
"graph": {
"nodes": [
{
"id": "webhook",
"type": "trigger.webhook",
"label": "Support request",
"config": {
"slug": "support-agent",
"input_schema": {
"required": [
"message",
"email"
],
"properties": {
"message": {
"type": "string"
},
"email": {
"type": "string"
},
"order_id": {
"type": "string"
}
}
}
},
"worker_type": "generic-worker",
"position": {
"x": 60,
"y": 220
}
},
{
"id": "agent",
"type": "ai.agent",
"label": "Support agent",
"config": {
"model": "claude-sonnet-4-5",
"system_prompt": "You are a concise, friendly support agent for an online store. Use the get_order tool when the customer mentions an order id. Never invent order details. Answer in plain text, under 150 words.",
"prompt": "Customer email: {{ $json.email }}\nOrder id (may be empty): {{ $json.order_id }}\n\nMessage:\n{{ $json.message }}",
"tools": [
"now",
{
"kind": "http",
"name": "get_order",
"description": "Fetch an order by its id.",
"method": "GET",
"url": "https://api.example.com/orders/{order_id}",
"parameters": {
"type": "object",
"required": [
"order_id"
],
"properties": {
"order_id": {
"type": "string"
}
}
}
}
],
"max_iterations": 6,
"temperature": 0.2,
"max_tokens": 800,
"output": {
"mode": "text"
},
"tool_timeout_seconds": 20
},
"worker_type": "ai-worker",
"position": {
"x": 380,
"y": 220
}
},
{
"id": "send_reply",
"type": "mail.send",
"label": "Email the answer",
"config": {
"to": "{{ steps.webhook.email }}",
"subject": "Re: your support request",
"body_text": "{{ steps.agent.text }}"
},
"worker_type": "generic-worker",
"position": {
"x": 700,
"y": 220
}
}
],
"edges": [
{
"from": "webhook",
"to": "agent"
},
{
"from": "agent",
"to": "send_reply"
}
]
}
}Requirements
The connections and permissions each step needs, from the node contracts in the catalog.
- AnthropicAPI key
Used by Support agent.
Credential: {"api_key"}
- The provider adapter is chosen from the connection; `model` must belong to it.
- Route on the AI worker (worker_type: ai-worker) so budgets, the ai_calls ledger and the circuit breaker apply.
- A tool that raises does not fail the step: the error text is returned to the model, which may retry or answer without it.
- Sub-workflow tools (kind: workflow) are reserved for a later phase.
- SendGridAPI key
Used by Email the answer.
Credential: {"api_key"} or {"username", "password"}
Setup
- Pick an Anthropic (or OpenAI / Google) connection on the Support agent node and set the model if you prefer another.
- Point the
get_ordertoolurlat your order API; addheadersfor auth if needed. - Pick a SendGrid / SMTP connection on Email the answer.
- Publish, then POST to the webhook URL shown on the trigger node.
Sample input and output
Synthetic examples: node-contract samples or placeholders, never customer data.
Input
The fields the template declares or reads from the request body. Values are placeholders.
{
"message": "<message>",
"email": "<email>",
"order_id": "<order_id>"
}Output
Email the answer mail.send
{
"body": null,
"message_id": "",
"provider": "",
"sent": true,
"status_code": 0,
"thread_id": ""
}Failure handling
What the graph does when a step fails, read from its retry settings, error branches and error policies.
- A step that fails, after any retries, fails the run. The failed step is kept with its input and error.
See it run, then make it yours.
Templates install as drafts. Edit any step, and Workflow Health re-checks the graph on every save.