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

Function _sync_compact_runner

tests/lib/tools/test_runners.py:2530–2549  ·  view source on GitHub ↗
(
    client: Anthropic,
    *,
    betas: Union[List[AnthropicBetaParam], Omit] = omit,
    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

2528
2529
2530def _sync_compact_runner(
2531 client: Anthropic,
2532 *,
2533 betas: Union[List[AnthropicBetaParam], Omit] = omit,
2534 context_management: Union[BetaContextManagementConfigParam, Omit] = omit,
2535 max_iterations: Union[int, Omit] = omit,
2536 thread: Union[Literal[False], Omit] = omit,
2537) -> BetaToolRunner[None]:
2538 return client.beta.messages.tool_runner(
2539 # `thread=False` is for the tests that pin the full history of a request the loop sends between compactions:
2540 # on a message thread those requests carry only the messages the server does not hold yet.
2541 thread=thread,
2542 max_tokens=1024,
2543 model="claude-haiku-4-5",
2544 tools=[_sync_weather_tool()],
2545 messages=[{"role": "user", "content": "What is the weather in SF?"}],
2546 betas=betas,
2547 context_management=context_management,
2548 max_iterations=max_iterations,
2549 )
2550
2551
2552def _async_compact_runner(

Calls 2

_sync_weather_toolFunction · 0.85
tool_runnerMethod · 0.45

Tested by

no test coverage detected