Skip to content

[AAASM-123] ✨ (openai_agents): Implement FunctionTool governance interception adapter#15

Merged
Chisanan232 merged 19 commits into
masterfrom
v0.0.0/AAASM-123/openai_agents_functiontool_adapter
Apr 30, 2026
Merged

[AAASM-123] ✨ (openai_agents): Implement FunctionTool governance interception adapter#15
Chisanan232 merged 19 commits into
masterfrom
v0.0.0/AAASM-123/openai_agents_functiontool_adapter

Conversation

@Chisanan232
Copy link
Copy Markdown
Contributor

Description

Implement OpenAI Agents SDK adapter by monkey-patching openai.agents.FunctionTool.__call__ with governance interception, pending-approval flow, ToolResult(error) deny handling, async audit recording, and clean unpatch support.

This PR adds:

  • Runtime patch/unpatch for FunctionTool.__call__
  • DENY returns ToolResult(error=...) (no exception)
  • PENDING approval wait branch with deny fallback to ToolResult(error=...)
  • ctx.agent_id extraction with process-level fallback
  • Async result recording (record_result + on_tool_end fallback)
  • Fail-open execution path for governance backend errors
  • Unit and integration coverage for OpenAI adapter and OpenAI+MCP coexistence

Type of Change

  • ✨ New feature
  • 🔧 Bug fix
  • ♻️ Refactoring
  • 🍀 Performance improvement
  • 📚 Documentation update
  • 🚀 Release

Breaking Changes

Does this PR introduce any breaking changes?

  • No
  • Yes (please describe below)

Related Issues

  • Related JIRA ticket: AAASM-123
  • Related GitHub issues: N/A

Testing

Describe the testing performed for this PR:

  • Unit tests added/updated
  • Integration tests added/updated
  • Manual testing performed
  • No tests required (explain why)

Commands run:

  • COVERAGE_FILE=/tmp/aaasm123_full.coverage uv run pytest

Result:

  • 119 passed, 7 skipped

Checklist

  • Code follows project style guidelines
  • Self-review completed
  • Comments added for complex logic
  • Documentation updated if needed
  • All tests passing

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 30, 2026

Codecov Report

❌ Patch coverage is 98.67550% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
agent_assembly/adapters/openai_agents/patch.py 98.66% 2 Missing ⚠️

📢 Thoughts on this report? Let us know!

@sonarqubecloud
Copy link
Copy Markdown

Quality Gate Passed Quality Gate passed

Issues
1 New issue
0 Accepted issues

Measures
0 Security Hotspots
98.7% Coverage on New Code
0.0% Duplication on New Code

See analysis details on SonarQube Cloud

@Chisanan232 Chisanan232 merged commit bec7a2e into master Apr 30, 2026
22 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.

1 participant