Add regional endpoint selection with GatewayArea support#1
Closed
fern-support wants to merge 2 commits into
Closed
Add regional endpoint selection with GatewayArea support#1fern-support wants to merge 2 commits into
fern-support wants to merge 2 commits into
Conversation
- Add area.py with GatewayArea enum (US, EU, APAC, CN) and RegionalEndpointPool class - Add regional_client.py with RegionalAgora and AsyncRegionalAgora wrapper clients - Update __init__.py to export wrapper clients as Agora/AsyncAgora - Export GatewayArea and RegionalEndpointPool for advanced usage - Add DNS-based domain selection for optimal connectivity - Support region cycling for failover scenarios - Update .fernignore to protect manually added files Co-Authored-By: blank@buildwithfern.com <blank@buildwithfern.com>
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
⚙️ Control Options:
|
Co-Authored-By: blank@buildwithfern.com <blank@buildwithfern.com>
4 tasks
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.
Add regional endpoint selection with GatewayArea support
Summary
This PR adds area-based URL selection to the Python SDK, mirroring the functionality added to the Go SDK in this commit.
The implementation creates wrapper clients (
RegionalAgora/AsyncRegionalAgora) that extend the base Fern-generated clients, then exports them asAgora/AsyncAgoraso users get the enhanced functionality transparently.New exports:
GatewayAreaenum: US, EU, APAC, CNRegionalEndpointPool: For advanced users who want to manage the pool lifecycleUsage:
Files added to
.fernignoreto prevent Fern from overwriting manual changes.Updates since last revision
/api/conversational-ai-agentsuffix to regional URLs (e.g.,https://api-us-west-1.agora.io/api/conversational-ai-agent) to match the default environment URL structureagents.list()API (returned 0 agents, confirming connectivity works)Review & Testing Checklist for Human
api-us-west-1,api-cn-east-1, etc.) and domain suffixes (agora.io,sd-rtn.com) match the Go implementation exactlyselect_best_domain()callssocket.getaddrinfo()during client init. Verify this is acceptable behavior (could block if DNS is slow)__init__and passed to parent. Callingendpoint_pool.next_region()later won't update the client's base URL. Confirm this is the intended behavior.from agoraio import AgorareturnsRegionalAgoraand that existing code withoutgateway_areastill worksRecommended test plan:
pip install -e .from agoraio import Agora, GatewayArea, RegionalEndpointPoolgateway_area=GatewayArea.USand verify the base URL ishttps://api-us-west-1.agora.io/api/conversational-ai-agentgateway_areaand verify it falls back to default environmentNotes
Link to Devin run: https://app.devin.ai/sessions/3f033f4523f94c2384477ddfc79d00a8
Requested by: blank@buildwithfern.com (@fern-support)