+++
title = "Use Bonsai with any coding agent"
description = "Add Bonsai's agent instructions to AGENTS.md or a rules file, for Codex, Cursor, Copilot and other agents that run shell commands."
weight = 22
updated = 2026-11-11

[extra]
nav_title = "Other agents"
weight = 40
+++

Any agent that can run shell commands can manage Bonsai clusters with the [`bonsai` CLI](@/docs/cli/overview/index.md). It only needs to be told how. `bonsai skill print` prints those instructions, the same text as the [Claude Code skill](@/docs/cli/agent-skill/index.md), for you to put wherever your agent reads its instructions.

## Before you start

[Install the Bonsai CLI](@/docs/cli/install/index.md) and log in, in your own terminal:

```bash
bonsai login
```

## AGENTS.md

Many agents, such as Codex, Cursor and GitHub Copilot, read an `AGENTS.md` file at the root of the project. Append Bonsai's instructions to it:

```bash
bonsai skill print >> AGENTS.md
```

The text starts with a few lines of metadata between `---` marks, which you can delete.

## Rules and instructions files

For an agent with its own rules file, write the instructions there:

```bash
bonsai skill print >> .github/copilot-instructions.md     # GitHub Copilot
bonsai skill print >> CLAUDE.md                           # Claude Code, without the skill
```

Or paste the output of `bonsai skill print` into the agent's chat for a single session.

Run the command again after you upgrade the CLI, since the instructions change with it.

## What the instructions say

- Run every command with `--json --no-input`, so the agent reads JSON and never hangs on a prompt.
- Check `bonsai whoami` first, and ask you to run `bonsai login` if there's no token. Never ask for a token in the chat.
- Which command lists, creates, renames, resizes and destroys clusters, and which shows usage, metrics, top queries and past changes.
- Confirm with you before creating, resizing or destroying, since those cost money.
- Never print a cluster's password. Write the URL into a git-ignored env file with `bonsai cluster url <cluster> --write .env`.
- What each [exit code](@/docs/cli/scripting/index.md#exit-codes) means.

## Agents without a shell

An agent that can't run commands can use the [MCP server](@/docs/agents/mcp-clients/index.md) if it speaks MCP, or the [Bonsai API](@/docs/agents/docs-and-api/index.md) directly.
