Feature: Multi-LLM Support Implementation#9
Open
misran3 wants to merge 8 commits intoAction-State-Labs:mainfrom
Open
Feature: Multi-LLM Support Implementation#9misran3 wants to merge 8 commits intoAction-State-Labs:mainfrom
misran3 wants to merge 8 commits intoAction-State-Labs:mainfrom
Conversation
- Added Pydantic AI for unified LLM interface - Support for OpenAI, Anthropic, Gemini, AWS Bedrock - Provider selection via LLM_PROVIDER env var - Model overrides via provider-specific env vars - Structured outputs using Pydantic models - Fail-fast error handling - Updated documentation and examples
Author
|
Hey @ethanjlimgit, I've raised this as a draft PR to be transparent about the work in progress and get early feedback. Current Status:
Feel free to review the code, ask questions, or share thoughts! I'm happy to discuss any aspect of the implementation or make adjustments based on your feedback. Thanks! |
Author
Hey @ethanjlimgit, wondering if you got a chance to review this PR? |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Multi-LLM Support Implementation
Summary
This PR adds comprehensive multi-LLM provider support to the Android Use agent, enabling users to choose between OpenAI, Anthropic (Claude), Google Gemini, and AWS Bedrock. The implementation uses Pydantic AI for a unified interface and structured outputs, making the codebase provider-agnostic while improving type safety and reliability.
Key Features
✅ Multi-Provider Support
✅ Structured Outputs
✅ Environment-Based Configuration
LLM_PROVIDERenv var✅ Comprehensive Testing
Architecture Changes
Before
After
New Files
action_models.py- Pydantic models for structured action outputsllm_manager.py- Multi-provider LLM managertests/test_action_models.py- Action model validation teststests/test_llm_manager.py- LLM manager initialization teststests/test_kernel_integration.py- Integration teststests/MANUAL_TEST_RESULTS.md- Manual testing templateexamples/openai_example.sh- OpenAI usage exampleexamples/anthropic_example.sh- Anthropic usage exampleexamples/gemini_example.sh- Gemini usage exampleexamples/bedrock_example.sh- Bedrock usage exampleModified Files
kernel.py- Refactored to use LLM manager, async/await patternrequirements.txt- Updated topydantic-ai-slim[openai,anthropic,google,bedrock]README.md- Added multi-LLM configuration instructionsUsage
Quick Start
Provider-Specific Examples
Available Models
gpt-4oOPENAI_MODELclaude-sonnet-4ANTHROPIC_MODELgemini-2.0-flash-expGEMINI_MODELanthropic.claude-sonnet-4-20250514-v1:0BEDROCK_MODELTesting
Automated Tests
pytest tests/ -v # 11/11 tests passingManual Testing
tests/MANUAL_TEST_RESULTS.mdfor testing checklistBreaking Changes
Environment Variables: Must set
LLM_PROVIDERenv varAsync Pattern:
run_agent()is now asyncDependencies: New requirement format
Benefits
Next Steps
Questions & Contact
Have questions about this PR or want to discuss implementation details?
📧 Email: mohammed.misran@pitt.edu
📅 Schedule a call: Calendly
Feel free to reach out for clarifications, feedback, or collaboration opportunities!