Skip to content

Conversation

leykun10
Copy link
Contributor

Corrected the variable name from 'output' to 'result' in the code snippet in running_agents.md to match the actual code usage.
the variable output was not defined and it is implying the variable result from the first run.

Previous:

async def main():
    agent = Agent(name="Assistant", instructions="Reply very concisely.")
    with trace(workflow_name="Conversation", group_id=thread_id):
        # First turn
        result = await Runner.run(agent, "What city is the Golden Gate Bridge in?")
        print(result.final_output)
        # San Francisco

        # Second turn
        new_input = output.to_input_list() + [{"role": "user", "content": "What state is it in?"}]
        result = await Runner.run(agent, new_input)
        print(result.final_output)
        # California

Updated:

async def main():
  agent = Agent(name="Assistant", instructions="Reply very concisely.")

  with trace(workflow_name="Conversation", group_id=thread_id):
      # First turn
      result = await Runner.run(agent, "What city is the Golden Gate Bridge in?")
      print(result.final_output)
      # San Francisco

      # Second turn
      new_input = result.to_input_list() + [{"role": "user", "content": "What state is it in?"}]
      result = await Runner.run(agent, new_input)
      print(result.final_output)
      # California```

@rm-openai rm-openai merged commit 3a95993 into openai:main Mar 12, 2025
5 checks passed
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.

2 participants