Skip to content

models - anthropic - #8

Closed
rlatntjr wants to merge 0 commit into
strands-agents:mainfrom
rlatntjr:main
Closed

rlatntjr wants to merge 0 commit into
strands-agents:mainfrom
rlatntjr:main

Conversation

@rlatntjr

Copy link
Copy Markdown
Contributor

Description

Add Anthropic Claude API support to the SDK, enabling integration with Claude models for agent functionality. This implementation includes proper message formatting, tool use
handling, and media support.

Documentation PR

PR in the agent-docs repo will be submitted separately.

Type of Change

  • New feature

Testing

[How have you tested the change?]

  • All unit tests pass
  • Verified functionality with basic agent operations
  • Verified proper message formatting and tool use
  • Validated media handling for images
  • Ran:
    • hatch fmt --linter
    • hatch fmt --formatter
    • hatch test --all

Checklist

  • I have read the CONTRIBUTING document
  • I have added tests that prove my fix is effective or my feature works
  • I have updated the documentation accordingly
  • I have added an appropriate example to the documentation to outline the feature
  • My changes generate no new warnings
  • Any dependent changes have been merged and published

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@yonib05 yonib05 closed this May 16, 2025
Unshure added a commit that referenced this pull request Jan 15, 2026
* feat(hooks): expose input messages to BeforeInvocationEvent

Add messages attribute to BeforeInvocationEvent to enable input-side
guardrails for PII detection, content moderation, and prompt attack
prevention. Hooks can now inspect and modify messages before they are
added to the agent's conversation history.

- Add writable messages attribute to BeforeInvocationEvent (None default)
- Pass messages parameter from _run_loop() to BeforeInvocationEvent
- Add unit tests for new messages attribute and writability
- Add integration tests for message modification use case
- Update docs/HOOKS.md with input guardrails documentation

Resolves #8

* refactor: address review feedback

- Remove detailed Input Guardrails section from docs/HOOKS.md
- Simplify BeforeInvocationEvent docstring per review
- Remove backward compatibility note from messages attribute
- Remove no-op test for messages initialization

* refactor: simplify test assertions per review

Use concise equality comparison for BeforeInvocationEvent assertions
instead of verbose instance checks and property assertions.

* Use overwritten messages array for the agent

* Fix mypy issue

---------

Co-authored-by: Strands Agent <217235299+strands-agent@users.noreply.github.com>
manoj-selvakumar5 pushed a commit to manoj-selvakumar5/strands-sdk-python that referenced this pull request Feb 5, 2026
…1474)

* feat(hooks): expose input messages to BeforeInvocationEvent

Add messages attribute to BeforeInvocationEvent to enable input-side
guardrails for PII detection, content moderation, and prompt attack
prevention. Hooks can now inspect and modify messages before they are
added to the agent's conversation history.

- Add writable messages attribute to BeforeInvocationEvent (None default)
- Pass messages parameter from _run_loop() to BeforeInvocationEvent
- Add unit tests for new messages attribute and writability
- Add integration tests for message modification use case
- Update docs/HOOKS.md with input guardrails documentation

Resolves strands-agents#8

* refactor: address review feedback

- Remove detailed Input Guardrails section from docs/HOOKS.md
- Simplify BeforeInvocationEvent docstring per review
- Remove backward compatibility note from messages attribute
- Remove no-op test for messages initialization

* refactor: simplify test assertions per review

Use concise equality comparison for BeforeInvocationEvent assertions
instead of verbose instance checks and property assertions.

* Use overwritten messages array for the agent

* Fix mypy issue

---------

Co-authored-by: Strands Agent <217235299+strands-agent@users.noreply.github.com>
zastrowm pushed a commit that referenced this pull request May 28, 2026
lizradway added a commit to lizradway/harness-sdk that referenced this pull request Sep 10, 2026
- Guard eager hook against pinned messages (fix #1)
- Add {@link ContextManagerConfig} to ContextManagerStrategy TSDoc (fix strands-agents#2)
- Remove overflow clear so emergency truncate always fires as safety net (fix strands-agents#3)
- Warn when both contextManager and conversationManager are set (fix strands-agents#4)
- Fix "turns" → "messages" in staleToolCleanup doc (fix strands-agents#5)
- Improve two-pass pinned test to exercise repairAlternation merge (fix strands-agents#8)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants