[DOCS] Python type definitions missing `parent_tool_use_id` for subagent tracking

Resolved 💬 2 comments Opened Jan 12, 2026 by coygeek Closed Jan 21, 2026

Documentation Type

Unclear/confusing documentation

Documentation Location

Section/Topic

  • Python SDK Reference: AssistantMessage and UserMessage dataclass definitions. - Subagents Tracking: Consistency between the "Overview" and the "Python Reference."

Current Documentation

The Agent SDK Overview states:

"Messages from within a subagent's context include a parent_tool_use_id field, letting you track which messages belong to which subagent execution."

However, the Python SDK Reference defines the classes as follows:

@dataclass
class UserMessage:
    content: str | list[ContentBlock]

@dataclass
class AssistantMessage:
    content: list[ContentBlock]
    model: str

What's Wrong or Missing?

The parent_tool_use_id field is missing from the Python type definitions for both UserMessage and AssistantMessage in the documentation.

This causes two problems:

  1. Inconsistency: The "Overview" page explicitly highlights this field as the way to track subagent executions, but the primary Python reference does not document it as an available attribute.
  2. Parity Gap: The TypeScript SDK reference correctly includes parent_tool_use_id: string | null; in its definitions. Python developers relying on the reference for type-hinting or attribute discovery will believe the field is unavailable.

Suggested Improvement

Update the dataclass definitions in docs/en/agent-sdk/python.md to include the missing field.

Suggested Text:

@dataclass
class UserMessage:
    content: str | list[ContentBlock]
    parent_tool_use_id: str | None = None  # Added for subagent tracking

@dataclass
class AssistantMessage:
    content: list[ContentBlock]
    model: str
    parent_tool_use_id: str | None = None  # Added for subagent tracking

Impact

High - Prevents users from using a feature

Additional Context

  • In the TypeScript Reference (docs/en/agent-sdk/typescript.md), the field is correctly documented for SDKAssistantMessage and SDKUserMessage.
  • This is a critical field for any developer building complex agents that utilize the Task tool (subagents), as it is the only way to programmatically associate a stream of messages with their parent subagent call.

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗