You can now set AI credit session limits in Copilot CLI and the GitHub Copilot SDK to cap the amount an agent spends in a session. This is especially useful for automation, where no one is actively monitoring the agent’s work.

Set a limit before you start work or kick off jobs, and Copilot tracks AI credit usage across the entire session, including model calls, subagents, and background work like compaction. When the limit is reached, the agent wraps up and lets you know instead of running until the task is finished or until you manually stop it.

  • In an interactive session, use /limits to view, set, or remove your limit. When it’s reached, Copilot prompts you to raise or adjust it and then continues from where it stopped. There’s no need to restart the task.
  • For noninteractive runs, pass --max-ai-credits to bound a single run. The run ends when the limit is reached, so it’s easy to use in scripts.

Session limits are a soft cap. Since usage is only known after a response returns, a response that’s already underway finishes before Copilot stops, so actual usage may slightly exceed the number you set. A session limit controls spend for one session—it complements, but doesn’t replace, your overall budgets and spending limits.

Session limits are available in public preview for Copilot for Individuals, Business, and Enterprise, and are subject to change. They’re supported in Copilot CLI 1.0.66 and later, and in Copilot SDK 1.0.5 and later.

To get started, update GitHub Copilot CLI by running copilot update in your terminal. To learn more, see Setting a session limit in Copilot CLI and Optimize AI usage.

Share feedback with the /feedback command in a CLI session or open an issue in our public repository.