Background
The Python SDK added agent_id and agent_type fields to hook input types in PR #628. These fields are critical for correlating tool calls to specific sub-agents when multiple agents run in parallel.
The affected hook input types in Python are:
PreToolUseHookInput
PostToolUseHookInput
PostToolUseFailureHookInput
PermissionRequestHookInput
Current State in Go SDK
The Go SDK uses a generic map[string]any for HookInput (hooks.go:24):
type HookInput map[string]any
While the map approach is flexible (the fields would be present in the map if the CLI sends them), it provides no type safety or discoverability for consumers.
Proposal
Introduce typed structs for hook inputs, with optional AgentID and AgentType fields:
type BaseHookInput struct {
SessionID string `json:"session_id"`
TranscriptPath string `json:"transcript_path"`
Cwd string `json:"cwd"`
PermissionMode string `json:"permission_mode"`
HookEventName string `json:"hook_event_name"`
AgentID string `json:"agent_id,omitempty"`
AgentType string `json:"agent_type,omitempty"`
}
type PreToolUseHookInput struct {
BaseHookInput
ToolName string `json:"tool_name"`
ToolInput map[string]any `json:"tool_input"`
}
// ... similar for PostToolUse, PostToolUseFailure, PermissionRequest
Alternatively, keep HookInput as map[string]any for forward-compatibility but add typed accessor methods or a helper to extract these fields safely.
References
Background
The Python SDK added
agent_idandagent_typefields to hook input types in PR #628. These fields are critical for correlating tool calls to specific sub-agents when multiple agents run in parallel.The affected hook input types in Python are:
PreToolUseHookInputPostToolUseHookInputPostToolUseFailureHookInputPermissionRequestHookInputCurrent State in Go SDK
The Go SDK uses a generic
map[string]anyforHookInput(hooks.go:24):While the map approach is flexible (the fields would be present in the map if the CLI sends them), it provides no type safety or discoverability for consumers.
Proposal
Introduce typed structs for hook inputs, with optional
AgentIDandAgentTypefields:Alternatively, keep
HookInputasmap[string]anyfor forward-compatibility but add typed accessor methods or a helper to extract these fields safely.References