Docs
Verify which account a report came from
Reports are anonymous by default. If you want to know which of your users an agent was working for, or which person sent a report from your web app, attach a verified account. Agentback accepts an account only when it can tell your product vouched for it, so a public project key cannot be used to report as someone else.
Use an opaque account ID, such as a user or tenant ID. Never send an email address.
With the secret key
Clients that hold the secret key, such as a hosted MCP server or your backend, pass the account directly:
tsattachToMcp(server, agentback, {product: 'Your product',identify: () => ({ account: session.accountId }),});
With the project key
A local MCP server, a CLI and a web app use the public project key, which cannot vouch for an account. Your backend signs the account ID with the project's identity secret, and the client passes the signature along. A good place to hand it over is the response your CLI, MCP server or web app already gets when the user signs in.
ts// On your backendimport { signAccount } from 'agentback';const signature = await signAccount(process.env.AGENTBACK_IDENTITY_SECRET,accountId,);
ts// In a local MCP serverattachToMcp(server, agentback, {product: 'Your product',identify: () => ({ account: accountId, signature }),});// In a CLIrunFeedbackCommand(agentback, args, {program: 'mycli',identify: () => ({ account: config.accountId, signature: config.signature }),});// In a web app, once the person has signed inwindow.Agentback?.identify({ account: accountId, signature });
The signature is a hex HMAC-SHA256 of the trimmed account ID, keyed with the identity secret, so a backend in any language can compute it without the package.
What happens to a wrong signature
A report with an account and a missing or wrong signature is rejected with 401, so unverified accounts never reach your inbox. Rotating the project's keys replaces the identity secret and invalidates every existing signature.
If your product has no backend, skip this: reports stay anonymous.