Skip to main content
You can drive Amika from a shell script, a CI job, or a TypeScript program. This guide shows one complete flow with the CLI and with the TypeScript SDK:
  1. Create a rig from a git repository.
  2. Send a prompt to Claude Code to change the code.
  3. Continue the same chat to commit the change and open a pull request.
  4. Delete the rig.
To run shell commands without an agent, or to run them on a schedule, see Command runs and Jobs.

Prerequisites

  • An Amika API key in AMIKA_API_KEY. Create one at app.amika.dev/settings/api-keys. See Authentication.
  • For the CLI: the CLI and jq. See Install. For TypeScript: npm install @amika/sdk. See the TypeScript quickstart.
  • A Claude credential stored in Amika. This guide uses the name ci-claude.
  • GitHub access to the repository. A request with an API key has no GitHub App connection, so the rig uses your organization’s GitHub personal access token (PAT). Save a PAT that can push to the repository and open pull requests. See GitHub authentication.

Walkthrough

1

Store a Claude credential

Do this one time. Give the credential a name, so that the script can select it. See Manage secrets for the other credential types.
--from-file and --name keep the command non-interactive.
2

Create a rig

  • --agent-credential claude=ci-claude (agentCredentials) injects the stored credential by name. Without it, the rig gets no agent credential.
  • The GIT_* variables set the commit author. A rig that you create with an API key has no git author, so commits fail without them.
  • The CLI returns when the rig is ready. In TypeScript, rigs.create returns before setup finishes, so call rig.wait().
3

Send a prompt to the agent

The call returns when the agent turn finishes. With -o json, the CLI prints one JSON object. Keep its session_id (sessionId) to continue the chat.An agent failure sets is_error (isError) to true, also when the request succeeds. Check it before you continue.
4

Continue the chat to open a pull request

The agent keeps the context of the first turn. Two short prompts are more reliable than one long prompt.
5

Delete the rig

--force skips the confirmation prompt.

Full script

Each script deletes the rig, also when a step fails.

Next steps

Command runs

Run shell commands on a rig through the API, without an agent.

Jobs

Run commands on a rig on a cron schedule.

Send a message to an agent

All options for agent prompts and chats.

TypeScript SDK

Every collection and method on AmikaClient.