Skip to content

Handoff

AgentHandoffStepDescription runs a complete sub-chain inside the parent run. The sub-chain gets an isolated ReasoningContext derived from the parent, with inputs resolved from parent memory/history; its result is merged back via output_memory_key.

from mmar_carl import AgentHandoffStepDescription, AgentHandoffStepConfig
AgentHandoffStepDescription(
number=3,
title="Delegate to research agent",
sub_chain=research_chain,
config=AgentHandoffStepConfig(
input_mapping={"input.topic": "$memory.input.topic"},
output_memory_key="research_result",
),
)
FieldDefaultPurpose
input_mapping{}Map sub-chain memory keys ← parent references.
output_memory_key—Where the sub-chain’s final output is stored.
output_namespace—Namespace for the output.
propagate_failureTrueWhether sub-chain failure fails this step.
inherit_tools—Share the parent’s tools with the sub-chain.
timeoutNoneSub-chain timeout.

The sub-chain’s full ReasoningResult is always available at step_result.result_data["sub_result"]. sub_chain is runtime-only (not serialized).

  • Handoff — delegate to one fixed sub-chain.
  • Supervisor — let an LLM choose among several.