Let a person act as one of their agents (X-Vtodo-Act-As, MCP act_as) #133

Merged
CrowderSoup merged 2 commits from claude/agent-act-as into main 2026-11-20 14:50:41 +00:00
Owner

Why

The usage review showed that Azure runs about six Claude "workers" through the claude.ai vTodo connector. They all sign in with OAuth as Azure, so every change, comment and claim says Azure. Agent sub-accounts already exist, but they can only sign in with their own API token, which claude.ai can't use. Production has zero agents.

What

  • API: token and OAuth requests may send X-Vtodo-Act-As: <agent id>. The request then runs as that agent (apps/api/authentication.py:act_as), with exactly the access an agent gets with its own token: its person's workspaces, member at most.
    • Only your own agents.
    • An agent can't act as another agent.
    • A non-numeric value gets 400, and a bad id gets 403. 403 rather than 401, so mcp_server doesn't throw away the caller's token.
    • Browser sessions ignore the header.
    • GET /api/v1/agents/ lists your agents' ids.
  • MCP:
    • Every tool that takes workspace now also takes act_as (an agent's id, or its name looked up with list_agents). A test makes sure new tools don't miss it.
    • The new list_agents tool tells a Claude session to pass its agent name on every change.
  • Settings → API and the README explain the new option.

Testing

  • apps/api/tests/test_act_as.py checks history, comment authors, claims, claim_next_task, the member cap, and refusals.
  • mcp_server/tests/test_act_as.py checks the header and name lookup.
  • Full suite: 872 passed. makemigrations --check is clean, and there's no migration.

After deploy

Azure adds an agent per worker in Settings → API (she doesn't need the token), then adds "You are Spotter; pass act_as="Spotter"" to each worker's prompt.

🤖 Generated with Claude Code

## Why The usage review showed that Azure runs about six Claude "workers" through the claude.ai vTodo connector. They all sign in with OAuth as Azure, so every change, comment and claim says Azure. Agent sub-accounts already exist, but they can only sign in with their own API token, which claude.ai can't use. Production has zero agents. ## What - **API:** token and OAuth requests may send `X-Vtodo-Act-As: <agent id>`. The request then runs as that agent (`apps/api/authentication.py:act_as`), with exactly the access an agent gets with its own token: its person's workspaces, member at most. - Only your own agents. - An agent can't act as another agent. - A non-numeric value gets 400, and a bad id gets 403. 403 rather than 401, so mcp_server doesn't throw away the caller's token. - Browser sessions ignore the header. - `GET /api/v1/agents/` lists your agents' ids. - **MCP:** - Every tool that takes `workspace` now also takes `act_as` (an agent's id, or its name looked up with `list_agents`). A test makes sure new tools don't miss it. - The new `list_agents` tool tells a Claude session to pass its agent name on every change. - Settings → API and the README explain the new option. ## Testing - `apps/api/tests/test_act_as.py` checks history, comment authors, claims, `claim_next_task`, the member cap, and refusals. - `mcp_server/tests/test_act_as.py` checks the header and name lookup. - Full suite: 872 passed. `makemigrations --check` is clean, and there's no migration. ## After deploy Azure adds an agent per worker in Settings → API (she doesn't need the token), then adds "You are Spotter; pass act_as=\"Spotter\"" to each worker's prompt. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Let a person act as one of their agents (X-Vtodo-Act-As, MCP act_as)
All checks were successful
tests / pytest (push) Successful in 1m13s
75578b4a0f
Agents only signed in with their own API token, so Claude sessions using
the claude.ai connector (OAuth as the person) could never be credited to
an agent. In production every worker acted as its person, and no agents
existed.

- API: token and OAuth requests may send X-Vtodo-Act-As: <agent id>. The
  request then runs as that agent, with its usual member-at-most access.
  Only the caller's own agents; an agent can't act as another; browser
  sessions ignore the header. GET /api/v1/agents/ lists the ids.
- MCP: every tool that takes `workspace` also takes `act_as` (agent id or
  name), and a new list_agents tool explains when to use it.
- Settings → API and the README say how.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Merge main (custom fields, #134) into agent act-as
All checks were successful
tests / pytest (push) Successful in 1m12s
android / apk (push) Successful in 9m28s
4e2f934926
Both sides kept: the agents and fields endpoints, list_agents and
list_fields in the MCP client and server (list_fields takes act_as like
every other workspace tool), and both README bullets. Adds a test that an
agent setting Waiting on is credited with the change and the reason.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign in to join this conversation.
No description provided.