Skip to content

Add web fetch tool support for Anthropic#167405

Open
Shulyaka wants to merge 18 commits intohome-assistant:devfrom
Shulyaka:anthropic_web_fetch
Open

Add web fetch tool support for Anthropic#167405
Shulyaka wants to merge 18 commits intohome-assistant:devfrom
Shulyaka:anthropic_web_fetch

Conversation

@Shulyaka
Copy link
Copy Markdown
Contributor

@Shulyaka Shulyaka commented Apr 4, 2026

Proposed change

Add web fetch server tool support for Anthropic

Type of change

  • Dependency upgrade
  • Bugfix (non-breaking change which fixes an issue)
  • New integration (thank you!)
  • New feature (which adds functionality to an existing integration)
  • Deprecation (breaking change to happen in the future)
  • Breaking change (fix/feature causing existing functionality to break)
  • Code quality improvements to existing code or addition of tests

Additional information

Checklist

  • I understand the code I am submitting and can explain how it works.
  • The code change is tested and works locally.
  • Local tests pass. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.
  • I have followed the development checklist
  • I have followed the perfect PR recommendations
  • The code has been formatted using Ruff (ruff format homeassistant tests)
  • Tests have been added to verify that the new code works.
  • Any generated code has been carefully reviewed for correctness and compliance with project standards.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • The manifest file has all fields filled out correctly.
    Updated and included derived files by running: python3 -m script.hassfest.
  • New or updated dependencies have been added to requirements_all.txt.
    Updated by running python3 -m script.gen_requirements_all.
  • For the updated dependencies a diff between library versions and ideally a link to the changelog/release notes is added to the PR description.

To help with the load of incoming pull requests:

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds support for Anthropic’s web fetch server tool to the Anthropic conversation agent, including configuration options, runtime tool wiring, and tests/snapshots to validate the new behavior.

Changes:

  • Add new config options (web_fetch, web_fetch_max_uses) to the subentry config flow and UI strings.
  • Implement web fetch tool handling in the Anthropic conversation entity (tool selection + tool result conversion).
  • Add test coverage and update snapshots for web fetch success and error cases.

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
homeassistant/components/anthropic/entity.py Adds web fetch tool support (tool selection + stream/tool-result conversion) and broadens citation serialization.
homeassistant/components/anthropic/config_flow.py Exposes web fetch options in the model options step and validates numeric inputs as positive ints.
homeassistant/components/anthropic/const.py Introduces new constants/defaults for web fetch configuration.
homeassistant/components/anthropic/strings.json Adds UI labels and descriptions for web fetch settings (conversation + AI task subentries).
tests/components/anthropic/__init__.py Adds a helper to generate streamed web fetch tool result blocks for tests.
tests/components/anthropic/test_conversation.py Adds new conversation tests covering web fetch success and error flows.
tests/components/anthropic/test_config_flow.py Updates config flow tests to include the new web fetch options in expected data.
tests/components/anthropic/snapshots/test_conversation.ambr Adds/updates snapshots for web fetch-related conversation flows and history conversion.

Comment thread tests/components/anthropic/test_conversation.py
@Shulyaka Shulyaka marked this pull request as ready for review April 4, 2026 20:11
Comment thread homeassistant/components/anthropic/entity.py Outdated
Copilot AI review requested due to automatic review settings April 5, 2026 17:12
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated no new comments.

Copilot AI review requested due to automatic review settings April 6, 2026 11:03
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Comment thread homeassistant/components/anthropic/entity.py Outdated
Copilot AI review requested due to automatic review settings April 7, 2026 16:00
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated no new comments.

Copilot AI review requested due to automatic review settings April 18, 2026 09:55
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated no new comments.

Copilot AI review requested due to automatic review settings April 21, 2026 14:28
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated no new comments.

Copilot AI review requested due to automatic review settings April 24, 2026 08:25
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated 2 comments.

Comment thread tests/components/anthropic/test_conversation.py Outdated
Comment thread homeassistant/components/anthropic/config_flow.py
Shulyaka and others added 2 commits April 24, 2026 11:32
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings April 24, 2026 08:42
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated no new comments.

@zweckj
Copy link
Copy Markdown
Member

zweckj commented Apr 27, 2026

there are merge conflicts, could you take a look?

@zweckj zweckj marked this pull request as draft April 27, 2026 13:46
Copilot AI review requested due to automatic review settings April 28, 2026 13:05
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 8 out of 8 changed files in this pull request and generated no new comments.

@Shulyaka Shulyaka marked this pull request as ready for review April 28, 2026 13:11
@Shulyaka
Copy link
Copy Markdown
Contributor Author

Done!

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.

5 participants