Skip to content

Add sandbox AgentAssertion auth for Responses#3482

Draft
neil-oai wants to merge 1 commit into
mainfrom
codex/sandbox-agent-assertion-auth
Draft

Add sandbox AgentAssertion auth for Responses#3482
neil-oai wants to merge 1 commit into
mainfrom
codex/sandbox-agent-assertion-auth

Conversation

@neil-oai
Copy link
Copy Markdown

Summary

This adds opt-in sandbox runtime auth for Python Agents SDK OpenAI Responses calls. When SandboxRunConfig(agent_runtime_auth=OpenAIAgentRuntimeAuthConfig(...)) is provided, or OPENAI_AGENT_RUNTIME_AUTH_ENABLED=true is set, sandbox-backed runs register an agent runtime/task with AuthAPI and attach a verified Authorization: AgentAssertion <token> header to Responses traffic.

The goal is to populate verified agent_runtime_id/task_id on the server-side auth context so Responses analytics can attribute sandbox Agents SDK token/model usage to registered runtimes and tasks. The implementation deliberately does not use arbitrary client attribution headers, rejects explicit user-supplied Authorization headers in ModelSettings.extra_headers, and leaves non-sandbox agents and Chat Completions unchanged.

This covers both Responses transports: HTTP requests receive the AgentAssertion in request extra_headers, and Responses websocket sessions receive it in the websocket handshake headers. This also adds PyNaCl to the encrypt extra/dev dependencies because AuthAPI returns task IDs encrypted with libsodium sealed boxes.

Test plan

  • uv run pytest tests/models/test_openai_agent_runtime_auth.py tests/sandbox/test_compatibility_guards.py -q
  • make format
  • make lint
  • make typecheck
  • make tests
  • uv run pre-commit run --all-files was attempted, but this repo does not have a .pre-commit-config.yaml; the repo-required Makefile verification stack above is clean.

Issue number

N/A

Checks

  • I've added new tests (if relevant)
  • I've added/updated the relevant documentation
  • I've run make lint and make format
  • I've made sure tests pass

Docs note: this is an opt-in attribution/auth plumbing change for an internal rollout path; I left public docs for a follow-up once the rollout surface is agreed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants