Skip to content

Request for Agent Handoff Example in openai-java #599

@435732793

Description

@435732793

I previously asked about this feature and was told it could be implemented using the base SDK. However, there is no complete reference, and I’m struggling to build it. The Python SDK already supports Agents, Runner, and handoffs like this:

from agents import Agent, Runner
import asyncio

spanish_agent = Agent(
    name="Spanish agent",
    instructions="You only speak Spanish.",
)

english_agent = Agent(
    name="English agent",
    instructions="You only speak English",
)

triage_agent = Agent(
    name="Triage agent",
    instructions="Handoff to the appropriate agent based on the language of the request.",
    handoffs=[spanish_agent, english_agent],
)

async def main():
    result = await Runner.run(triage_agent, input="Hola, ¿cómo estás?")
    print(result.final_output)
It would be very helpful if openai-java could provide:
1.	A full example showing how to implement handoffs in Java.
2.	A sample design pattern for Agent and Runner equivalents (even if just wrappers on top of the SDK).
3.	Support for both async and sync usage examples.

Reason: We are building in the Spring Boot + Java ecosystem, need multi-agent orchestration and routing, but lack guidance to implement this effectively. Could the team add an example to the docs or example repository?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions