Skip to content

How to specify the next agent? #187

Closed
@huangbhan

Description

@huangbhan
generate_sql_agent = Agent(
        name="generate sql Agent",
        instructions='''
            1. You are responsible for generating SQL statements based on user requests..
           '''
        handoffs=[sql_checker_agent],
    )

 sql_checker_agent = Agent(
        name="SQL Checker Agent",
        handoff_description="Check the SQL statement generated based on the user's request.",
        instructions='''You are responsible for checking the SQL statement generated based on the user's request.
        ''',
        tools=[task_query],
    )

I am worried that handoffs may not be triggered. I need to ensure that sql_checker_agent is called after generate_sql_agent.
In the documentation(https://openai.github.io/openai-agents-python/multi_agent/) I found this: "Chaining multiple agents by transforming the output of one into the input of the next. You can decompose a task like writing a blog post into a series of steps - do research, write an outline, write the blog post, critique it, and then improve it."
But how to implement it with code?

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionQuestion about using the SDK

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions