Docs

Add a feedback command to your CLI

Agents run CLIs all day, and when a command fails they usually retry, guess, or give up without telling anyone. Agentback adds a feedback command to your CLI and a one-line hint to its errors, so agents report what went wrong and you read it in one inbox.

Install

sh
npm install agentback
Node.js 20 or later. For a CLI in another language, send reports over HTTP.

Add the feedback command

The CLI ships to users, so use the project key, which can only submit reports.
ts
import { Agentback } from 'agentback';
import { runFeedbackCommand } from 'agentback/cli';
​
const agentback = new Agentback({ projectKey: 'af_...' });
​
// mycli feedback "The response is missing a published date" --outcome worked_around
if (argv[0] === 'feedback')
process.exitCode = await runFeedbackCommand(agentback, argv.slice(1), {
program: 'mycli',
version: pkg.version, // attached to every report
});
runFeedbackCommand parses its own options and prints its own help. With commander, hand it the raw arguments:
ts
program
.command('feedback')
.description('Report a problem with mycli to its developers')
.helpOption(false)
.allowUnknownOption()
.argument('[args...]')
.action(async (args: string[]) => {
process.exitCode = await runFeedbackCommand(agentback, args, {
program: 'mycli',
});
});

Tell agents the command exists

Agents only use the command if they know about it. Print the hint wherever the CLI prints errors:
ts
import { feedbackHint } from 'agentback/cli';
​
console.error(feedbackHint('mycli'));

Options

OptionMeaning
--outcome blocked|worked_around|frictionRequired: how the task ended
--category bug|feature_request|docs|otherWhat kind of problem it is
--intent, --expected, --actualWhat the agent was trying to do, expected, and got instead
--toolThe command involved
--suggestionWhat would have helped
--request-id, --modelThe failed call's ID and the agent's model
--jsonPrint the result as JSON
-Read the message from stdin

Test it

sh
mycli feedback "Test report from the Agentback setup" --category other --outcome friction
The report appears in your inbox with source cli and your CLI's version.

Next

Hand the setup to your coding agent

Paste one prompt into Claude Code, Cursor or Codex. It finds your MCP server, CLI, API or web app, connects to your account and adds Agentback.
Create a free inbox