AI Agent News/stories/claude-code-v2-1-317-adds-gateway-cost-report-and-sdk-hook-failure-blocking.md

Frameworks

Claude Code v2.1.317 adds gateway cost report and SDK hook failure blocking

Anthropic has released Claude Code v2.1.317 on GitHub, with a long list of fixes and several new options. The additions include a cost report endpoint for Claude apps gateway admins and an onFailure setting for Agent SDK hook callbacks.

Source: github.com/anthropics/claude-code/releases/tag/v2.1.317

The release adds onFailure: "block" for Agent SDK hook callbacks, so a callback that fails stops the action it guards instead of letting it run. It also adds a cost report to the Claude apps gateway admin API at GET /v1/organizations/analytics/cost, which reads past spend over a date range in total, per developer, per day or per IdP group.

Gateways with admin set now keep a daily record of each developer's IdP groups for admin.identity_retention_days, and the cost report groups spend by that record. Setting CLAUDE_CODE_DISABLE_NESTED_SESSION_ID to 1 on a self-hosted runner makes claude -p run inside a session that uses that session's ID and transcript, as earlier versions did.

Other changes add a prompt before a web or shell tool call sends the account email address over the network, and a warning in /schedule when a new cloud scheduled task gets connectors the user did not ask for. Many fixes cover auto mode, MCP server connections, OpenTelemetry export timeouts and Windows path handling.

Why it matters if you build agents

Teams that run agents through the Claude apps gateway can now pull spend by developer, day or IdP group from the admin API instead of building their own tally. Agent SDK hook authors can choose to fail closed when a callback errors. Developers running claude -p on self-hosted runners should check the new variable if their setup depends on the earlier session behavior.

Get stories like this every weekday

One short email with the day's agent tooling news.

Subscribe