Skip to content

Conversation

@ianjkaplan
Copy link
Collaborator

@ianjkaplan ianjkaplan commented Sep 2, 2025

TL;DR

Updated the tools plugin to align with the latest OpenAI Agents API, adding support for mutation approval and improving the generated code structure.

What changed?

  • Renamed exec property to execute in tool definitions to match the OpenAI Agents API
  • Added needsApproval: true flag for mutation operations (POST, PUT, PATCH, DELETE)
  • Split tool generation into separate options and tool instances:
    • Each operation now generates both [name]ToolOptions and [name]Tool
    • Tools are now created using the tool() function from @openai/agents
  • Updated the README example to reflect the new API usage
  • Added comprehensive integration tests to verify tool structure and execution

How to test?

  1. Run the test suite to verify the tool generation and execution:
    npm test
    
  2. Check that mutation operations (like createUser) have the needsApproval flag
  3. Verify that all tools are properly wrapped with the tool() function
  4. Confirm that the generated code follows the updated pattern with separate options and tool instances

Why make this change?

This change aligns our tools plugin with the latest OpenAI Agents API requirements, particularly adding support for the approval flow for mutation operations. By separating tool options from the tool instances, we provide more flexibility for consumers while ensuring that operations that modify data require explicit approval before execution, improving security and user control.

Copy link
Collaborator Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@ianjkaplan ianjkaplan marked this pull request as ready for review September 2, 2025 15:01
@ianjkaplan ianjkaplan merged commit 339375e into main Sep 2, 2025
1 check failed
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