Feature: Multi-LLM Support Implementation #9
+346
−78
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!