anthropics / anthropics/claude-agent-sdk-python
Bug: Long-running subagent returns agentId with SendMessage hint, but SendMessage tool does not exist
- Ngôn ngữ chính
- Python
- Star
- 8.1k
- Fork
- 1.3k
- Merge trung bình
- 2 ngày 31 phút
- Pull request đã merge (30 ngày)
- 1
Mô tả
**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.
Hướng dẫn đóng góp
Chưa lập chỉ mục được hướng dẫn đóng góp cho kho mã nguồn này
Đánh giá
Issue này chưa được đánh giá.