All notable changes to anthropic-rs are documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
- Optional
tracingCargo feature. When enabled, every HTTP call on the transport critical path emits ananthropic.httpspan withmethod,path,status,attempts, andduration_msfields, plus a per-attemptdebug!event carrying the attempt number, response status, and attempt duration. The dependency and every instrumentation point compile out entirely when the feature is off. - Per-call retry policy override via the new
RetryPolicytype and theMessagesRequestBuilder::backoff/no_retries/retry_policybuilder methods (plus the equivalents onCountTokensRequestBuilderandCreateBatchRequest). Interactive paths can opt out of retries with.no_retries(); background workers can stretch the retry budget with.backoff(ExponentialBackoff { .. })— all without rebuilding theClient. - Pinned MSRV of 1.82 via
package.rust-versioninanthropic/Cargo.tomland a matchingMSRVjob in.github/workflows/ci.ymlthat reads the version fromCargo.tomlso it stays in sync automatically. - Supply-chain CI: a new
.github/workflows/supply-chain.ymlrunscargo auditandcargo deny(checking advisories, bans, licenses, and sources) on every PR, every push to main, and on a daily schedule. Policy is configured in a committeddeny.toml. - Fuzz targets for
parse_errorandparse_results_jsonlunderfuzz/, wired to aFuzzGitHub Actions workflow that smoke-runs each target on nightly. Both parsers sit on the transport critical path and consume attacker-controllable bytes, so the harness enforces the "never panic on arbitrary input" contract. A small regression corpus is baked into the library's__fuzztest module so the same invariants are checked in regular CI runs. Clientnow derivesCloneand implementsDebugwith the API key redacted, so clients can be safely shared across handlers and printed in diagnostic logs without leaking credentials.MessagesRequestBuildervalidatestemperatureandtop_pagainst[0.0, 1.0]locally before sending the request.ClientBuilderrejects emptyapi_key,api_base, andapi_versionvalues up front (previously they would surface as opaque API errors).Client::from_envreturnsAnthropicError::InvalidRequestifANTHROPIC_TIMEOUT_SECScannot be parsed as a positive integer (previously the value was silently ignored).- 429 retries now honor the
Retry-Afterresponse header (integer seconds form). CLAUDE.mdagent context file documenting workspace layout, conventions, build commands, and gotchas.CHANGELOG.md(this file).
- Streaming transport errors are now surfaced as
AnthropicError::EventSourceinstead of being string-wrapped intoAnthropicError::InvalidRequest. Callers can now match on the typed variant. Client::messages/messages_stream/count_tokens/ etc. share a singleexecute_byteshelper, removing the duplicated retry loop that previously lived inexecuteandexecute_raw.- README clarifies that
run_tool_loopexecutes tool callbacks sequentially (the previous wording incorrectly claimed parallel execution). .env.examplerewritten to match the variables actually read byClient::from_env(ANTHROPIC_API_KEY,ANTHROPIC_API_BASE,ANTHROPIC_API_VERSION,ANTHROPIC_BETA,ANTHROPIC_TIMEOUT_SECS).- Crate
homepage/repositoryURLs inCargo.tomlupdated to the currentAbdelStark/anthropic-rsrepository.
anthropic::stream::empty_response— unused outside its own test and trivially constructible by users who actually need an emptyMessagesResponse.
Initial release of the modernized SDK. See git history for details.