Integrate portkey.ai as multi-provider gateway with tool use support #2
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.
🚀 Portkey Integration for Strands SDK
Summary
This PR adds first-class support for Portkey, a gateway platform for LLM providers, into the Strands SDK. It enables a unified, configurable, and extensible way to interact with multiple AI models (OpenAI, Anthropic via Bedrock, Gemini, and more) through a single abstraction.
The integration emphasizes tool use and streaming completions, and lays foundational support for future capabilities like multi-modal interactions (images, audio — coming in a future PR).
🔍 What is Portkey?
Portkey is a powerful LLM gateway that provides:
Portkey is becoming the go-to model abstraction layer for companies scaling LLM usage — including Notion, Descript, Ramp, and others — because it makes managing model complexity simple, modular, and scalable.
✅ Supported Model Providers
This integration supports and has been tested with:
🔧 Focus for This PR:
🎯 Why This Matters
Adding Portkey unlocks significant benefits:
tool_calls
across models🌍 Industry Adoption & Strategic Importance
Portkey is not just a convenience — it is a requirement for SDK adoption in many real-world AI systems.
Why We Must Support Portkey:
Leading companies already standardize on Portkey. Without first-class support, these companies cannot use the SDK, as their LLM access, observability, and governance are fully routed through Portkey.
Companies Using Portkey in Production:
📎 Reference: Portkey Customers
Supporting Portkey makes the Strands SDK immediately compatible with the infrastructure already powering major AI systems — greatly reducing integration effort.
🧩 Strands SDK Context
This implementation extends the
Model
interface within the Strands SDK, Amazon’s agent platform for intelligent task automation.Key Capabilities Enabled:
tool_calls
/tool_use
)🔍 High-Level Implementation
This PR introduces a new model provider class:
PortkeyModel
, implementing the fullModel
interfaceToolSpec
mapping and schema encodingAll logic is structured to allow future expansion to other Portkey-supported capabilities (e.g., caching, retry policies, routing rules).
🧪 Testing Scope
This feature was validated across the following dimensions:
🛠️ Next Steps
Related Issues
N/A
Documentation PR
📚 References
Type of Change
Testing
This change has been tested with:
hatch fmt --linter
hatch fmt --formatter
hatch test --all
Checklist
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.