MCPcopy Create free account
hub / github.com/anthropics/anthropic-sdk-python / _async_compact_runner

Function _async_compact_runner

tests/lib/tools/test_runners.py:2552–2567  ·  view source on GitHub ↗
(
    client: AsyncAnthropic,
    *,
    context_management: Union[BetaContextManagementConfigParam, Omit] = omit,
    max_iterations: Union[int, Omit] = omit,
    thread: Union[Literal[False], Omit] = omit,
)

Source from the content-addressed store, hash-verified

2550
2551
2552def _async_compact_runner(
2553 client: AsyncAnthropic,
2554 *,
2555 context_management: Union[BetaContextManagementConfigParam, Omit] = omit,
2556 max_iterations: Union[int, Omit] = omit,
2557 thread: Union[Literal[False], Omit] = omit,
2558) -> BetaAsyncToolRunner[None]:
2559 return client.beta.messages.tool_runner(
2560 thread=thread,
2561 max_tokens=1024,
2562 model="claude-haiku-4-5",
2563 tools=[_async_weather_tool()],
2564 messages=[{"role": "user", "content": "What is the weather in SF?"}],
2565 context_management=context_management,
2566 max_iterations=max_iterations,
2567 )
2568
2569
2570def _current_messages(runner: Union[BetaToolRunner[None], BetaAsyncToolRunner[None]]) -> List[Any]:

Calls 2

_async_weather_toolFunction · 0.85
tool_runnerMethod · 0.45

Tested by

no test coverage detected