docs: update Mantle setup to reflect automatic shim detection

This commit is contained in:
2026-05-12 11:16:22 -04:00
parent fe94f6a9a8
commit 75d529cf16
6 changed files with 380 additions and 105 deletions

View File

@@ -211,36 +211,38 @@ Mantle exposes the Anthropic Messages API for supported Claude models. Fast-agen
```yaml
default_model: anthropic.claude-opus-4-7
# ── Model Capabilities ──────────────────────────────────────────────────────
# mantle: true is REQUIRED — it installs a Pallas-level provider override that
# strips the features the Mantle endpoint rejects (anthropic-beta headers,
# extended thinking, task budget, web tools, prompt caching). Without this
# flag fast-agent sends those features and Mantle returns a misleading
# 404 "model does not exist" error.
model_capabilities:
vision: true
context_window: 1000000
max_output_tokens: 128000
mantle: true
# ── Anthropic provider pointing at Mantle ────────────────────────────────────
anthropic:
base_url: "https://bedrock-mantle.us-east-1.api.aws/anthropic"
```
That's the whole configuration. Pallas auto-detects the
`bedrock-mantle` hostname in `anthropic.base_url` at startup and installs
two compatibility shims so fast-agent's default request shape matches
what Mantle expects (see `pallas/mantle_shims.py`):
1. **Wire-name prefix** — re-adds the `anthropic.` prefix that fast-agent's
parser strips off, because Mantle requires the full
`anthropic.claude-opus-4-7` wire id. Without this shim you get
`404 "The model '...' does not exist"`.
2. **`caller: null` strip** — drops the stray `caller` field Anthropic
SDK 0.100.x leaks onto replayed `tool_use` blocks (upstream issue
[anthropics/anthropic-sdk-python#1454](https://github.com/anthropics/anthropic-sdk-python/issues/1454)).
Mantle's validator rejects `caller: null` with `"tool_use.caller:
Input should be a valid dictionary or object"`, which would otherwise
break the MCP tool-use loop on the second turn.
The Anthropic SDK appends `/v1/messages` to `base_url` automatically.
> **Why `mantle: true` is required.** Fast-agent's built-in `ModelDatabase`
> entries for Claude Opus 4.7 and Haiku 4.5 declare features that the
> Anthropic API supports but the Mantle endpoint rejects —
> `anthropic-beta: code-execution-web-tools-...` headers, extended thinking,
> task budget, web search/fetch tools, and prompt caching in some
> configurations. When Mantle sees a request carrying those features it
> responds with a confusingly generic `{"type": "not_found_error",
> "message": "The model '...' does not exist"}`. Pallas reads the `mantle`
> flag and writes an entry into fast-agent's `_PROVIDER_MODEL_OVERRIDES`
> dict for `(Provider.ANTHROPIC, <model>)` that strips those fields, so
> fast-agent sends a plain Messages API request that Mantle accepts.
**Feature support.** Mantle accepts the same Messages API request shape
as `api.anthropic.com` once the shims are in place, including full MCP
tool use (`tools`, `tool_use`/`tool_result` content blocks). Extended
thinking, task budget, web_fetch/web_search server tools, and explicit
prompt caching (`cache_control`) are not available via Mantle and should
be left off in agent code when targeting Mantle — fast-agent's
`ModelDatabase` entries already disable the ones the Anthropic SDK 0.100.x
would otherwise auto-attach.
### `fastagent.secrets.yaml`