Learning resourcesReviewed · GitHub

GitHub Copilot SDK: Session limits

GitHub’s Session limits guide teaches Copilot SDK developers to set session usage budgets, but a model response can exceed the budget before further calls are blocked. It covers AI Credits limits, session creation and resumption, and events for tracking usage and requesting a user decision.

Researched 15 Nov 2026

In short.

This GitHub Copilot SDK guide helps application developers add session budgets, but its soft caps allow one model response to push usage above the limit. It documents configuration in six languages and events for usage tracking and budget decisions. Pricing, accounting-window duration, compatible versions and the API for answering an exhausted-budget request are not established by this page. Runtime behavior is untested.

Researched and written by an AI model and checked by a second AI model. How it works

Covers the complete Session limits documentation page at [https://docs.github.com/api/article/body?pathname=/en/copilot/how-tos/copilot-sdk/features/session-limits], including all six configuration examples, the event table and the TypeScript event-handler example. Linked pages and other documentation are excluded. This page contains no explicit licensing notice. No code was executed; runtime enforcement, compatibility and end-to-end budget decisions remain untested.

The overview

Identity

Session limits is a GitHub Docs guide to configuring AI Credits budgets for Copilot SDK sessions. Its source address is [https://docs.github.com/api/article/body?pathname=/en/copilot/how-tos/copilot-sdk/features/session-limits].

The resource is a feature guide with configuration examples and an event reference. It does not provide a complete application or installation tutorial.

Assessment

The guide is useful for adding a session budget and showing users when it is exhausted. Its main practical limitation is enforcement timing: usage is checked after a model call returns.

It provides enough detail to identify the configuration fields and relevant events. Installation, authentication and completing the user-decision flow require information beyond this page.

Users

The guide suits developers integrating the Copilot SDK into applications, particularly those building a budget display or a prompt asking whether a session should continue.

Beginners can follow the examples once they have a working SDK client. Experienced developers get exact event names and payload fields, but no documented concurrency behavior or complete exhausted-budget response implementation.

Capabilities

Applications can supply an AI Credits soft cap when creating or resuming a session. Examples cover TypeScript, Python, Go, .NET, Java and Rust.

Four events cover limit changes, durable usage checkpoints, a request for a user decision after budget exhaustion, and completion of that decision. A null sessionLimits value in session.session_limits_changed means no limits are active.

Using it

Requirements

The examples assume an initialized Copilot SDK client and available permission-handler definitions. The SDK forwards the configured limit to the Copilot CLI when creating or resuming the session.

Required SDK and CLI versions, installation steps, authentication requirements, account eligibility and supported operating systems are not specified.

Mechanism

maxAiCredits sets a soft cap for the session’s current accounting window. The runtime checks usage after model calls return, so one response can exceed the cap before the next model call is blocked. The window’s duration and reset rules are not explained.

session.usage_checkpoint records durable aggregate usage for resumption and accounting through totalNanoAiu and optional totalPremiumRequests. session_limits_exhausted.requested carries requestId, maxAiCredits and usedAiCredits. The corresponding completed event includes response.action and optional response.additionalAiCredits and response.maxAiCredits; supported action values are not listed.

Setup

Pass the limit configuration when creating or resuming a session. TypeScript uses sessionLimits.maxAiCredits; Python uses session_limits with max_ai_credits. The other language examples show their corresponding configuration types.

Subscribe to session events using the SDK’s generated event types. All of the page’s configuration snippets also approve every permission request. Choose permission handling deliberately rather than assuming that the budget setting controls permissions.

Example

The TypeScript example calls client.createSession with sessionLimits: { maxAiCredits: 30 }, then shows client.resumeSession receiving the same configuration. The value 30 is an illustrative AI Credits cap, not a price or a guarantee that usage cannot exceed 30.

A separate event handler checks for session_limits_exhausted.requested and passes requestId, maxAiCredits and usedAiCredits to showBudgetDialog. The dialog implementation and code for submitting the user’s decision are not provided. Neither example was executed.

Assessment & evidence

Limitations

The documented control applies to a session’s current accounting window. The page does not establish an application-wide budget across sessions, the maximum overrun, or behavior when model calls overlap.

It also leaves accounting-window boundaries, credit conversion, supported exhausted-budget actions and the response API unspecified. Configuration and event behavior have not been independently verified.

Reasoning

Because enforcement follows a completed model call, applications should allow for usage above the configured cap. The documentation does not provide enough information to calculate that allowance.

The event fields can support a user interface explaining the configured budget and observed usage. That is an inference from the documented payloads; the page supplies only a partial interface example.

Alternatives

The page does not compare other SDKs, application-wide quotas or hard spending controls. It therefore provides no basis for ranking alternatives or identifying a replacement that guarantees a strict monetary ceiling.

Evidence

The source provides configuration snippets for six languages, a four-event reference table and a TypeScript event-handler example. Enforcement and accounting behavior are documentation claims; the page includes no runtime traces or test results.

Access & freshness

Costs

The budget is expressed in AI Credits. The page provides no currency conversion, credit pricing, subscription requirements or model-specific consumption rates, so monetary cost is unknown.

A configured cap is not a documented hard spending ceiling. The page explicitly allows overshoot and does not quantify its maximum size.

Rights

This page contains no explicit license or redistribution terms for its prose or code examples. Licensing for those materials, the SDK and the CLI is not established by this page.

Freshness

The page was captured on 2026-11-15 at 15:08:45.482 UTC. This is the capture time, not a stated publication or update date.

This page names no SDK or CLI release version. Compatibility with a particular installed release remains unknown.

Actions

Before integration, confirm compatible SDK and CLI versions, authentication requirements, credit pricing and accounting-window rules. Obtain the API details for answering exhausted-budget requests.

Choose an appropriate permission handler and validate budget overshoot, event delivery, resumption and the user-decision flow in the intended environment before relying on the control.

Evidence for this report

selected-page.txtselected · checked 2026-11-15