Skip to content

Landing-site review

A reviewer that compares candidate lunar south-pole landing sites with Claude, looks up each one with a local survey tool, and recommends where the crew should land, showing a summary of its reasoning.

Overview

A mission planner names a few candidate sites and asks which one the crew should take. Each site has a survey record: mean slope, the share of the year in sunlight, the distance to the nearest permanently shadowed region (likely ice), and how often Earth is in view. No site wins on every count, so the answer is a trade-off, and the planner wants to see the reasoning behind it, not only the verdict.

The reviewer runs on AnthropicProvider with extended thinking. It calls the site_survey tool for every site the planner names, then weighs the records and recommends one. Claude's reasoning comes back as thinking blocks; the demo asks for readable summaries of them and prints those before the recommendation.

What it teaches

  • AnthropicProvider against the Anthropic Messages API, with the key passed as a pydantic SecretStr and max_tokens set, since the Messages API requires it.
  • Extended-thinking settings through extras. The request's thinking and output_config parameters have no RuntimeConfig field, so the demo passes {"thinking": {"type": "adaptive", "display": "summarized"}, "output_config": {"effort": "high"}} as extras: readable reasoning summaries, and a higher effort level.
  • Reading a block-list reply. The reply's content is a list of blocks even when it is plain text. _text(...) joins the TextBlocks and _reasoning(...) collects the ThinkingBlock summaries.
  • Keeping thinking in the history. Each reply is appended exactly as it came back. Anthropic checks every thinking block's signature on the next call, and the model continues from that reasoning after the tool results arrive.
  • Several tool calls in one turn. The model usually surveys every site at once. dispatch_tools answers each call with a ToolMessage, and the provider sends the results back together as one turn.
  • An empty reply stays out. A reply cut short with nothing in it has "" as its content and no tool calls; the next complete() would reject it as history, so call_llm leaves it out.

How to run

uv sync --group examples
ANTHROPIC_API_KEY=sk-ant-... uv run python examples/landing-site-review/main.py

ANTHROPIC_MODEL picks the model (default claude-opus-5-5), and ANTHROPIC_BASE_URL routes through a gateway. Pass your own question on the command line to compare other sites from the survey table (Haworth and Nobile rim are also in it):

ANTHROPIC_API_KEY=sk-ant-... uv run python examples/landing-site-review/main.py \
  "Compare Haworth and Nobile rim for a crew that needs ice close by."

The graph

flowchart TD
  start([start])
  call_llm[call_llm]
  dispatch_tools[dispatch_tools]
  present[present]
  stop([end])

  start --> call_llm
  call_llm -->|tool_calls present| dispatch_tools
  call_llm -->|no tool_calls or turn cap hit| present
  dispatch_tools --> call_llm
  present --> stop

The same agent loop as the tool-use example: call_llm routes to dispatch_tools while the model asks for surveys, and to present once it answers or the six-turn cap is reached.

Reading the output

For the default question, expect something like:

========================================================================
Lunar landing-site review
========================================================================

  question: We're choosing between Shackleton rim, de Gerlache rim and
  Malapert massif. Which should the crew land at?

  turns: 2   site surveys: 3

  reasoning summaries:
    I've ruled out Malapert because of its slope and ice. Between
    Shackleton and de Gerlache, Shackleton gets more sunlight and has
    ice closer, while de Gerlache has a gentler slope and better Earth
    visibility...

  recommendation:
    I recommend landing at Shackleton rim.
    ...
  • turns: 2, site surveys: 3: the first call surveyed all three sites in one turn, and the second, with the survey results and the first reply's thinking blocks in its history, produced the recommendation.
  • Reasoning summaries come from the second turn's thinking blocks. The first turn's thinking was about which tools to call, and its blocks may carry no summary.
  • The recommendation's wording varies from run to run; the trade-off it describes should match the survey figures.