Skip to main content

The PolyAI ADK is accessed through the poly command. Use the CLI help output as the first source of truth.

Start with help

To see all available commands and options:
Each command also supports its own help output. For example:
Use help output as the source of truthThe installed CLI is the fastest way to confirm the commands and flags available in your local environment.

Core commands

poly start

End-to-end onboarding for self-serve accounts on studio.poly.ai. poly start is hardcoded to the studio region — for any other region, use poly login. poly start:
  1. Opens a browser window so you can sign up or sign in to a self-serve workspace.
  2. Generates an API key (or reuses your existing one) and writes it to ~/.poly/credentials.json under the studio region.
  3. Optionally creates a new Agent Studio project and pulls it down locally.
If the ADK detects an existing API key in the credential file or environment, poly start asks whether to use it. Accept and the command skips ahead to the project-creation prompt; decline and it runs the full sign-in flow. Examples:

poly login

Sign in to an existing Agent Studio account and save API key credentials for the CLI. Works against any region — including studio, which makes poly login --region studio a viable alternative to poly start for self-serve users on a new machine who already have an account and don’t need to create a project. poly login:
  1. Prompts for a region if --region is not supplied.
  2. Opens a browser window for sign-in via the Auth0 device authorization flow.
  3. Fetches or creates an API key for your user and saves it to ~/.poly/credentials.json under the chosen region.
Run poly login once per region you need access to — credentials for multiple regions are stored side by side in the credential file. Examples:

poly project

Manage Agent Studio projects.

poly project create

Create a new Agent Studio project under an account, then initialize it locally. Run with no arguments and poly project create walks you through interactive prompts:
  1. Region — auto-selected if your API key only has access to one.
  2. Account — auto-selected if there’s only one in the region; otherwise pick from a searchable list.
  3. Project name — free-text name for the new project.
  4. Project ID — optional slug. Defaults to a slugified version of the name (lowercased, spaces replaced with hyphens, special characters removed). Leave empty to let the platform generate one.
After the project is created in Agent Studio, poly project create automatically calls poly init to initialize the local project directory. Examples:
--json requires explicit flags for poly project createWhen using poly project create --json, you must supply --region, --account_id, and --name explicitly. Interactive prompts are not supported in JSON mode.

Error handling

poly init

Initialize a new Agent Studio project locally. Run with no arguments and poly init walks you through interactive dropdowns:
  1. Region — auto-selected if your API key only has access to one.
  2. Account — auto-selected if there’s only one in the region; otherwise pick from a searchable list. Each entry is shown as "name (id)" to disambiguate accounts that share the same display name.
  3. Project — pick from a searchable list of every project the API key can see. Each entry is shown as "name (id)" for the same reason.
If no projects are found in the selected account, poly init offers to create one. Accepting the prompt starts the poly project create flow with the region and account already pre-selected. After selection, poly init creates the project directory at {base_path}/{account_id}/{project_id} and immediately pulls the current configuration from Agent Studio. Change into the project directory before running any other commands. The human-readable project name is stored in project.yaml alongside the project_id, account_id, and region:
Pass any combination of --region, --account_id, and --project_id to skip the matching prompt. This is the form to use in scripts and CI. Examples:

Error handling

If the account or project ID is invalid or inaccessible, poly init returns a descriptive error and cleans up any partially created directories so no empty folders are left behind. When using --json, the response includes { "success": false, "error": "..." } with the same message.

poly pull

Pull the latest project configuration from Agent Studio. Examples:
If the branch you are currently on no longer exists in Agent Studio, poly pull automatically switches to the main branch and displays a warning message with the new branch name. When using JSON output (--json), the response includes new_branch_name and new_branch_id fields if a branch switch occurred.

poly push

Push local changes to Agent Studio. Examples:
When pushing creates a new branch (for example, when pushing to Agent Studio for the first time on a branch), the CLI displays a message with the new branch name.
Call Link URL in chat output may be malformedEach chat session prints a Call Link URL for viewing the conversation in Agent Studio. On some deployments this URL has a doubled hostname (for example, https://studio.studio.poly.ai/…), which produces a 404. The conversation is still recorded — open Agent Studio directly and navigate to the conversation from there.
poly push reports an error message when there is nothing to pushIf there are no local changes, poly push prints Error: Failed to push and No changes detected. The exit code is 0, so CI scripts that check return codes are not affected. The message is misleading but the command has not actually failed.
When using JSON output (--json), the response includes new_branch_name and new_branch_id fields if a new branch was created.

poly status

View changed, new, and deleted files in your project.

poly diff

Show differences between the local project and the remote version. Examples:

poly revert

Revert local changes. Examples:
poly revert with no arguments reverts every change in the working tree; pass file paths to revert only those files.

poly branch

Manage project branches. Examples:

poly branch merge

Merge the current branch into main via the CLI. A merge message is required.
For the full merge workflow — conflict tables, --interactive flow, the --resolutions JSON format, post-merge behavior, and troubleshooting — see the dedicated Branch merging reference.

poly branch delete

Interactively select and delete one or more branches. The main branch cannot be deleted.
  • Run without arguments to open an interactive checkbox prompt for selecting branches to delete.
  • Pass a branch name directly to skip the interactive prompt and delete that branch after confirmation.
poly branch delete requires a TTY and may fail with a 404poly branch delete opens an interactive confirmation prompt and must be run in a terminal. In non-interactive environments (scripts, CI), it throws [Errno 22] Invalid argument.On some projects, the delete command hits the same platform endpoint as branch chat and returns a 404 after the confirmation. If this happens, delete the branch through the Agent Studio UI instead.

poly branch create

Creates a new branch. By default the branch is sourced from the project’s main branch (the sandbox environment). When --env live or --env pre-release is specified:
  • the version of the deployed environment is pulled into your local workspace
  • a branch is created from that snapshot
  • the version is immediately pushed to the new branch, leaving a clean slate for hotfix changes
  • the command can only be run from main
  • if there are local changes, the command will fail unless --force is also passed
Use --env live with cautionBranching from a live deployment snapshot will overwrite your local project with the live state. Merging this branch back to main may roll back changes that were introduced after the snapshot was taken.
Only one active branch is allowed at a timeAgent Studio supports one non-main branch per project. Attempting to create a second branch while one already exists returns an error. Merge or delete the existing branch in Agent Studio before creating a new one.

poly format

Format project resources. Examples:

poly validate

Validate project configuration locally.

poly review

Create a GitHub Gist of Agent Studio project changes to share with others. poly review requires a subcommand: create, list, or delete. Use poly review create to compare your local changes against the remote project, or pass --before and --after to compare two remote branches or versions. Add --verbose for full error tracebacks while troubleshooting. Examples:

poly review list

Interactively select a review gist and open it in the browser.

poly review delete

Interactively select and delete review gists. Use --id to delete a specific gist directly without an interactive prompt.

poly chat

Start an interactive chat session with your agent, or run scripted/automated conversations. Examples:

Non-interactive (scripted) mode

Supply messages directly on the command line or from a file to run poly chat without a human at the terminal. This is useful for automated testing pipelines and CI scripts. Inline messages — use -m/--message (repeatable):
File-based input — use --input-file:
Each line of the file is sent as a separate message. Use - to read from stdin. If the file path does not exist, poly chat exits with an error.

Resuming an existing conversation

Use --conversation-id (or --conv-id) to resume an existing conversation by its ID instead of creating a new session:

Pushing before chatting

Use --push to push the local project to Agent Studio before starting the chat session. This ensures local changes are live before testing without requiring a separate poly push step:
If the push fails, the command exits without starting the chat session.

Language flags

Use language flags to specify the expected input and output language when chatting against multilingual agents. If not specified, the project default is used. --input-lang and --output-lang take precedence over --lang when both are supplied.

poly chat flags summary

poly conversations

List and inspect conversations for the project using the public Conversations API. poly conversations requires a subcommand: list, get, or get-audio. Examples:

poly conversations list

List conversations for the project.
The default table view shows conversation ID (rendered as a clickable Agent Studio link), start time, duration, caller number, channel, variant (when present), handoff status, and a short summary heading.

poly conversations get

Get detailed information for a specific conversation, including all turns.
The default output shows conversation metadata (channel, language, duration, timestamps, handoff, tags, PolyScore, summary, note) followed by a turn-by-turn transcript.

poly conversations get-audio

Download the audio recording for a conversation as a WAV file.

poly docs

Output resource documentation. Examples:
Use --output to write the documentation to a local file. This is useful when working with AI coding tools — pass the output file as context to give the agent accurate knowledge of ADK resource types and conventions. Available resource names include:

poly deployments

Manage deployments for the project.

poly deployments list

List deployments for the project. Examples:

poly deployments list

List deployments for the project.
Use --details for readable outputThe default tabular view may wrap long URLs across multiple rows, making it unreadable in narrow terminals. --details produces a vertical layout that is easier to read.

poly deployments promote

Promote a deployment to the next environment (pre-release or live), removing the need to use the Agent Studio UI. Examples:
When promoting to live, the command searches for the deployment in pre-release and uses sandbox as the linear history source for computing included changes. When promoting to pre-release, the command searches sandbox. The output includes:
  • the deployment hash being promoted
  • whether it is a first-time promotion to that environment
  • a list of included deployments (changes being promoted) or reverting deployments (when promoting to an older version)
Without --force, the command prompts for confirmation before proceeding and optionally allows you to enter or override the deployment message interactively.

poly deployments rollback

Roll back sandbox to a previous deployment version. Examples:
The output includes a list of reverting deployments — the versions that will be undone when the rollback completes. Without --force, the command prompts for confirmation before proceeding.

Machine-readable JSON output

All core subcommands accept a --json flag that switches stdout to a single JSON object. This is designed for scripting, CI pipelines, and any integration that needs stable, parseable output rather than human-readable console text.
When --json is used:
  • stdout contains exactly one JSON object
  • the process exits with code 0 on success and non-zero on failure
  • human-readable console messages are suppressed
--interactive and --json cannot be used togetherpoly branch merge --interactive requires a terminal for its conflict-resolution prompts and is incompatible with --json.
--json implies --force for deployments commandsWhen --json is used with poly deployments promote or poly deployments rollback, the confirmation prompt is automatically skipped (equivalent to passing --force).

JSON output shapes

The exact fields vary by command. Common fields include: For poly branch delete --json, when a branch that was the current branch is deleted, the response also includes "switched_to": "main". For poly branch merge --json, a successful merge returns { "success": true }. When conflicts or errors are present, the response includes "conflicts" and "errors" arrays containing the raw conflict and error objects from the platform. For poly deployments show --json, the response includes:
  • deployment — the full deployment record for the requested version hash.
  • active_deployment_hashes — a map of environment names to the currently active version hash in each environment.
  • included_deployments — the list of sandbox deployments included since the predecessor version in the queried environment.
  • is_rollbacktrue if the deployment is a rollback to an older version.
Error responses always include { "success": false, "error": "...", "traceback": "..." }.
init with --json requires explicit flagsWhen using poly init --json, you must supply --region, --account_id, and --project_id explicitly. Interactive prompts are not supported in JSON mode.
poly project create with --json requires explicit flagsWhen using poly project create --json, you must supply --region, --account_id, and --name explicitly. Interactive prompts are not supported in JSON mode.

poly chat --json output shape

When --json is used with poly chat, the command emits a single JSON object when the session ends:
  • conversations is an array because /restart in scripted input produces multiple entries.
  • turns[0] is always the agent greeting, with "input": null.
  • If --push is also supplied, the output includes a push key: { "push": { "success": true, "message": "..." } }.
  • If --functions, --flows, or --state are also set, the relevant metadata fields are included in each turn.

poly conversations get-audio --json output shape

When --json is used with poly conversations get-audio, the audio is still written to disk and the command emits a JSON summary:

poly deployments promote --json output shape

On dry run, "dry_run": true is added and "success" reflects the pre-flight state without any changes being made. On error, "success": false and "error": "..." are returned.

poly deployments rollback --json output shape

On dry run, "dry_run": true is added. On error, "success": false and "error": "..." are returned.

poly push --output-json-commands

Adds a commands array to the JSON output of poly push, containing the serialized Agent Studio commands that were staged. Useful for dry-run review and integration testing.
The output will include a commands key with each command serialized from its protobuf representation.

Driving pull/push from a captured projection

The --from-projection flag on pull, push, init, and branch switch lets you supply a projection JSON directly (as a string or via stdin with -) instead of fetching it from the API. This is useful for offline workflows and integration testing.
The --output-json-projection flag on pull, init, and branch switch includes the projection in the JSON output when --json is also set. This lets you capture a projection from one command and feed it into another.

Working pattern

A typical CLI workflow looks like this:
  1. create a new project with poly project create or initialize an existing one with poly init
  2. pull with poly pull if needed to refresh local state
  3. create or switch to a branch
  4. edit files
  5. inspect changes with poly status and poly diff
  6. validate with poly validate
  7. push with poly push
  8. optionally review with poly review
  9. test or chat with the agent using poly chat
  10. browse and debug conversations with poly conversations list and poly conversations get
  11. merge the branch with poly branch merge '<message>'
  12. promote to pre-release or live with poly deployments promote
Run commands from the project folderADK commands are expected to be run from within your local project directory. If needed, use the —path flag to point to a project explicitly.

Build an agent

See how the CLI fits into a real workflow.

Branch merging

Conflict resolution, --interactive flow, and --resolutions JSON for poly branch merge.

Tests

Write and manage simulated conversation tests in test_suite/.

Working locally

How the CLI fits into the daily edit/push/test loop.
Last modified on July 9, 2026