Skip to content

Conversation

@ryoppippi
Copy link
Contributor

@ryoppippi ryoppippi commented Aug 14, 2025

Summary

  • Add pydantic-ai dependency to enable integration with Pydantic AI framework
  • Implement to_pydantic_ai() method for StackOneTool and Tools classes
  • Add comprehensive example demonstrating Pydantic AI agent usage with StackOne tools
  • Include tests for tool conversion and integration functionality
  • Update README with Pydantic AI integration examples and documentation

Changes

Core Implementation

  • Added pydantic-ai>=0.1.0 dependency to pyproject.toml
  • Implemented async tool wrapper for Pydantic AI compatibility
  • Added batch conversion support for multiple tools

Examples & Tests

  • Created examples/pydantic_ai_integration.py showing real-world usage
  • Added comprehensive test suite in tests/test_pydantic_ai.py
  • Tests cover tool conversion, schema generation, and execution

Documentation

  • Updated README to include Pydantic AI in supported frameworks
  • Added inline code examples for all major AI framework integrations
  • Streamlined documentation structure

Test Plan

  • All existing tests pass
  • New Pydantic AI integration tests pass
  • Linting and type checking pass
  • Example runs successfully with proper async handling
  • Tool conversion preserves functionality and metadata

Summary by cubic

Added Pydantic AI integration, allowing StackOne tools to be used with Pydantic AI agents and workflows.

  • New Features
  • Added pydantic-ai to dependencies and support for converting StackOne tools to Pydantic AI format.
  • Included example usage, tests for tool conversion, and updated documentation with integration instructions.

Add pydantic-ai>=0.1.0 to project dependencies to enable integration with Pydantic AI framework
Add to_pydantic_ai() method to StackOneTool class for converting tools to Pydantic AI format

Add to_pydantic_ai() method to Tools class for batch conversion

Implements async wrapper for tool execution compatible with Pydantic AI framework
Add comprehensive example showing how to use StackOne tools with Pydantic AI agents

Include tests for tool conversion and integration functionality

Demonstrate async agent usage with HRIS tools
Add Pydantic AI to supported frameworks list

Include inline examples for Pydantic AI, LangChain, and OpenAI integrations

Remove outdated documentation links and streamline AI framework integration section
Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cubic analysis

1 issue found across 3 files • Review in cubic

React with 👍 or 👎 to teach cubic. You can also tag @cubic-dev-ai to give feedback, ask questions, or re-run the review.


return StackOneLangChainTool()

def to_pydantic_ai(self) -> PydanticAITool:
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The pattern of adding a specific to_framework() method for each new AI framework integration directly to the core StackOneTool class violates the Open/Closed Principle (OCP). This design choice tightly couples the core tool definition to external, third-party frameworks. As the number of supported integrations grows, this approach will require continuous modification of the core StackOneTool class, increasing maintenance burden and the risk of regressions. A more scalable and architecturally sound approach would involve an Adapter or Plugin pattern, where new framework converters can be added without modifying the core tool's source code, adhering to OCP and reducing coupling.

Prompt for AI agents
Address the following comment on stackone_ai/models.py at line 401:

<comment>The pattern of adding a specific `to_framework()` method for each new AI framework integration directly to the core `StackOneTool` class violates the Open/Closed Principle (OCP). This design choice tightly couples the core tool definition to external, third-party frameworks. As the number of supported integrations grows, this approach will require continuous modification of the core `StackOneTool` class, increasing maintenance burden and the risk of regressions. A more scalable and architecturally sound approach would involve an Adapter or Plugin pattern, where new framework converters can be added without modifying the core tool&#39;s source code, adhering to OCP and reducing coupling.</comment>

<file context>
@@ -397,6 +398,24 @@ async def _arun(self, **kwargs: Any) -&gt; Any:
 
         return StackOneLangChainTool()
 
+    def to_pydantic_ai(self) -&gt; PydanticAITool:
+        &quot;&quot;&quot;Convert this tool to Pydantic AI format
+
</file context>

@ryoppippi
Copy link
Contributor Author

readme should be midified based on #20

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