anthropics / anthropics/claude-agent-sdk-python

Bug: Long-running subagent returns agentId with SendMessage hint, but SendMessage tool does not exist

Ouverte
#716 4 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
Python
Étoiles
8.1k
Forks
1.3k
Merge moyen
2 j 31 min
PR mergées (30 j)
1

Description

**SDK version:** claude-agent-sdk 0.1.50 (Python)

**Description**

When a long-running subagent completes (or is cut off by token/turn limits), its final output includes a hint:

```json
[
{
"type": "text",
"text": "The uploaded file \"chat-test-upload.txt\" (25 B) is visible in the Chat Uploads scope under `.upload/` folder. Let me take screenshot 7."
},
{
"type": "text",
"text": "agentId: a56c67d5f6d516271 (use SendMessage with to: 'a56c67d5f6d516271' to continue this agent)\ntotal_tokens: 55449\ntool_uses: 44\nduration_ms: 315536"
}
]
```

The parent agent then attempts to call `SendMessage`:

```json
{
"to": "a56c67d5f6d516271",
"message": "..."
}
```

Which fails:

```
Error: No such tool available: SendMessage
```

`SendMessage` does not exist in the SDK toolset, is not documented, and has zero references in the repo source code. The hint text is generated by Claude Code CLI internally, and the parent agent treats it as a real tool instruction.

**Steps to reproduce**

1. Spawn a subagent via the `Agent` tool with a task that takes many turns (40+ tool uses)
2. Subagent returns with the `agentId: ... (use SendMessage ...)` footer
3. Parent agent's next turn calls `SendMessage` -> `tool_use_error`

**Expected behavior**

One of:
- (a) `SendMessage` actually exists and works — subagent sessions can be resumed
- (b) The `agentId` hint is not emitted if the tool doesn't exist, preventing hallucinated tool calls
- (c) SDK provides a documented mechanism to resume/continue a subagent session (e.g. `query(resume=session_id)`)

**Actual behavior**

Parent agent enters a failure loop trying to call a non-existent tool, losing the subagent's work.

**Workaround**

None clean. The subagent must complete all work (including writing output files) before its session ends. If it gets cut off, results are lost.

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.