Handoff with typed input
Skill kjuhwa/skills-hub/skills/llm-agents/handoff-with-typed-input
Self-correcting knowledge corpus for Claude Code — 9 stable shape clusters, bias-correction pipeline baked into contribution flow. 47 papers, 45 techniques, 1.1k skills.
npx -y skills add kjuhwa/skills-hub --skill handoff-with-typed-inputAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
One thing to look at
- 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Provide structured data from the LLM to an on_handoff callback via input_type on handoff().
SKILL.md
2.3 KB, 441 tokens by cl100k_base, as published. Nobody here has run it
handoff-with-typed-input
Pass input_type to handoff() so the LLM provides structured data when triggering the handoff. The on_handoff callback receives a parsed Pydantic model instance.
When to apply
When you need to log a reason for escalation, capture structured context (e.g., customer ID, urgency level) as part of the handoff decision, or kick off data fetching when the handoff is invoked.
Core snippet
from pydantic import BaseModel
from agents import Agent, handoff, RunContextWrapper, Runner
class EscalationData(BaseModel):
reason: str
urgency: str # "low" | "medium" | "high"
async def on_handoff(ctx: RunContextWrapper[None], input_data: EscalationData) -> None:
print(f"Escalation reason: {input_data.reason}, urgency: {input_data.urgency}")
# Kick off async tasks, log to database, etc.
escalation_agent = Agent(
name="Escalation agent",
instructions="Handle escalated customer issues.",
)
handoff_obj = handoff(
agent=escalation_agent,
on_handoff=on_handoff,
input_type=EscalationData,
tool_description_override="Escalate the issue with a reason and urgency level.",
)
triage_agent = Agent(
name="Triage agent",
instructions="Handle customer requests. Escalate if needed.",
handoffs=[handoff_obj],
)
async def main():
result = await Runner.run(triage_agent, "I urgently need help with a billing issue!")
print(result.final_output)
Key notes
input_typemust be a PydanticBaseModel; the LLM fills it when triggering the handoffon_handoffcan be async; its return value is ignored- Without
input_type,on_handoffreceives onlyRunContextWrapper(no data) is_enabledaccepts a bool or callable for dynamic enable/disable of the handoff
What ships with it
Read from the repository
Just SKILL.md. No reference files, no scripts.