Skip to content

Conversation

@christian-bromann
Copy link
Member

Based on the direction from #9406 this would implement the websearch tool. Here is the example output from the example script:

{
  messages: [
    HumanMessage {
      "id": "c7416f2c-bea0-4e49-a3b6-384b23099211",
      "content": "What's the weather in NYC?",
      "additional_kwargs": {},
      "response_metadata": {}
    },
    AIMessage {
      "id": "msg_01CqUm4rR4KrgtUvemNA1gfK",
      "content": [
        {
          "type": "server_tool_use",
          "id": "srvtoolu_01NottiD8nsS9Y4H64A1TEsb",
          "name": "web_search",
          "input": {
            "query": "NYC weather today"
          }
        },
        {
          "type": "web_search_tool_result",
          "tool_use_id": "srvtoolu_01NottiD8nsS9Y4H64A1TEsb",
          "content": [
            "[Object]",
            "[Object]",
            "[Object]",
            "[Object]",
            "[Object]",
            "[Object]",
            "[Object]",
            "[Object]",
            "[Object]",
            "[Object]"
          ]
        },
        {
          "type": "text",
          "text": "Based on the latest weather information for New York City:\n\n**Today (Thursday, November 14):**\n"
        },
        {
          "citations": [
            "[Object]"
          ],
          "type": "text",
          "text": "Partly cloudy skies in the morning will give way to cloudy skies during the afternoon, with a high near 53°F and winds from the west-northwest at 10 to 15 mph."
        },
        {
          "type": "text",
          "text": "\n\n**Tonight:**\n"
        },
        {
          "citations": [
            "[Object]"
          ],
          "type": "text",
          "text": "Mostly cloudy, then gradually becoming mostly clear, with a low around 42°F and west wind around 13 mph, with gusts as high as 24 mph."
        },
        {
          "type": "text",
          "text": "\n\n**Recent Weather Note:**\n"
        },
        {
          "citations": [
            "[Object]"
          ],
          "type": "text",
          "text": "NYC saw its first snow of the season on Tuesday, with wintry showers during the morning commute."
        },
        {
          "type": "text",
          "text": "\n\nThe weather is cool and breezy today with temperatures in the low 50s, typical for mid-November in New York City."
        }
      ],
      "name": "model",
      "additional_kwargs": {
        "model": "claude-sonnet-4-5-20250929",
        "id": "msg_01CqUm4rR4KrgtUvemNA1gfK",
        "type": "message",
        "role": "assistant",
        "stop_reason": "end_turn",
        "stop_sequence": null,
        "usage": {
          "input_tokens": 9422,
          "cache_creation_input_tokens": 0,
          "cache_read_input_tokens": 0,
          "cache_creation": {
            "ephemeral_5m_input_tokens": 0,
            "ephemeral_1h_input_tokens": 0
          },
          "output_tokens": 290,
          "service_tier": "standard",
          "server_tool_use": {
            "web_search_requests": 1
          }
        }
      },
      "response_metadata": {
        "model": "claude-sonnet-4-5-20250929",
        "id": "msg_01CqUm4rR4KrgtUvemNA1gfK",
        "stop_reason": "end_turn",
        "stop_sequence": null,
        "usage": {
          "input_tokens": 9422,
          "cache_creation_input_tokens": 0,
          "cache_read_input_tokens": 0,
          "cache_creation": {
            "ephemeral_5m_input_tokens": 0,
            "ephemeral_1h_input_tokens": 0
          },
          "output_tokens": 290,
          "service_tier": "standard",
          "server_tool_use": {
            "web_search_requests": 1
          }
        },
        "type": "message",
        "role": "assistant",
        "model_provider": "anthropic"
      },
      "tool_calls": [],
      "invalid_tool_calls": [],
      "usage_metadata": {
        "input_tokens": 9422,
        "output_tokens": 290,
        "total_tokens": 9712,
        "input_token_details": {
          "cache_creation": 0,
          "cache_read": 0
        }
      }
    }
  ]
}

@changeset-bot
Copy link

changeset-bot bot commented Nov 14, 2025

⚠️ No Changeset found

Latest commit: 1782388

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants