Back/Product/Claude
AdvancedProduct

Design an Agent-Friendly CLI to Automate SaaS Product Onboarding

Design a CLI that lets an agent complete a real SaaS setup, discover the next action from useful command output, and cross an email verification step when the user has granted the necessary tool access.

Design an Agent-Friendly CLI to Automate SaaS Product Onboarding

Brian asks an agent to install Intercom through a CLI, uses helpful command output to suggest the next action, and lets the agent retrieve an email verification code through an available tool.

Before you start

What you need

  • One high value onboarding task
  • Product APIs exposed through a CLI
  • A test account and site
  • Optional email access explicitly granted by the user

What you’ll make

An agent can create an account, complete verification, configure the product, and report the resulting installation state through the CLI.

Tools used

Step by step

The workflow

Follow the sequence once, then adapt the prompts, checks, and handoffs to your own setup.

4 steps

Step01

Start with a User Prompt

Choose one valuable end to end task, such as installing the product on a site. Write the outcome from the user’s perspective before designing commands.

Example prompt
Install Intercom on my website. Create the account, complete the required setup, add the installation snippet, and report the workspace and installation status.
Step02

Build a CLI for the Workflow

Expose each required operation through clear CLI verbs and stable flags. Support structured output, idempotent retries, status commands, and errors that identify the exact unresolved state.

Step03

Embed 'Hints' for the Agent

When a command cannot continue, make its help text useful to an agent. State what happened, what input is missing, and the exact next command. For email verification, suggest checking the authorized inbox and provide a command that accepts the code.

Example prompt
Verification required. Retrieve the code sent to the account email, then run `intercom auth verify --code <code>`. If you have authorized email access, search for the latest Intercom verification message.

This hint bridges the gap between automated steps and those that typically require a human.

Step04

Provide Tools for Action

Give the agent only the adjacent tools needed for the task, such as an email client or browser, with explicit user authorization. Test the entire flow from a clean account and confirm the final product state rather than trusting a successful command exit.

What good looks like

  • Commands use clear verbs, stable flags, structured output, and actionable errors.
  • Help text suggests the next valid command when the workflow stalls.
  • The agent completes or clearly reports every onboarding state.
  • Sensitive tools and credentials remain scoped to the user’s authorization.

Build your next product with ChatPRD

Turn an idea into a PRD, user stories, and a plan.

Try ChatPRD free

After the steps

Runbook notes

How to recover when the loop fails and where human judgment helps.

Recover

If it goes sideways

The next action is hidden behind a browser only flow
Expose the underlying operation through the CLI or return a direct URL and explicit continuation command.
Email verification blocks the agent
Return a hint that names the required verification code and accept it through a dedicated command. Use email access only when the user has granted it.
The agent cannot interpret command output
Use stable JSON or concise labeled text with state, next action, command examples, and machine readable errors.
The agent retries without making progress
Return an explicit state identifier and changed next step, then cap retries and surface the unresolved dependency.

Start shipping
better products.

Join 100,000+ product managers who use ChatPRD to write better docs, align teams faster, and build products users love.

Free to start
No credit card
SOC 2 certified
Enterprise ready