Skip to content

Conversation

strawgate
Copy link
Contributor

Relating to #2329

Some stuff to look at re: Agent Handoff or AgentToolset

  1. Add Handoff method to Agent (can take an Agent with the same deps, deps + input model, or different deps)
  2. Add an AgentToolset that allows more customization for Agent handoffs

It's not fully wired up but ex:


inner_agent: Agent[InnerAgentDeps, str] = Agent[InnerAgentDeps, str]('inner', deps_type=InnerAgentDeps)

other_outer_agent: Agent[OuterAgentDeps, str] = Agent[OuterAgentDeps, str]('other_outer', deps_type=OuterAgentDeps)

outer_agent: Agent[OuterAgentDeps, str] = Agent[OuterAgentDeps, str]('outer', deps_type=OuterAgentDeps)


async def outer_to_inner_deps_func(deps: OuterAgentDeps, input: str) -> InnerAgentDeps:
    """Transform outer deps to inner deps."""
    return InnerAgentDeps(client=deps.client, extra=input)


outer_agent.handoff(agent=inner_agent, deps_func=outer_to_inner_deps_func)
outer_agent.handoff(agent=other_outer_agent)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant