Skip to content

feat(api): add Session runtime and provider readiness probes#214

Merged
seanbrar merged 1 commit into
mainfrom
feat/session-runtime
Jun 17, 2026
Merged

feat(api): add Session runtime and provider readiness probes#214
seanbrar merged 1 commit into
mainfrom
feat/session-runtime

Conversation

@seanbrar

@seanbrar seanbrar commented Jun 17, 2026

Copy link
Copy Markdown
Owner

Summary

Make multi-turn agent loops first-class without re-creating a provider per call.

  • Session owns one provider instance across many interact() / stream() / run_many() turns and closes it on exit. The one-shot module helpers now delegate to a single-use Session, so their behavior is unchanged.
  • Readiness probes: a ReadinessProvider protocol + ProviderReadiness result let a provider expose a fast preflight. Session.check_ready() and the module-level check_ready() probe before packing context. The local provider implements it against /health and /v1/models, verifying the configured model when one is set.
  • local_reasoning() helper returns the scoped provider_options for local servers that honor enable_thinking.

Related issue

None

Test plan

just check passes (ruff format, ruff check, mypy, 443 tests). New tests:

  • tests/interaction/test_interact_frontdoor.py: Session reuses and closes its provider; module-level check_ready() uses the provider probe; local_reasoning() shape.
  • tests/providers/test_local_contract.py: local check_ready health-endpoint path, models fallback, missing-model reporting, model-unset skip, and model-verification requirement.

Notes

Third and final PR in the v2 RC stack. Stacked on #213 (which is on #212).


  • PR title follows conventional commits
  • just check passes
  • Tests cover the meaningful cases, not just the happy path
  • Docs updated (if this changes public API or user-facing behavior)

Base automatically changed from feat/error-taxonomy-interop to main June 17, 2026 09:09
Make multi-turn agent loops first-class without re-creating a provider
per call:

- Session owns one provider instance across many interact()/stream()/
  run_many() turns and closes it on exit; the one-shot helpers now
  delegate to a single-use Session so behavior stays identical.
- ReadinessProvider protocol + ProviderReadiness let a provider expose a
  fast preflight. Session.check_ready() and the module-level check_ready()
  probe before packing context; the local provider implements it against
  /health and /v1/models (verifying the configured model when set).
- local_reasoning() helper returns the scoped provider_options for local
  servers that honor enable_thinking.
@seanbrar seanbrar force-pushed the feat/session-runtime branch from ff4df6f to d90c1a4 Compare June 17, 2026 09:14
@codecov

codecov Bot commented Jun 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 77.04918% with 14 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/pollux/providers/local.py 73.46% 13 Missing ⚠️
src/pollux/providers/base.py 91.66% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

@seanbrar seanbrar merged commit 91b51c9 into main Jun 17, 2026
10 checks passed
@seanbrar seanbrar deleted the feat/session-runtime branch June 17, 2026 09:23
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.

1 participant