Templates · Published 2026-09-28 · AgentiSend team
Budget warning
Tell a person an agent has used most of its email budget for the period, before sends start being refused.
A handler for limit.warning is the place this mail usually goes out.
Tell a person an agent has used most of its email budget for the period, before sends start being refused.
Variables
Every placeholder is required. A send that omits one is refused with that name, rather than going out with a blank.
agent_name(string, required). The name you gave the agent or its API key.percent_used(number, required). The share of the budget used, as a whole number. The event carries it as a fraction.emails_used(number, required). Emails sent so far this period. The event’sused.emails_budget(number, required). The period budget. The event’sbudget.budget_period(string, required). The budget period in words: hour, day or month.budget_url(string, required). An https link to where a person reviews the budget.
Rendered with the example values
These values are samples. They are not an account on AgentiSend.
Subject: Support agent has used 80% of its email budget
<p>Support agent has sent 800 of the 1000 emails its budget allows this month.</p>
<p>Once it reaches 1000, its sends are refused until the next month starts or a person raises the budget.</p>
<p><a href="https://app.example.com/agents/support/budget">Review the budget</a></p>Support agent has sent 800 of the 1000 emails its budget allows this month.
Once it reaches 1000, its sends are refused until the next month starts or a person raises the budget.
Review the budget (https://app.example.com/agents/support/budget)Create the draft
POST /templates and the create_template tool take this body. The draft does not send until it is published.
{
"name": "Budget warning",
"subject": "{{agent_name}} has used {{percent_used}}% of its email budget",
"content": {
"mode": "markdown",
"source": "{{agent_name}} has sent {{emails_used}} of the {{emails_budget}} emails its budget allows this {{budget_period}}.\n\nOnce it reaches {{emails_budget}}, its sends are refused until the next {{budget_period}} starts or a person raises the budget.\n\n[Review the budget]({{budget_url}})"
},
"variables": [
{
"name": "agent_name",
"type": "string",
"required": true
},
{
"name": "percent_used",
"type": "number",
"required": true
},
{
"name": "emails_used",
"type": "number",
"required": true
},
{
"name": "emails_budget",
"type": "number",
"required": true
},
{
"name": "budget_period",
"type": "string",
"required": true
},
{
"name": "budget_url",
"type": "string",
"required": true
}
]
}Publish it
Call publish_template with the id POST /templates returned. Publishing again makes the next version. A version that already went out does not change.
{
"name": "publish_template",
"arguments": {
"template_id": "<the id POST /templates returned>"
}
}Send it
Create the draft with the body above, publish it, then send with template_id and template_values. The rules are in Templates. The three calls, including a render that does not send, are in How do I send an email from a template. The next starter is Agent daily report.