Skip to content

Commit 8544d2e

Browse files
committed
fix: correct Agno Agent import path for v1.7.11
- Update import from agno.agent import Agent - Fix compatibility with Agno version 1.7.11 - Resolve GitHub Actions test failures
1 parent 5eff322 commit 8544d2e

File tree

7 files changed

+39
-35
lines changed

7 files changed

+39
-35
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,11 @@ For more examples and documentation, visit:
7373

7474
## AI Framework Integration
7575

76-
- [Agno Integration](docs/agno-integration.md)
77-
- [OpenAI Integration](docs/openai-integration.md)
78-
- [LangChain Integration](docs/langchain-integration.md)
79-
- [CrewAI Integration](docs/crewai-integration.md)
80-
- [LangGraph Tool Node](docs/langgraph-tool-node.md)
76+
- [Agno Integration](docs/agno_integration.md)
77+
- [OpenAI Integration](docs/openai_integration.md)
78+
- [LangChain Integration](docs/langchain_integration.md)
79+
- [CrewAI Integration](docs/crewai_integration.md)
80+
- [LangGraph Tool Node](docs/langgraph_tool_node.md)
8181

8282
## License
8383

examples/agno_integration.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
You can find out more about Agno framework at https://docs.agno.com
1010
"""
1111

12-
from agno import Agent
12+
from agno.agent import Agent
1313
from agno.models.openai import OpenAIChat
1414
from dotenv import load_dotenv
1515

examples/test_examples.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -61,19 +61,19 @@ def test_run_example(example_file: str) -> None:
6161
"id": "test-employee-1",
6262
"first_name": "John",
6363
"last_name": "Doe",
64-
"email": "[email protected]"
64+
"email": "[email protected]",
6565
}
6666
]
6767
},
68-
status=200
68+
status=200,
6969
)
7070

7171
# Mock document upload endpoint
7272
responses.add(
7373
responses.POST,
7474
"https://api.stackone.com/unified/hris/employees/c28xIQaWQ6MzM5MzczMDA2NzMzMzkwNzIwNA/documents/upload",
7575
json={"success": True, "document_id": "test-doc-123"},
76-
status=200
76+
status=200,
7777
)
7878

7979
example_path = Path(__file__).parent / example_file

mkdocs.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ nav:
4646
- Available Tools: available-tools.md
4747
- File Uploads: file-uploads.md
4848
- Integrations:
49-
- Agno: agno-integration.md
50-
- OpenAI: openai-integration.md
51-
- CrewAI: crewai-integration.md
52-
- LangChain: langchain-integration.md
49+
- Agno: agno_integration.md
50+
- OpenAI: openai_integration.md
51+
- CrewAI: crewai_integration.md
52+
- LangChain: langchain_integration.md

pyproject.toml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,3 +111,7 @@ warn_unreachable = true
111111
[[tool.mypy.overrides]]
112112
module = "bm25s"
113113
ignore_missing_imports = true
114+
115+
[[tool.mypy.overrides]]
116+
module = "agno.tools"
117+
ignore_missing_imports = true

stackone_ai/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ def to_agno(self) -> Any:
404404
Tool in Agno format
405405
"""
406406
try:
407-
from agno.tools import Tool as AgnoBaseTool # type: ignore[import-not-found]
407+
from agno.tools import Tool as AgnoBaseTool
408408
except ImportError as e:
409409
raise ImportError(
410410
"Agno is not installed. Please install it with 'pip install agno>=1.7.0' "

tests/test_agno_integration.py

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ class TestAgnoIntegration:
4545

4646
def test_to_agno_without_agno_installed(self, mock_tool: StackOneTool) -> None:
4747
"""Test that proper error is raised when Agno is not installed"""
48-
with patch.dict('sys.modules', {'agno': None, 'agno.tools': None}):
48+
with patch.dict("sys.modules", {"agno": None, "agno.tools": None}):
4949
with pytest.raises(ImportError) as exc_info:
5050
mock_tool.to_agno()
5151

@@ -58,10 +58,10 @@ def test_to_agno_with_mocked_agno(self, mock_tool: StackOneTool) -> None:
5858
mock_agno_base_tool = MagicMock()
5959
mock_agno_module = MagicMock()
6060
mock_agno_module.Tool = mock_agno_base_tool
61-
62-
with patch.dict('sys.modules', {'agno.tools': mock_agno_module}):
61+
62+
with patch.dict("sys.modules", {"agno.tools": mock_agno_module}):
6363
agno_tool = mock_tool.to_agno()
64-
64+
6565
# Verify an Agno tool instance was created
6666
assert agno_tool is not None
6767

@@ -70,23 +70,23 @@ def test_to_agno_tool_execution(self, mock_tool: StackOneTool) -> None:
7070
mock_agno_base_tool = MagicMock()
7171
mock_agno_module = MagicMock()
7272
mock_agno_module.Tool = mock_agno_base_tool
73-
74-
with patch.dict('sys.modules', {'agno.tools': mock_agno_module}):
73+
74+
with patch.dict("sys.modules", {"agno.tools": mock_agno_module}):
7575
agno_tool = mock_tool.to_agno()
76-
76+
7777
# Verify the tool was created (basic functionality test)
7878
assert agno_tool is not None
79-
assert hasattr(agno_tool, 'run')
79+
assert hasattr(agno_tool, "run")
8080

8181
def test_tools_to_agno(self, tools_collection: Tools) -> None:
8282
"""Test converting Tools collection to Agno format"""
8383
mock_agno_base_tool = MagicMock()
8484
mock_agno_module = MagicMock()
8585
mock_agno_module.Tool = mock_agno_base_tool
86-
87-
with patch.dict('sys.modules', {'agno.tools': mock_agno_module}):
86+
87+
with patch.dict("sys.modules", {"agno.tools": mock_agno_module}):
8888
agno_tools = tools_collection.to_agno()
89-
89+
9090
# Verify we got the expected number of tools
9191
assert len(agno_tools) == 1
9292
assert agno_tools[0] is not None
@@ -112,14 +112,14 @@ def test_tools_to_agno_multiple_tools(self) -> None:
112112
)
113113

114114
tools = Tools([tool1, tool2])
115-
115+
116116
mock_agno_base_tool = MagicMock()
117117
mock_agno_module = MagicMock()
118118
mock_agno_module.Tool = mock_agno_base_tool
119-
120-
with patch.dict('sys.modules', {'agno.tools': mock_agno_module}):
119+
120+
with patch.dict("sys.modules", {"agno.tools": mock_agno_module}):
121121
agno_tools = tools.to_agno()
122-
122+
123123
assert len(agno_tools) == 2
124124
assert all(tool is not None for tool in agno_tools)
125125

@@ -128,23 +128,23 @@ def test_agno_tool_preserves_metadata(self, mock_tool: StackOneTool) -> None:
128128
mock_agno_base_tool = MagicMock()
129129
mock_agno_module = MagicMock()
130130
mock_agno_module.Tool = mock_agno_base_tool
131-
132-
with patch.dict('sys.modules', {'agno.tools': mock_agno_module}):
131+
132+
with patch.dict("sys.modules", {"agno.tools": mock_agno_module}):
133133
agno_tool = mock_tool.to_agno()
134-
134+
135135
# Verify the tool was created with expected attributes
136136
assert agno_tool is not None
137137
# For real integration, name and description would be set by the Agno base class
138-
assert hasattr(agno_tool, 'name')
139-
assert hasattr(agno_tool, 'description')
138+
assert hasattr(agno_tool, "name")
139+
assert hasattr(agno_tool, "description")
140140

141141

142142
class TestAgnoIntegrationErrors:
143143
"""Test error handling in Agno integration"""
144144

145145
def test_agno_import_error_message(self, mock_tool: StackOneTool) -> None:
146146
"""Test that ImportError contains helpful installation instructions"""
147-
with patch.dict('sys.modules', {'agno': None, 'agno.tools': None}):
147+
with patch.dict("sys.modules", {"agno": None, "agno.tools": None}):
148148
with pytest.raises(ImportError) as exc_info:
149149
mock_tool.to_agno()
150150

0 commit comments

Comments
 (0)