-
Notifications
You must be signed in to change notification settings - Fork 36
Description
Summary
When using an Anthropic model (e.g. anthropic:claude-opus-4-6) with any-llm-sdk[anthropic], bub fails on every model call because the underlying run_tools_async() in republic hardcodes stream=False, which the Anthropic provider does not support.
Environment
- bub: 0.1.1
- republic: 0.3.2
- any-llm-sdk: >= 1.7.0 (with
anthropicextra)
Steps to Reproduce
-
Configure
.env:BUB_MODEL=anthropic:claude-opus-4-6 -
Install with Anthropic support:
uv sync uv add any-llm-sdk[anthropic]
-
Start bub and send any message:
uv run bub bub > hello INFO model.runner.step step=1 model=anthropic:claude-opus-4-6 ╭──────────────────────────────────────────── Error ─────────────────────────────────────────────╮ │ unknown: anthropic:claude-opus-4-6: Streaming is required for operations that may take longer │ │ than 10 minutes. See https://github.com/anthropics/anthropic-sdk-python#long-requests for more │ │ details │ ╰────────────────────────────────────────────────────────────────────────────────────────────────╯
Root Cause
The call chain from bub to the Anthropic API:
bub/core/model_runner.py L169 self._tape.tape.run_tools_async(...)
→ republic/clients/chat.py L964 _execute_async(stream=False) ← hardcoded
→ republic/core/execution.py client.acompletion(stream=False)
→ any-llm-sdk Anthropic provider raises error ❌
Bub calls Tape.run_tools_async(), which delegates to republic's ChatClient.run_tools_async(). This method hardcodes stream=False (chat.py L964) and passes it all the way down to any-llm-sdk. The Anthropic provider in any-llm-sdk does not handle stream=False.
Republic's streaming methods (stream_events_async etc.) pass stream=True and work fine, but they don't auto-execute tools — which bub relies on.
Possible Fixes
This could be addressed at different layers:
- republic: internally stream-then-collect for providers that require
stream=True, keeping therun_tools_asyncAPI unchanged - republic: expose
streamas a configurable parameter onrun_tools_async(defaultFalsefor backward compat) - bub: replace
run_tools_asyncwithstream_events_async+ manual tool execution inmodel_runner.py(high complexity, not recommended)
Options 1–2 are cleaner since they keep the fix in one place. Raising here since this is where the issue surfaces, but the root fix likely belongs in republic or any-llm-sdk.