fix(sdk-python): use AsyncConfig.from_environment() for client default async config#714
Merged
Merged
Conversation
…t async config AgentFieldClient constructed its default async_config with AsyncConfig(), ignoring AGENTFIELD_ASYNC_* environment overrides that Agent already honors. Initialize the default from AsyncConfig.from_environment() so client-level async behavior can be tuned via env vars, while preserving any explicitly passed async_config unchanged. Adds regression coverage for both paths. Fixes #621. Supersedes #632 (original change by liuzemei / neooosky); re-authored here so it can land without the outstanding CLA signature. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
Performance
✓ No regressions detected |
Contributor
📊 Coverage gateThresholds from
✅ Gate passedNo surface regressed past the allowed threshold and the aggregate stayed above the floor. |
Contributor
📐 Patch coverage gateThreshold: 80% on lines this PR touches vs
✅ Patch gate passedEvery surface whose lines were touched by this PR has patch coverage at or above the threshold. |
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.
Summary
AgentFieldClientbuilt its defaultasync_configwithAsyncConfig(), which ignores theAGENTFIELD_ASYNC_*environment overrides thatAgentalready honors. This initializes the default fromAsyncConfig.from_environment()so client-level async behavior (timeouts, event stream, poll intervals, etc.) can be tuned via env vars, while any explicitly passedasync_configis preserved unchanged.from_environment()starts fromAsyncConfig()defaults and only overrides fields when the corresponding env var is set (falling back to the default on unparseable values), so this is fully backward-compatible for callers that set no env vars.Fixes #621.
Changes
sdk/python/agentfield/client.py— defaultasync_confignow usesAsyncConfig.from_environment().sdk/python/tests/test_async_config.py— regression coverage for both the env-backed default path and the explicit-override path.Provenance
Supersedes #632 (original change by @liuzemei / neooosky). That PR is approved by the maintainer but stuck on an outstanding CLA signature from an unsigned committer. Re-authored here so it can land cleanly; thanks to the original authors for the fix.
Test plan
cd sdk/python && ruff check .— cleancd sdk/python && python -m pytest --no-cov— 1644 passed, 4 skipped🤖 Generated with Claude Code