Skip to content

fix(sdk-python): use AsyncConfig.from_environment() for client default async config#714

Merged
AbirAbbas merged 1 commit into
mainfrom
takeover/632-client-async-env-defaults
Jul 3, 2026
Merged

fix(sdk-python): use AsyncConfig.from_environment() for client default async config#714
AbirAbbas merged 1 commit into
mainfrom
takeover/632-client-async-env-defaults

Conversation

@AbirAbbas

Copy link
Copy Markdown
Contributor

Summary

AgentFieldClient built its default async_config with AsyncConfig(), which ignores the AGENTFIELD_ASYNC_* environment overrides that Agent already honors. This initializes the default from AsyncConfig.from_environment() so client-level async behavior (timeouts, event stream, poll intervals, etc.) can be tuned via env vars, while any explicitly passed async_config is preserved unchanged.

from_environment() starts from AsyncConfig() 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 — default async_config now uses AsyncConfig.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 . — clean
  • cd sdk/python && python -m pytest --no-cov — 1644 passed, 4 skipped

🤖 Generated with Claude Code

…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>
@AbirAbbas AbirAbbas requested a review from a team as a code owner July 3, 2026 16:50
@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

Performance

SDK Memory Δ Latency Δ Tests Status
Python 9.4 KB +5% 0.31 µs -11%

✓ No regressions detected

@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

📊 Coverage gate

Thresholds from .coverage-gate.toml: per-surface ≥ 84%, aggregate ≥ 85%, max per-surface regression ≤ 1.0 pp, max aggregate regression ≤ 0.50 pp.

Surface Current Baseline Δ
control-plane 87.00% 87.40% ↓ -0.40 pp 🟡
sdk-go 91.80% 92.00% ↓ -0.20 pp 🟢
sdk-python 93.87% 93.73% ↑ +0.14 pp 🟢
sdk-typescript 90.05% 90.42% ↓ -0.37 pp 🟢
web-ui 84.82% 84.79% ↑ +0.03 pp 🟡
aggregate 85.62% 85.75% ↓ -0.13 pp 🟡

✅ Gate passed

No surface regressed past the allowed threshold and the aggregate stayed above the floor.

@github-actions

github-actions Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

📐 Patch coverage gate

Threshold: 80% on lines this PR touches vs origin/main (from .coverage-gate.toml:thresholds.min_patch).

Surface Touched lines Patch coverage Status
control-plane 0 ➖ no changes
sdk-go 0 ➖ no changes
sdk-python 1 100.00%
sdk-typescript 0 ➖ no changes
web-ui 0 ➖ no changes

✅ Patch gate passed

Every surface whose lines were touched by this PR has patch coverage at or above the threshold.

@AbirAbbas AbirAbbas merged commit 04756b8 into main Jul 3, 2026
32 checks passed
@AbirAbbas AbirAbbas deleted the takeover/632-client-async-env-defaults branch July 3, 2026 18:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Python SDK] Inconsistent defaults for AsyncConfig and AIConfig

1 participant