Skip to content

release: 0.10.0 — deprecate old constructors, migrate to from_config#60

Merged
yuanhao merged 2 commits into
mainfrom
feat/deprecate-old-constructors
Jul 6, 2026
Merged

release: 0.10.0 — deprecate old constructors, migrate to from_config#60
yuanhao merged 2 commits into
mainfrom
feat/deprecate-old-constructors

Conversation

@yuanhao

@yuanhao yuanhao commented Jul 5, 2026

Copy link
Copy Markdown
Collaborator

What

Completes Phase B. The config-first construction API (shipped additively in #59) becomes the recommended path: the old builders are now #[deprecated(since = "0.10.0")], and every call site across code and docs migrates to from_config.

Deprecated (removed in 1.0 — still work, with a compiler nudge)

  • Agent::new, Agent::with_model, Agent::with_model_config
  • SubAgentTool::new, SubAgentTool::with_model, SubAgentTool::with_model_config

The migration

// before (0.9): pair provider+config by hand, model id twice
let agent = Agent::new(OpenAiCompatProvider)
    .with_model_config(ModelConfig::zai("glm-4.7", "GLM 4.7"))
    .with_model("glm-4.7")
    .with_api_key(key);

// after (0.10): provider inferred from config.api; key from ZAI_API_KEY
let agent = Agent::from_config(ModelConfig::zai("glm-4.7", "GLM 4.7"));

Full before/after table in CHANGELOG.md. with_api_key is not deprecated.

Sweep (CI is -Dwarnings, so every compiled site moved here)

  • Examples (code_review, rlm, shared_state) + both src doctests.
  • Tests — all migrated except two kept under #[allow(deprecated)] to retain coverage of the deprecated-but-present API until 1.0: test_agent_builder_pattern (asserts the builder's effect) and session_cost_usd_none_without_model_config (the no-config None branch is only reachable via Agent::new).
  • All 19 mdBook pages (providers/concepts/guides/reference). Azure/Bedrock/Vertex use ModelConfig::custom (no preset exists).
  • SubAgentTool from_* route through a private build() so they don't trip their own deprecation lint.

Release bits

  • Version 0.10.0; CHANGELOG.md with migration guide.
  • README install 0.9 → 0.10; docs/installation 0.5 → 0.10 + MSRV 1.56 → 1.86; README OpenAI-compat example now builds via from_config.

Verification

  • cargo clippy --all-targets --all-features (-Dwarnings) — clean
  • cargo test --all-features — all green
  • cargo doc (-Dwarnings) + doctests — clean

Not in this PR

The crates.io publish (tag + GitHub Release, which triggers publish.yml) is held for maintainer sign-off, per the release flow.

🤖 Generated with Claude Code

yuanhao and others added 2 commits July 5, 2026 23:59
Completes Phase B: the config-first construction API (shipped additively in
#59) becomes the recommended path, the old builders are deprecated, and every
call site across the codebase and docs migrates to it.

Deprecated (since 0.10.0, removed in 1.0 — all still work, with a compiler
warning pointing at the replacement):
- Agent::new, Agent::with_model, Agent::with_model_config
- SubAgentTool::new, SubAgentTool::with_model, SubAgentTool::with_model_config

The SubAgentTool from_* builders now route through a private `build()` so they
don't trip their own deprecation lint.

Migrated to the new API (CI is -Dwarnings, so every compiled call site had to
move in this commit):
- All examples (code_review, rlm, shared_state; basic/sub_agent/callbacks/
  persistence/cli were done in #59) and both src doctests.
- All tests, except two kept on the deprecated API under #[allow(deprecated)]
  to preserve its coverage until 1.0: test_agent_builder_pattern (asserts the
  builder's effect) and session_cost_usd_none_without_model_config (the
  no-config None branch is only reachable via Agent::new).
- All 19 mdBook pages (providers/concepts/guides/reference). Azure/Bedrock/
  Vertex use ModelConfig::custom since no preset exists.

Release:
- Version 0.10.0.
- CHANGELOG.md with a migration guide (before/after table).
- README install snippet 0.9 -> 0.10; docs/installation 0.5 -> 0.10 and MSRV
  1.56 -> 1.86; README OpenAI-compat example now builds an agent via
  from_config instead of dangling a registry.

Verified: cargo clippy --all-targets --all-features (-Dwarnings) clean; cargo
test --all-features all green; cargo doc (-Dwarnings) clean; doctests pass.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Doc-accuracy review of the migrated (un-CI-compiled) mdBook pages surfaced:

- docs/providers/model-presets.md: `with_thinking_level` is not a real method
  (it's `with_thinking`) — fixed both occurrences. The migration rewrote these
  blocks and should have caught the invented call.
- docs/getting-started/installation.md: the openapi-feature snippet still
  pinned `version = "0.5"` (the main install line was bumped to 0.10 but this
  one was missed) → 0.10; and listed `serde_yaml` where the crate now uses
  `serde_yaml_ng`.
- docs/concepts/prompt-caching.md: the Bedrock row claimed "Automatic (where
  supported)", contradicting README's "Bedrock has no automatic caching" —
  reconciled to no automatic caching.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@yuanhao yuanhao merged commit 5720089 into main Jul 6, 2026
4 checks passed
@yuanhao yuanhao deleted the feat/deprecate-old-constructors branch July 6, 2026 06:41
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