Guide
Report agent failures with one HTTP call
An agent fails in ways an app does not: a tool times out, a model returns JSON that does not parse, a run hits its step limit. Each of those can be one report to BugBeacon, sent with the HTTP client your agent already has.
Before you start
- Create a project in the dashboard. Pick the platform Other or Node.
- Copy the project key from Settings. It starts with
bb_live_. - Keep it in an environment variable, such as
BUGBEACON_API_KEY.
The smallest report
Only error.name is required. Add a message and you have a useful issue.
curl -X POST https://bug-beacon.net/api/v1/notify \
-H "Content-Type: application/json" \
-H "X-Api-Key: $BUGBEACON_API_KEY" \
-d '{"error": {"name": "ToolTimeoutError", "message": "web_search took over 30 s"},
"app": {"platform": "other", "releaseStage": "production"}}'
From a TypeScript agent
Wrap each tool call. On failure, send the error with the steps the run took so far, then decide what to do with the answer.
const BB_URL = "https://bug-beacon.net/api/v1/notify";
const steps: { timestamp: string; category: string; message: string }[] = [];
async function runTool(name: string, args: unknown, call: () => Promise<unknown>) {
steps.push({ timestamp: new Date().toISOString(), category: "system", message: `${name} start` });
try {
return await call();
} catch (err) {
const e = err as Error;
const res = await fetch(BB_URL, {
method: "POST",
headers: { "Content-Type": "application/json", "X-Api-Key": process.env.BUGBEACON_API_KEY! },
body: JSON.stringify({
error: { name: e.name, message: e.message, stacktrace: e.stack, unhandled: false },
app: { platform: "node", version: process.env.AGENT_VERSION, releaseStage: "production" },
fingerprint: `tool:${name}:${e.name}`,
breadcrumbs: steps.slice(-20),
metadata: { tool: name, args },
}),
});
const { issueId, isNewIssue } = await res.json();
if (isNewIssue) await notifyOwner(issueId); // a failure nobody has seen yet
throw err;
}
}
From a Python agent
import os, traceback, requests
BB_URL = "https://bug-beacon.net/api/v1/notify"
def report(e: Exception, tool: str, steps: list[dict], **metadata) -> dict:
r = requests.post(BB_URL, timeout=5, headers={"X-Api-Key": os.environ["BUGBEACON_API_KEY"]}, json={
"error": {
"name": type(e).__name__,
"message": str(e),
"stacktrace": "".join(traceback.format_exception(e)),
"unhandled": False,
},
"app": {"platform": "other", "releaseStage": "production"},
"fingerprint": f"tool:{tool}:{type(e).__name__}",
"breadcrumbs": steps[-20:],
"metadata": {"tool": tool, **metadata},
})
return r.json() # {"issueId": ..., "isNewIssue": ...}
Python tracebacks are not one of the three formats BugBeacon parses. Each line is kept as a frame of plain text, and the top one reads “Traceback (most recent call last):” for every error. That is why the Python example sends its own fingerprint.
What to put in a report
| Field | Use it for |
|---|---|
error.name | The kind of failure. It names the issue. |
error.message | What went wrong this time. Ids, UUIDs and hex addresses are masked for grouping. |
error.unhandled | false for failures the agent caught and handled. Defaults to true. |
fingerprint | Your own grouping key, such as tool:web_search:timeout. |
breadcrumbs | The last steps: each with timestamp, category (navigation, ui, network, console, user_action, error, system) and message. |
metadata | Any JSON: run id, model, step number, tool arguments. |
user.id | Who the run was for, such as a workspace id. It drives the user count. |
app.version | The agent's version, so you can see which release a failure started in. |
Use the answer
BugBeacon answers 202 with issueId and isNewIssue. Some ways agents use it:
- Only page a person when
isNewIssueis true. - Write the
issueIdinto the run's log, so the run and the issue link up. - Stop retrying a tool after a known failure, and retry once after a new one.
Keep secrets out
Reports are stored as sent. Leave API keys, tokens and personal data out of metadata and breadcrumbs. If you send no user, the request's IP address is stored in its place, so send a workspace id when you can.