-
Notifications
You must be signed in to change notification settings - Fork 0
feat: Add Agno framework integration #25
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
Closed
Closed
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
a46bf39
chore: release 0.3.0
ryoppippi 5eff322
feat: add Agno framework integration
ryoppippi 8544d2e
fix: correct Agno Agent import path for v1.7.11
ryoppippi 4581393
fix: update Agno integration for v1.7.11 architecture
ryoppippi 24b2a3c
ENG-10863
ryoppippi d22aa27
Merge branch 'main' into feat/agno-integration
ryoppippi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,119 @@ | ||
| """ | ||
| This example demonstrates how to use StackOne tools with Agno agents. | ||
|
|
||
| This example is runnable with the following command: | ||
| ```bash | ||
| uv run examples/agno_integration.py | ||
| ``` | ||
|
|
||
| You can find out more about Agno framework at https://docs.agno.com | ||
| """ | ||
|
|
||
| from agno.agent import Agent | ||
| from agno.models.openai import OpenAIChat | ||
| from dotenv import load_dotenv | ||
|
|
||
| from stackone_ai import StackOneToolSet | ||
|
|
||
| load_dotenv() | ||
|
|
||
| account_id = "45072196112816593343" | ||
| employee_id = "c28xIQaWQ6MzM5MzczMDA2NzMzMzkwNzIwNA" | ||
|
|
||
|
|
||
| def agno_integration() -> None: | ||
| """Demonstrate StackOne tools with Agno agents""" | ||
| toolset = StackOneToolSet() | ||
|
|
||
| # Filter tools to only the ones we need to avoid context window limits | ||
| tools = toolset.get_tools( | ||
| [ | ||
| "hris_get_employee", | ||
| "hris_list_employee_employments", | ||
| "hris_get_employee_employment", | ||
| ], | ||
| account_id=account_id, | ||
| ) | ||
|
|
||
| # Convert to Agno format | ||
| agno_tools = tools.to_agno() | ||
|
|
||
| # Create an Agno agent with the tools | ||
| agent = Agent( | ||
| name="HR Assistant Agent", | ||
| role="Helpful HR assistant that can access employee data", | ||
| model=OpenAIChat(id="gpt-4o-mini"), | ||
| tools=agno_tools, | ||
| instructions=[ | ||
| "You are a helpful HR assistant.", | ||
| "Use the provided tools to access employee information.", | ||
| "Always be professional and respectful when handling employee data.", | ||
| ], | ||
| show_tool_calls=True, | ||
| markdown=True, | ||
| ) | ||
|
|
||
| # Test the agent with a query | ||
| query = f"Can you get me information about employee with ID: {employee_id}?" | ||
|
|
||
| print(f"Query: {query}") | ||
| print("Agent response:") | ||
|
|
||
| response = agent.run(query) | ||
| print(response.content) | ||
|
|
||
| # Verify we got a meaningful response | ||
| assert response.content is not None, "Expected response content" | ||
| assert len(response.content) > 0, "Expected non-empty response" | ||
|
|
||
|
|
||
| def agno_async_integration() -> None: | ||
| """Demonstrate async StackOne tools with Agno agents""" | ||
| import asyncio | ||
|
|
||
| async def run_async_agent() -> None: | ||
| toolset = StackOneToolSet() | ||
|
|
||
| # Filter tools to only the ones we need | ||
| tools = toolset.get_tools( | ||
| ["hris_get_employee"], | ||
| account_id=account_id, | ||
| ) | ||
|
|
||
| # Convert to Agno format | ||
| agno_tools = tools.to_agno() | ||
|
|
||
| # Create an Agno agent | ||
| agent = Agent( | ||
| name="Async HR Agent", | ||
| role="Async HR assistant", | ||
| model=OpenAIChat(id="gpt-4o-mini"), | ||
| tools=agno_tools, | ||
| instructions=["You are an async HR assistant."], | ||
| ) | ||
|
|
||
| # Run the agent asynchronously | ||
| query = f"Get employee information for ID: {employee_id}" | ||
| response = await agent.arun(query) | ||
|
|
||
| print(f"Async query: {query}") | ||
| print("Async agent response:") | ||
| print(response.content) | ||
|
|
||
| # Verify response | ||
| assert response.content is not None, "Expected async response content" | ||
|
|
||
| # Run the async example | ||
| asyncio.run(run_async_agent()) | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| print("=== StackOne + Agno Integration Demo ===\n") | ||
|
|
||
| print("1. Basic Agno Integration:") | ||
| agno_integration() | ||
|
|
||
| print("\n2. Async Agno Integration:") | ||
| agno_async_integration() | ||
|
|
||
| print("\n=== Demo completed successfully! ===") | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -24,6 +24,7 @@ def get_example_files() -> list[str]: | |
|
|
||
| # Map of example files to required optional packages | ||
| OPTIONAL_DEPENDENCIES = { | ||
| "agno_integration.py": ["agno"], | ||
| "openai_integration.py": ["openai"], | ||
| "langchain_integration.py": ["langchain_openai"], | ||
| "crewai_integration.py": ["crewai"], | ||
|
|
@@ -60,19 +61,19 @@ def test_run_example(example_file: str) -> None: | |
| "id": "test-employee-1", | ||
| "first_name": "John", | ||
| "last_name": "Doe", | ||
| "email": "[email protected]" | ||
| "email": "[email protected]", | ||
| } | ||
| ] | ||
| }, | ||
| status=200 | ||
| status=200, | ||
| ) | ||
|
|
||
| # Mock document upload endpoint | ||
| responses.add( | ||
| responses.POST, | ||
| "https://api.stackone.com/unified/hris/employees/c28xIQaWQ6MzM5MzczMDA2NzMzMzkwNzIwNA/documents/upload", | ||
| json={"success": True, "document_id": "test-doc-123"}, | ||
| status=200 | ||
| status=200, | ||
| ) | ||
|
|
||
| example_path = Path(__file__).parent / example_file | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Avoid hard-coding potentially sensitive account and employee identifiers; read them from environment variables or user input instead.
Prompt for AI agents