forAgent

Creates a new InvocationContext for running childAgent, derived from this context, keeping the current branch unchanged.

This is the default way an agent is entered (including via a transfer_to_agent): the branch is only deepened explicitly where conversation history must be segregated (see branch, used by ParallelAgent). Mirrors Python ADK 1.x BaseAgent._create_invocation_context, which swaps only the agent.

Return

The new InvocationContext.

Parameters

childAgent

The agent that will run under the returned context.