Skip to content

fix: Updated the startup and shutdown events, now they are using life…#631

Open
DebanKsahu wants to merge 3 commits into
Agent-Field:mainfrom
DebanKsahu:fix/fastapi_depricated_event
Open

fix: Updated the startup and shutdown events, now they are using life…#631
DebanKsahu wants to merge 3 commits into
Agent-Field:mainfrom
DebanKsahu:fix/fastapi_depricated_event

Conversation

@DebanKsahu

Copy link
Copy Markdown

Summary

I changed the startup and shutdown events from python sdk. Previously it was using deprecated on_event() method but I replaced it with lifespan which handle both shutdown and startup event.

Type of change

  • Bug fix
  • New feature
  • Refactor / cleanup
  • Docs only
  • Tests only
  • CI / tooling
  • Breaking change

Test plan

  • ./scripts/test-all.sh
  • ./scripts/coverage-summary.sh was run locally, but it currently stops at sdk-python because the local .venv is missing pip.
  • Verified the branch rebases cleanly on latest upstream/main.

Before asking for review, please confirm:

  • I ran tests for the surface(s) I changed locally.
  • New code paths are covered by tests in this PR (no bare additions).
  • If I removed code, I updated coverage-baseline.json in
    this PR only if the removal caused a legitimate regression and I
    called it out in the summary above.
  • The coverage gate check is green in CI before requesting review.

Checklist

Related issues / PRs

Fixes #628

@DebanKsahu DebanKsahu requested review from a team and AbirAbbas as code owners June 6, 2026 11:48
@CLAassistant

CLAassistant commented Jun 6, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@santoshkumarradha santoshkumarradha left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for taking this on. Moving off the deprecated startup/shutdown hooks is the right direction. I left one blocker inline because this version replaces the app lifespan outright, which can break callers that already pass their own FastAPI lifespan into Agent.

Comment thread sdk/python/agentfield/agent_server.py Outdated
@github-actions

github-actions Bot commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

Performance

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

✓ No regressions detected

@github-actions

github-actions Bot commented Jun 7, 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.10% 87.40% ↓ -0.30 pp 🟡
sdk-go 92.10% 92.00% ↑ +0.10 pp 🟢
sdk-python 93.73% 93.73% ↑ +0.00 pp 🟢
sdk-typescript 90.50% 90.42% ↑ +0.08 pp 🟢
web-ui 84.83% 84.79% ↑ +0.04 pp 🟡
aggregate 85.67% 85.75% ↓ -0.08 pp 🟡

✅ Gate passed

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

@github-actions

github-actions Bot commented Jun 7, 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 0 ➖ no changes
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.

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] Using deprecated shutdown and startup events

3 participants