Skip to content

Replace undefined variable name in documentation code snippet #84

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 12, 2025

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```

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
@rm-openai rm-openai merged commit 3a95993 into openai:main Mar 12, 2025
5 checks passed
nakasy000 pushed a commit to nakasy000/openai-agents-python that referenced this pull request Mar 27, 2025
Replace undefined variable name in documentation code snippet
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.

None yet

2 participants