Repository navigation
feat(agents): each deployed agent gets a control token, and agent-env sends it on every extension call - #743
Merged
Conversation
… sends it on every extension call A2AAgent.deploy and install_agent mint a per-deploy token and keep it as control_token on DeployedA2AAgent and DeployedAgent, unredacted like DeployedEnv.control_token, so a context rebuilt in another process still has it. Each record's control_headers carry it as Authorization: Bearer. Every call agent-env makes to an agent's extension routes now sends those headers: deploy_agent's MCP, skill, agent-config, snapshot and changelog calls; prompt_agent and always_on (agent-config, trajectory, the live follower, trigger state and decide); peer and trigger registration; the rubric judge; agent-state capture; connect_cdp; the episode proxy; the validator checks. post_agent_config, invoke_transfer, fetch_trajectory, follow_trajectory and ProxyClient take headers. The agent isn't handed the token yet and nothing checks it: agents ignore the header today. The SDK check, the env var and install/v1's control_token param follow in their own change. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…oken too; test doubles take it LiveTurn, not LiveTurns, calls follow_trajectory, so the headers travel with each turn through following_live_trajectory. The tests' stand-in records gain control_token and control_headers, and their fake clients take headers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ken, not Authorization A front door in front of an agent (a private Hugging Face Space, an IAM proxy, a mesh that validates every bearer as a JWT) claims Authorization for its own login, so the agent's token takes a header of its own. The protocol package names it (CONTROL_TOKEN_HEADER) and builds it (client.control_token_headers), and both agent records' control_headers use it. Env routes keep Authorization: Bearer for now. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rs keyword-only The rubric verifier read the judge's control headers through a getattr fallback, so a judge record without them would silently send no token. Both record types carry control_headers, so read it directly. headers is keyword-only on _decide and ProxyClient, so a positional dict can't land in the wrong slot. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Each agent deployment now gets a control token, as env deployments already do, and agent-env sends it on every call it makes to an agent's extension routes. Nothing checks the token yet, and agents ignore the header, so this changes no behaviour. It's the groundwork for the agent SDK to require it.
What changes
A2AAgent.deployandinstall_agentcreate a token with the same generator computers use. It's kept ascontrol_tokenonDeployedA2AAgent, in the instance store, and onDeployedAgent, in the run context.DeployedEnv.control_token, it isn't redacted. A context rebuilt in another process, such as a resumed run, still has it.control_headerscarries it in its own header,AgentEnv-Control-Token: <token>, named by the protocol package (CONTROL_TOKEN_HEADER,client.control_token_headers). It stays out ofAuthorization, which front doors such as a private Hugging Face Space, an IAM proxy or a JWT-validating mesh claim for their own login. Env routes keepAuthorization: Bearerfor now.metadata["deployed_agent"]can passcontrol_tokenthere.deploy_agent: MCP registration, skills, agent-config, snapshot load, changelog enable and apply;prompt_agentandalways_on: agent-config, trajectory, the live trajectory follower, trigger state and decide;peer_agents,register_agent_triggers,deploy_user_sim_agent,rate_user_satisfaction;snapshot_agent_stateand snapshot series);connect_cdp, the episode proxy and its in-process config;a2a-agent add-skill, throughregister_skill.post_agent_config,invoke_transfer,fetch_trajectory,follow_trajectoryandProxyClienttakeheaders, optional so outside callers keep working. The private helpers along the way take them as required arguments, so a new call path has to say what it sends.Not in this change
AGENTENV_CONTROL_TOKEN, and install/v1'scontrol_tokenparam) and the SDK check that refuses a call without it come in their own change.Tests
install_agentrecords it.deploy_agentsends it on every request to the agent.prompt_agentsends it on agent-config.uv sync --locked --extra dev.tst/unit/a2a_agent,tst/unit/task_stepandtst/unit/task: 3,909 passed. The 3 failures fail the same way on main on that box:run_docker_container_test's real local sandbox, and twomcp_cli_buildertests.packages/agentenv-protocol/tests: 1,637 passed.🤖 Generated with Claude Code


Confidence Score: 5/5
The PR appears safe to merge; no actionable new issues were found.Summary
The PR creates a token for each agent deployment, saves it with the deployment records, and sends it through
AgentEnv-Control-Tokenon extension calls.Diagram
%%{init: {'theme': 'neutral'}}%% flowchart LR Deploy["Deploy or install agent"] --> Token["Create control_token"] Token --> Store["Save deployment record"] Store --> Context["Build run context"] Context --> Headers["Read control_headers"] Headers --> Calls["Call agent extensions with AgentEnv-Control-Token"]Reviews (6) · Last reviewed commit: "refactor(a2a-agent): read the judge's co..." · Reviewed by Greptile