wrap() (Python) and wrapAnthropic() (TypeScript) wrap the Anthropic client, including the Bedrock and Vertex clients of the same SDK in Python, so messages.create and messages.stream get the context and record the answer.
Install
@niadra/sdk 0.3.0, ready on main and on npm when it is published; until then the npm package is 0.1.1.
The five primitives
Minimal example
examples/anthropic_messages.py and examples/anthropic.ts.
Limits
- Outside a conversation or task block, calls pass through untouched, and nothing the wrapper does can fail the call.
- In TypeScript, for
messages.stream()prepare the body withanthropicParams()and record the final message withrecordAnthropic(). - The wrapper adds no
cache_controlwhere you use no prompt caching: it never changes your caching strategy. - Tested against
anthropic1.8 and@anthropic-ai/sdk0.128 with the transport replaced and Niadra on the emulator.
Next steps
Amazon Bedrock
the same for the Converse API.
Context and views
the target model and the cache floors.

