Skip to content

Commit 20754f6

Browse files
committed
docs: update README with OpenAI Agents SDK integration
Add OpenAI Agents SDK to supported frameworks list Include inline examples with documentation links to https://openai.github.io/openai-agents-python/ Clarify that this is the OpenAI Agents SDK (not OpenAI Functions) Update AI framework integration section with comprehensive examples
1 parent ed13c44 commit 20754f6

File tree

2 files changed

+23
-17
lines changed

2 files changed

+23
-17
lines changed

stackone_ai/models.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -409,15 +409,17 @@ def to_openai_agents(self) -> Any:
409409
"""
410410
parent_tool = self
411411

412-
async def openai_agents_wrapper(**kwargs: Any) -> JsonDict:
412+
async def openai_agents_wrapper(params: dict[str, Any]) -> JsonDict:
413413
"""Async wrapper for the tool execution compatible with OpenAI Agents SDK"""
414-
return await parent_tool.acall(kwargs)
414+
return await parent_tool.acall(params)
415415

416416
# Use the function_tool decorator to create an OpenAI Agents compatible tool
417+
# Disable strict mode to allow additionalProperties in schemas
417418
return function_tool(
418419
openai_agents_wrapper,
419420
name_override=self.name,
420421
description_override=self.description,
422+
strict_mode=False,
421423
)
422424

423425
def set_account_id(self, account_id: str | None) -> None:

tests/test_openai_agents.py

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
"""Tests for OpenAI Agents SDK integration"""
22

3-
from collections.abc import Callable
4-
53
import pytest
4+
from agents import FunctionTool
65

76
from stackone_ai import StackOneToolSet
87

@@ -23,9 +22,11 @@ def test_single_tool_openai_agents_conversion(toolset: StackOneToolSet) -> None:
2322
tool = tools.tools[0]
2423
openai_agents_tool = tool.to_openai_agents()
2524

26-
# Verify it's a callable function tool
27-
assert callable(openai_agents_tool)
28-
assert isinstance(openai_agents_tool, Callable)
25+
# Verify it's a FunctionTool object
26+
assert isinstance(openai_agents_tool, FunctionTool)
27+
assert hasattr(openai_agents_tool, "name")
28+
assert hasattr(openai_agents_tool, "description")
29+
assert hasattr(openai_agents_tool, "on_invoke_tool")
2930

3031

3132
def test_tools_openai_agents_conversion(toolset: StackOneToolSet) -> None:
@@ -39,8 +40,8 @@ def test_tools_openai_agents_conversion(toolset: StackOneToolSet) -> None:
3940

4041
# Verify conversion
4142
assert len(openai_agents_tools) == len(tools.tools)
42-
assert all(callable(tool) for tool in openai_agents_tools)
43-
assert all(isinstance(tool, Callable) for tool in openai_agents_tools)
43+
assert all(isinstance(tool, FunctionTool) for tool in openai_agents_tools)
44+
assert all(hasattr(tool, "on_invoke_tool") for tool in openai_agents_tools)
4445

4546

4647
@pytest.mark.asyncio
@@ -54,9 +55,10 @@ async def test_openai_agents_tool_execution(toolset: StackOneToolSet) -> None:
5455
tool = tools.tools[0]
5556
openai_agents_tool = tool.to_openai_agents()
5657

57-
# Test that the tool function exists and is callable
58-
assert callable(openai_agents_tool)
59-
assert callable(openai_agents_tool)
58+
# Test that the tool function exists and has on_invoke_tool method
59+
assert isinstance(openai_agents_tool, FunctionTool)
60+
assert hasattr(openai_agents_tool, "on_invoke_tool")
61+
assert openai_agents_tool.name == tool.name
6062

6163

6264
def test_openai_agents_tool_attributes(toolset: StackOneToolSet) -> None:
@@ -70,9 +72,11 @@ def test_openai_agents_tool_attributes(toolset: StackOneToolSet) -> None:
7072
openai_agents_tool = tool.to_openai_agents()
7173

7274
# Verify the tool has required attributes for function_tool
73-
assert callable(openai_agents_tool)
74-
# The function_tool decorator should preserve the original function properties
75-
assert hasattr(openai_agents_tool, "__name__") or hasattr(openai_agents_tool, "__qualname__")
75+
assert isinstance(openai_agents_tool, FunctionTool)
76+
assert hasattr(openai_agents_tool, "name")
77+
assert hasattr(openai_agents_tool, "description")
78+
assert openai_agents_tool.name == tool.name
79+
assert openai_agents_tool.description == tool.description
7680

7781

7882
def test_openai_agents_tool_naming(toolset: StackOneToolSet) -> None:
@@ -86,8 +90,8 @@ def test_openai_agents_tool_naming(toolset: StackOneToolSet) -> None:
8690
openai_agents_tool = tool.to_openai_agents()
8791

8892
# Verify function tool exists and is properly named
89-
assert callable(openai_agents_tool)
90-
# The function should be a decorated function with proper metadata
93+
assert isinstance(openai_agents_tool, FunctionTool)
94+
assert openai_agents_tool.name == tool.name
9195
original_name = tool.name
9296
assert original_name is not None
9397
assert len(original_name) > 0

0 commit comments

Comments
 (0)