Add sandbox AgentAssertion auth for Responses#3482
Draft
neil-oai wants to merge 1 commit into
Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This adds opt-in sandbox runtime auth for Python Agents SDK OpenAI Responses calls. When
SandboxRunConfig(agent_runtime_auth=OpenAIAgentRuntimeAuthConfig(...))is provided, orOPENAI_AGENT_RUNTIME_AUTH_ENABLED=trueis set, sandbox-backed runs register an agent runtime/task with AuthAPI and attach a verifiedAuthorization: AgentAssertion <token>header to Responses traffic.The goal is to populate verified
agent_runtime_id/task_idon 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-suppliedAuthorizationheaders inModelSettings.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 theencryptextra/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 -qmake formatmake lintmake typecheckmake testsuv run pre-commit run --all-fileswas 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
make lintandmake formatDocs 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.