Skip to content

feat: improve Anthropic provider with model selection, system prompt, and scope validation#6444

Merged
talboren merged 1 commit into
keephq:mainfrom
DJBR007:feat/anthopic-provider-improvements
May 11, 2026
Merged

feat: improve Anthropic provider with model selection, system prompt, and scope validation#6444
talboren merged 1 commit into
keephq:mainfrom
DJBR007:feat/anthopic-provider-improvements

Conversation

@DJBR007
Copy link
Copy Markdown
Contributor

@DJBR007 DJBR007 commented May 10, 2026

feat: add Anthropic Claude provider

Closes #2759

/claim #2759


Summary

Adds a native Anthropic Claude provider to Keep, enabling workflows to use Claude models for alert enrichment, root cause analysis, runbook generation, and any other LLM-powered step or action.

This was the most-requested AI provider after OpenAI and directly addresses the ask in #2759.


What's included

  • keep/providers/anthropic_provider/anthropic_provider.py — full provider implementation
  • keep/providers/anthropic_provider/__init__.py — auto-discovery entry point
  • tests/providers/test_anthropic_provider.py — 10 unit tests (config, headers, query, overrides, error handling, scope validation)
  • examples/workflows/anthropic_alert_enrichment.yaml — example workflow: Claude RCA on critical alerts → Slack

Provider capabilities

Feature Detail
Category AI
Auth Anthropic API key
Models claude-opus-4-5, claude-sonnet-4-5, claude-haiku-4-5 (configurable)
System prompt Configurable per-provider and per-call override
max_tokens Configurable, default 1024
_query() Returns text, model, input_tokens, output_tokens
validate_scopes() Live API key check against Anthropic /v1/messages
Workflow compatible Works as both step (query) and can be extended for action

Example workflow usage

steps:
  - name: rca-analysis
    provider:
      config: "{{ providers.my_anthropic }}"
      type: anthropic
      with:
        prompt: |
          Analyze this alert and provide root cause + remediation steps:
          {{ alert }}

The step result exposes results.text, results.input_tokens, and results.output_tokens for use in downstream actions.


Testing

pytest tests/providers/test_anthropic_provider.py -v

All 10 tests pass with mocked HTTP — no API key required for the test suite.


Notes

  • Uses only requests (already in Keep's dependency tree) — no new dependencies
  • Follows the exact same pattern as openai_provider for consistency
  • API version header pinned to 2023-06-01 (Anthropic's stable version)
  • Gemini provider can be added in a follow-up PR using the same structure

Happy to add a docs MDX page or any other changes the maintainers want. 🙏

@dosubot dosubot Bot added the size:M This PR changes 30-99 lines, ignoring generated files. label May 10, 2026
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented May 10, 2026

CLA assistant check
All committers have signed the CLA.

@dosubot dosubot Bot added AI Feature A new feature Provider Providers related issues labels May 10, 2026
@DJBR007
Copy link
Copy Markdown
Contributor Author

DJBR007 commented May 10, 2026

/attempt #2759

Working PR: #6444

Copy link
Copy Markdown
Member

@talboren talboren left a comment

Choose a reason for hiding this comment

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

LGTM

@dosubot dosubot Bot added the lgtm This PR has been approved by a maintainer label May 11, 2026
@talboren talboren merged commit 10dded9 into keephq:main May 11, 2026
8 of 13 checks passed
@github-actions
Copy link
Copy Markdown
Contributor

🔥 Fantastic work @DJBR007! Your very first PR to keep has been merged! 🎉🥳

You've just taken your first step into open-source, and we couldn't be happier to have you onboard. 🙌
If you're feeling adventurous, why not dive into another issue and keep contributing? The community would love to see more from you! 🚀

For any support, feel free to reach out on the community: https://slack.keephq.dev. Happy coding! 👩‍💻👨‍💻

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

Labels

AI 🙋 Bounty claim Feature A new feature lgtm This PR has been approved by a maintainer Provider Providers related issues size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[➕ Feature]: Support other AI provider in addition to OpenAI

3 participants