Claude Opus 5.5

agents-0-25-0-3-b

Claude Code's read-only tools, web search on, ludion sync on

Question

Why does native RPC to my Agent fail when I address it with idFromString()?

Answer key

A correct answer says
Native RPC to async Agent/Think methods first runs lifecycle initialization, so Agents must be addressed by name; stubs from `newUniqueId()` or `idFromString()` fail their first async RPC.
The stale answer
You can get an Agent stub from any Durable Object ID, including `newUniqueId()` or `idFromString()`, and call its methods over RPC.

Answer

An Agent works out its own name from the Durable Object ID (`ctx.id.name`), and only IDs made with `idFromName()` or `getByName()` carry a name. If you address it with `idFromString()`, `newUniqueId()`, or a name longer than 1,024 bytes, the ID has no name. So when your RPC method touches anything that needs `this.name`, the Agent throws: "could not determine its Durable Object name. Address it with idFromName() or getByName()…" (`node_modules/agents/dist/lifecycle-CFu6OV03.js:1097`). To fix it, get the stub by name with `env.MyAgent.getByName(name)`, `getAgentByName(env.MyAgent, name)`, or `idFromName(name)`. If this happens under `wrangler dev`, also update Wrangler/workerd and use a current `compatibility_date`, since older runtimes don't expose `ctx.id.name` at all.

Answering cost $0.11.

Grade

wrong

The judge's reason: It says the RPC fails only if the method touches `this.name`, but the key says every first async RPC fails because lifecycle initialization runs first.

The judge's log

Session log

What the agent wrote, the tools it called, and what they returned, from docs/bench/2026-10-11-done3/runs/B-project-sync/agents-0-25-0-3-b.jsonl. Thinking and the session's settings are left out. The raw log

  1. Tool call: Grep

    {
      "pattern": "idFromString|before it was set|setName",
      "path": "C:\\Users\\haya0\\AppData\\Local\\Temp\\ludion-bench-WKDlpG\\work\\node_modules\\agents\\dist",
      "output_mode": "content",
      "head_limit": 15
    }
  2. Tool output

    node_modules\agents\dist\agent-routing-Bhdbvf7s.d.ts:6274:   *   (`idFromString`/`get(id)`) rather than by name will not receive
    node_modules\agents\dist\lifecycle-CFu6OV03.js:1097:		throw new Error(`${_classPrivateFieldGet2(_parentClassName, this)} could not determine its Durable Object name. Address it with idFromName() or getByName(). In local development, update Wrangler/workerd and use a current compatibility_date. newUniqueId(), idFromString(), and names over 1,024 bytes do not expose ctx.id.name. Alarms created before 2026-03-15 must be rescheduled from a named fetch or RPC handler.`);
    node_modules\agents\dist\lifecycle-CFu6OV03.js.map:1:[Omitted long matching line]
    node_modules\agents\dist\mcp\client\do-oauth-client-provider.js:52:		if (!this._clientId_) throw new Error("Trying to access clientId before it was set");
    node_modules\agents\dist\mcp\client\do-oauth-client-provider.js:59:		if (!this._serverId_) throw new Error("Trying to access serverId before it was set");
    node_modules\agents\dist\mcp\client\do-oauth-client-provider.js.map:1:[Omitted long matching line]
    node_modules\agents\dist\src-DgCbZtIR.js.map:1:[Omitted long matching line]
    node_modules\agents\dist\src-DgCbZtIR.js:5879:	*   (`idFromString`/`get(id)`) rather than by name will not receive
  3. Agent

    An Agent works out its own name from the Durable Object ID (`ctx.id.name`), and only IDs made with `idFromName()` or `getByName()` carry a name. If you address it with `idFromString()`, `newUniqueId()`, or a name longer than 1,024 bytes, the ID has no name. So when your RPC method touches anything that needs `this.name`, the Agent throws: "could not determine its Durable Object name. Address it with idFromName() or getByName()…" (`node_modules/agents/dist/lifecycle-CFu6OV03.js:1097`). To fix it, get the stub by name with `env.MyAgent.getByName(name)`, `getAgentByName(env.MyAgent, name)`, or `idFromName(name)`. If this happens under `wrangler dev`, also update Wrangler/workerd and use a current `compatibility_date`, since older runtimes don't expose `ctx.id.name` at all.