Agents CLI
Run codity agent in a repository to start a coding agent with no setup. Use the other codity agent commands to manage your organization's agents, and the installed codity-agent runner to continue a saved session.
Install
Install or update the Codity CLI. Agents run on Linux and macOS (on Windows, use WSL), and the machine needs Node.js 18 or newer.
You don't need to sign in first. If you aren't signed in, codity agent signs you in on the spot. Agents belong to the organization you signed in to.
Start an agent
From anywhere inside a Git repository:
codity agent
This opens an interactive agent in your terminal, working in the repository's root folder (outside a repository, the current folder). There is nothing to configure:
- Model: Auto picks a Claude or GPT model for each message, with the Balance priority.
- Billing: your organization's Codity credits when its wallet has a balance, otherwise the
OPENAI_API_KEY,ANTHROPIC_API_KEYorOPENROUTER_API_KEYset on this machine. - Memory: your team's memory for the repository, when it is on.
- Permissions: read and write access to the working folder, the standard deny rules and your organization's policies. Anything else comes to you as a permission request in the terminal. Plain read commands (
cat,head,tail,wc,ls,grep,echo) are pre-approved.
The first line confirms what was chosen, for example:
Agent ready: auto model (balance) · team memory for github:acme/payments · Codity credits
Press Shift+Tab in the agent to switch between Build, Plan and Auto mode, which approves routine actions such as test runs for you.
If there are no credits and no model key, the agent doesn't start and tells you to export OPENAI_API_KEY, ANTHROPIC_API_KEY or OPENROUTER_API_KEY, or to top up your wallet.
Run a task without the terminal UI
Pass the task, in quotes, as an argument to run it headless in this terminal:
codity agent "Add a --verbose flag to the CLI and a test for it."
A single word is treated as a mistyped subcommand (codity agent lst suggests list) rather than a task; for a one-word task, use codity agent launch WORD. The agent works until the task is finished. Permission requests wait for your answer: approve them from another terminal with the command it prints, codity agent approvals AGENT_ID --interactive, or on the dashboard.
Choose options before starting
codity agent --configure
This asks for the task (optional), the model (auto or a specific provider/name) and the Auto priority, and whether to ask before or refuse actions outside the agent's permissions. Every answer has a default, so you can press Enter through it. You can also pass the same choices as flags:
codity agent --router intelligence --strict "Find why the nightly import is slow."
codity agent --model anthropic/claude-sonnet-5-5
One agent per folder
Each time you start codity agent (without a task) in the same folder, it continues as the same agent on your dashboard, with a new run. Closing the agent and starting it again doesn't add another agent, and the agent's page adds up the runs and spend across all of them. Starting it in a different folder creates a separate agent. A headless task (codity agent "...") and codity agent launch always create their own agent.
A relaunch applies the options you start it with this time, such as a different model or priority, and keeps the rules you approved with --always. While an earlier session in the folder is still running, the new one must use the same model, billing and priority; otherwise it stops with a message saying which differ. Finish the other session first, or use codity agent launch for a separate agent.
Publish your changes as a pull request
Ask the agent to raise a pull request when you want to publish its work. It prepares the branch, commit and pull request, then asks you to approve that one publish before anything is pushed. The agent never starts publishing on its own.
Launch a new agent
codity agent launch creates a fresh agent for a task each time, and is useful in scripts or for preparing an agent for another machine:
mkdir -p /tmp/codity-agent-demo
cd /tmp/codity-agent-demo
codity agent launch "Write a short hello message to hello.txt in this folder." --strict
It works in the current folder unless you pass --dir, runs headless unless you pass --interactive, and uses the same Auto and billing defaults as codity agent. It prints the agent ID and dashboard link.
To pin a model, pass --model provider/name. A fixed model takes its key from --llm-key-env if supplied, otherwise a matching key stored by codity config set-llm, otherwise the provider's environment variable on the target machine. --llm-key-env submits that variable's value to Codity for encrypted storage. To keep a key solely on the machine, leave that flag unset and avoid a stored CLI key for that provider. With --model auto, keys always stay on the machine.
An interactive launch still takes one positional task argument. You can pass an empty quoted string to start without a task:
codity agent launch "" --interactive --strict
Launch commands take no team flag. In the terminal UI, /team-policy sets one (see Team policy). An agent created in the dashboard or through API configuration creation keeps the team chosen there.
Flags
These flags work with both codity agent and codity agent launch.
| Flag | Meaning |
|---|---|
--model auto or --model provider/name |
auto (the default) lets Codity pick the model for each message. Otherwise a fixed model such as openai/gpt-6.1-sol. |
--router PRIORITY |
Auto's priority: cost, balance (the default) or intelligence. |
--billing MODE |
Who pays for model calls. auto (the default) uses Codity credits when the wallet has a balance, otherwise this machine's keys. credits always uses the wallet. byok always uses this machine's keys. |
--no-memory |
Start without your team's memory. |
--no-recovery |
Don't save the session. It can't be continued later with --continue or codity-agent resume. |
--label NAME |
Name shown on the dashboard; otherwise derived from the task or folder. |
--dir PATH |
Working folder. codity agent defaults to the Git repository root; launch defaults to the current folder. |
--llm-key-env VARIABLE |
With a fixed --model, read the model API key from the named environment variable and submit it with the configuration. |
--strict |
Refuse unlisted actions instead of asking. |
--no-default-reads |
Don't pre-approve the plain read commands listed above. |
--allow-read PATH |
Add filesystem Read access; repeat for multiple paths. |
--allow-write PATH |
Add filesystem Write access; repeat for multiple paths. |
--allow-bash PATTERN |
Add a shell command pattern; quote globs and repeat as needed. |
--allow-host PATTERN |
Add a fetch URL/host pattern; use a full URL pattern such as https://example.com/**. |
--ack-bash-gateways |
Acknowledge command grants that can execute arbitrary commands. Such commands can access files with the machine's permissions. |
--print |
Create the agent and print an install command without executing it. |
--os linux or --os macos |
Target for a printed command; defaults to this machine. |
--json |
Print the launch response without starting the runner. It contains private bootstrap credentials. |
--configure |
codity agent only: choose the options interactively before starting. |
--continue, -c |
codity agent only: reopen the latest session in this repository. See Continue a session. |
--resume, -r |
codity agent only: reopen a saved session by ID (codity agent --resume SESSION_ID), or choose one from this folder's sessions. |
--interactive |
launch only: open the terminal UI. |
For another Linux machine:
codity agent launch "Summarize the application logs." --dir /srv/my-app --allow-read '/var/log/my-app/**' --strict --print --os linux
Run the printed command from /srv/my-app on the target within five minutes. If the agent will use model keys rather than Codity credits, make sure the key is set there. The command is single-use; protect it as a credential.
List your organization's agents
codity agent list
In a terminal this opens a picker of your organization's agents; choose one to act on it. With --json, or when the output is piped, it prints one line per agent instead. Auto agents show their model as Auto.
Inspect runs and send messages
Replace AGENT_ID, RUN_ID and REQUEST_ID below with IDs from your own agent:
codity agent list
codity agent show AGENT_ID
codity agent logs AGENT_ID
codity agent logs AGENT_ID --run RUN_ID --follow
codity agent send AGENT_ID "Summarize your findings so far." --run RUN_ID
logs and send use the latest run when --run is omitted. Messages reach a running agent on its next heartbeat; they do not restart a stopped session. --json produces structured output; following logs with --json produces one event per line.
Decide permission requests
codity agent approvals AGENT_ID
codity agent approvals AGENT_ID --interactive
codity agent approve AGENT_ID REQUEST_ID
codity agent approve AGENT_ID REQUEST_ID --run
codity agent approve AGENT_ID REQUEST_ID --always
codity agent deny AGENT_ID REQUEST_ID
Approval defaults to once. --run allows the resource for the current run; --always adds it to the configuration for future runs. These two flags cannot be combined. approvals --all includes decided and expired requests. Explicit shared denies cannot be overridden. See Permissions and YAML policies.
Install an existing configuration
codity agent install-cmd AGENT_ID
This prints a fresh one-machine command. For a reusable command:
codity agent install-cmd AGENT_ID --reusable --label staging --max-installs 3 --expires-days 7
Each machine creates a separate run. Reusable tokens default to seven days, and install limits are optional. Install commands create fresh runs, not recovered sessions.
Team policy
Type /team-policy in the terminal UI to choose which team's agent policy applies, on top of your organization's. The list shows the teams you belong to that have an agent policy, plus No team for the organization's policy alone.
- The new policy applies from the agent's next action, without restarting the session. A team that turns off Auto approvals stops them at once.
- Your choice is remembered: every
codity agentsession you start afterwards, in any folder, begins on that team until you pick another (choosing No team is remembered too). If you leave the team or its agent policy is removed, new sessions start with your organization's policy alone. Each switch appears on the run's dashboard page. - A team's denies always hold. Its allows let those actions run without asking.
/team-policyis for agents you start withcodity agent. An agent created in the dashboard or through the API keeps the team set there, and/team-policyshows which one.- Team membership is matched on the Git login from your Codity sign-in, never on a display name. A session continued from before this check existed asks you to start a new one with
codity agent(runcodity loginfirst if it asks).
Continue a session
Every codity agent session is saved unless you pass --no-recovery. To pick up where you left off in the same repository:
codity agent --continue
codity agent --continue "Now add tests for the parser."
--continue reopens the latest session for the repository with its conversation. Without an instruction, the agent waits for you to type. With one, the agent starts on it. Each continuation is a new run on the dashboard, billed like any other. Inside the terminal UI, /sessions lists every saved conversation in this folder, from earlier runs too, and switches to the one you pick.
To choose an older session instead, run codity agent --resume (or codity agent resume): it lists this folder's saved sessions to pick from. Pass a session ID to open that one directly, --last for the newest, or --all (with codity agent resume) to choose from every folder:
codity agent --resume
codity agent --resume SESSION_ID
codity agent resume --last
codity agent resume --all
The same sessions are also available through codity-agent below.
Resume with codity-agent
The agent installer also installs codity-agent, usually under ~/.local/bin. It does not require a new codity login to resume: the saved session has its own scoped machine credential.
codity-agent --help
codity-agent sessions
codity-agent resume --last
codity-agent resume
codity-agent resume SESSION_ID --prompt "Continue with the next task."
codity-agent sessions --all
codity-agent resume --all
Sessions started with codity agent are saved automatically. For an agent created in the dashboard, enable recovery before the session starts. Quit with Ctrl+C and let shutdown finish, then run resume --last from the original folder. resume --all opens a picker across folders. It does not resume all sessions at once.
| Runner flag | Use |
|---|---|
--last |
Select the latest saved session in this working folder. |
--all |
List or choose sessions across folders. |
--prompt "TEXT" |
Supply a follow-up instruction with the restored conversation. |
--reconcile=completed |
Explicitly mark listed interrupted actions as completed after checking their effects. |
--reconcile=retry |
Explicitly allow retry of listed interrupted actions after reviewing possible side effects. |
--accept-workspace-changes |
Consent to a changed checkout/files after reconciling them yourself. |
Session IDs come from codity-agent sessions and identify runs, not fleet configurations. See Session recovery for crashes, another machine and checkpoint limits. codity agent --continue is codity-agent resume --last for the repository; for anything else, use codity-agent resume.
Stop permanently
codity agent stop AGENT_ID
This revokes the configuration and signals its live runs to stop. It prevents later installs and recovery. For a resumable pause, use Ctrl+C in a recovery-enabled agent terminal instead.

