anthropics / anthropics/claude-agent-sdk-python
Bug: Long-running subagent returns agentId with SendMessage hint, but SendMessage tool does not exist
- 主要語言
- Python
- 星號
- 8.1k
- 分支
- 1.3k
- 平均合併
- 2 天 31 分鐘
- 30 天內合併 PR
- 1
描述
**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.
貢獻指南
這個儲存庫沒有索引到貢獻指南
評估
這個 Issue 還沒有評估資料。