Skip to content

Conversation

@mehtarac
Copy link
Owner

Description

Related Issues

Documentation PR

Type of Change

Bug fix
New feature
Breaking change
Documentation update
Other (please describe):

Testing

How have you tested the change? Verify that the changes do not break functionality or introduce warnings in consuming repositories: agents-docs, agents-tools, agents-cli

  • I ran hatch run prepare

Checklist

  • I have read the CONTRIBUTING document
  • I have added any necessary 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, or no new docs are needed
  • 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.

Ratish1 and others added 17 commits October 7, 2025 14:43
* feat: Refactor and update tool loading to support modules

* Update registry.py

* feat: Address pr feedback

* Update src/strands/tools/registry.py

Co-authored-by: Patrick Gray <[email protected]>

* Update src/strands/tools/loader.py

Co-authored-by: Patrick Gray <[email protected]>

---------

Co-authored-by: Patrick Gray <[email protected]>
* Adding Development Tenets to CONTRIBUTING.md

* Update CONTRIBUTING.md
* fix(sagemaker): additional_args dict issue

Fix error where passing an additional_args dict to SageMakerAIModel
would raise an AttributeError because Python dicts have no '__dict__'
attribute.

Fixes #982

* fix(sagemaker): typing for endpoint_config

Fix typing for SageMakerAIModel.endpoint_config which was previously
being treated as an arbitrary dictionary due to init assignment.

* fix(sagemaker): Typing for payload_config

Fix typing for SageMakerAIModel.payload_config, which was previously
being treated as a plain dict due to init assignment.

* test(sagemaker): tests for ep additional_args

Add a test to check for insertion of endpoint config additional_args

* fix(sagemaker): include payload additional_args

Copy SageMakerAIPayloadSchema's additional_args into request payloads
where provided - previously these were being ignored. Includes unit
tests.
* feat: replace kwargs with invocation_state in agent APIs

* fix: handle **kwargs in stream_async.

* feat: add a unit test for the change

* Update src/strands/agent/agent.py

Co-authored-by: Nick Clegg <[email protected]>

* tool - executors - concurrent - remove no-op gather (#954)

* feat(telemetry): updated traces to match OTEL v1.37 semantic conventions (#952)

* event loop - handle model execution (#958)

* feat: implement concurrent message reading for session managers (#897)

Replace sequential message loading with async concurrent reading in both
S3SessionManager and FileSessionManager to improve performance for long
conversations. Uses asyncio.gather() with run_in_executor() to read
multiple messages simultaneously while maintaining proper ordering.

Resolves: #874

Co-authored-by: Vamil Gandhi <[email protected]>

* hooks - before tool call event - cancel tool (#964)

* fix(telemetry): removed double serialization for events (#977)

* fix(litellm): map LiteLLM context-window errors to ContextWindowOverflowException (#994)

* feat: add more tests and adjust invocation_state dic structure

* Apply suggestion from @Unshure

Co-authored-by: Nick Clegg <[email protected]>

* fix: adjust **kwargs in multiagent primitives

---------

Co-authored-by: Nick Clegg <[email protected]>
Co-authored-by: Patrick Gray <[email protected]>
Co-authored-by: poshinchen <[email protected]>
Co-authored-by: Vamil Gandhi <[email protected]>
Co-authored-by: Vamil Gandhi <[email protected]>
Co-authored-by: ratish <[email protected]>
…s into spans and metrics (#997)

* feat(telemetry): added timeToFirstByteMs into spans and metrics

* chore(trace): updated semantic conventions with tool mappings
When add_note is not available (3.10) enhance the default error message with the added notes.

In PR #290 we started using add_note to provide the bedrock model and region in exceptions to better clarify to customers what model & region were active.  The implementation used add_note which is only supported in 3.11+; however, we've had enough customers on 3.10 where they're not seeing the error message that it makes sense to add a shim to do something similar for 3.10.

---------

Co-authored-by: Mackenzie Zastrow <[email protected]>
@codecov-commenter
Copy link

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

ℹ️ You can also turn on project coverage checks and project coverage reporting on Pull Request comment

Thanks for integrating Codecov - We've got you covered ☂️

…#935)

* feat: add experimental AgentConfig with comprehensive tool management

- Add AgentConfig class for declarative agent configuration via JSON/dict
- Support file:// prefix for loading configurations from JSON files
- Implement ToolRegistry integration with automatic default tool loading
- Add raise_exception_on_missing_tool parameter for flexible error handling
- Support tool selection from registry via tool names in config
- Add comprehensive test coverage for all configuration scenarios
- Move hook events from experimental to production with updated names
- Add OpenAI model provider enhancements and Gemini model improvements
- Update event loop and tool executors to use production hook events

🤖 Assisted by Amazon Q Developer

* fix: remove AgentConfig import from experimental/__init__.py

- Reset experimental/__init__.py to not import AgentConfig by default
- This may resolve import issues in CI environments
- AgentConfig can still be imported directly from strands.experimental.agent_config

🤖 Assisted by Amazon Q Developer

* fix: remove strands-agents-tools test dependency

- Reset pyproject.toml to not include strands-agents-tools as test dependency
- Tests handle missing strands_tools gracefully with mocking
- This should resolve CI dependency issues

🤖 Assisted by Amazon Q Developer

* test: remove test that depends on strands_tools availability

- Remove test_agent_config_loads_from_default_tools_without_tool_registry
- This test assumes strands_tools is available which causes CI failures
- Other tests adequately cover AgentConfig functionality

🤖 Assisted by Amazon Q Developer

* test: add back tests with proper mocking for strands_tools

- Add back test_agent_config_tools_without_tool_registry_error with mocking
- Add back test_agent_config_loads_from_default_tools_without_tool_registry with mocking
- Mock _create_default_tool_registry to avoid dependency on strands_tools
- Add tool import for creating mock tools in tests
- All 15 tests now pass without external dependencies

🤖 Assisted by Amazon Q Developer

* test: fix Windows compatibility for file prefix test

- Use platform-specific tempfile handling in test_agent_config_file_prefix_valid
- Use mkstemp() with explicit cleanup on Windows for better permission handling
- Keep NamedTemporaryFile on non-Windows platforms for simplicity
- Should resolve permission errors on Windows GitHub runners

🤖 Assisted by Amazon Q Developer

* refactor: replace AgentConfig class with config_to_agent function

BREAKING CHANGE: Replace class-based AgentConfig with function-based config_to_agent

- Replace AgentConfig class with config_to_agent function for simpler interface
- Remove ToolRegistry dependency - let Agent handle tool loading internally
- Remove DEFAULT_TOOLS concept and raise_exception_on_missing_tool parameter
- Support both file paths and dictionary inputs with file:// prefix handling
- Only pass non-None config values to Agent constructor (use Agent defaults)
- Update experimental module exports to expose config_to_agent function
- Rewrite all tests to use new function-based interface
- Simplify tool handling by delegating to Agent class

New interface:
  from strands.experimental import config_to_agent
  agent = config_to_agent('/path/to/config.json')

Previous interface (removed):
  from strands.experimental.agent_config import AgentConfig
  config = AgentConfig('/path/to/config.json')
  agent = config.to_agent()

🤖 Assisted by Amazon Q Developer

* feat: limit config_to_agent to core configuration keys

- Remove support for advanced Agent parameters in config_to_agent
- Only support: model, prompt, tools, name in configuration
- Advanced parameters can still be passed via kwargs
- Remove agent_id test and update function mapping
- Keep interface simple and focused on basic agent configuration

🤖 Assisted by Amazon Q Developer

* fix: use native Python typing instead of typing module

- Replace Union[str, Dict[str, Any]] with str | dict[str, any]
- Remove typing module imports
- Use modern Python 3.10+ native typing syntax

🤖 Assisted by Amazon Q Developer

* test: simplify file prefix test with proper context manager

- Use NamedTemporaryFile with delete=True for automatic cleanup
- Remove manual os.unlink call and try/finally block
- Keep file operation within single context manager scope
- Add f.flush() to ensure data is written before reading

🤖 Assisted by Amazon Q Developer

* feat: add JSON schema validation to config_to_agent

- Add jsonschema dependency for configuration validation
- Implement JSON schema based on supported configuration keys
- Provide detailed validation error messages with field paths
- Add validation tests for invalid fields, types, and tool items
- Support null values for optional fields (model, prompt, name)
- Reject additional properties not in the schema
- All 14 tests passing including new validation tests

🤖 Assisted by Amazon Q Developer

* refactor: move JSON schema to separate file

- Extract agent configuration schema to schemas/agent-config-v1.json
- Add _load_schema() function to load schema from file at runtime
- Improve code readability by separating schema from Python logic
- Enable schema reuse by other tools and documentation
- Maintain all existing validation functionality and tests

🤖 Assisted by Amazon Q Developer

* perf: use pre-compiled JSON schema validator

- Create Draft7Validator instance at module level for better performance
- Avoid loading and compiling schema on every validation call
- Schema is loaded once at import time and validator is reused
- Maintains all existing validation functionality and error messages
- Standard best practice for jsonschema validation performance

🤖 Assisted by Amazon Q Developer

* feat: add tool validation and clarify limitations

- Move JSON schema back to inline variable for simplicity
- Add comprehensive tool validation with helpful error messages
- Validate tools can be loaded as files, modules, or @tool functions
- Add clear documentation about code-based instantiation limitations
- Update module docstring and function comments with usage patterns
- Add test for tool validation error messages
- Remove schemas directory (no longer needed)

🤖 Assisted by Amazon Q Developer

* fix: improve tool validation error messages and add comprehensive tests

- Fix error message for missing modules to be more descriptive
- Remove redundant 'to properly import this tool' text from error messages
- Add specific error messages for missing modules vs missing functions
- Add unit tests for each error case:
  - Invalid tool (not file/module/@tool)
  - Missing module (module doesn't exist)
  - Missing function (function not found in existing module)
- All 17 tests passing with better error coverage

🤖 Assisted by Amazon Q Developer

* fix: reference module instead of tool in error message

- Change error message from 'Tool X not found' to 'Module X not found'
- More accurate since we're trying to import it as a module at this point
- Maintains existing test compatibility and error handling logic

🤖 Assisted by Amazon Q Developer

* revert: change error message back to reference tool

- Revert previous change from 'Module X not found' back to 'Tool X not found'
- Keep original error message format as requested

🤖 Assisted by Amazon Q Developer

* feat: use agent tool loading logic

* fix: address pr comments

---------

Co-authored-by: Matt Lee <[email protected]>
Co-authored-by: Nicholas Clegg <[email protected]>
…Kind (#1055)

* fix(telemetry): make strands agent invoke_agent and chat span as INTERNAL spanKind
…ultiagent base & agent result (#1070)

* feat: add multiagent hooks, add serialize & deserialize function to multiagent base & agent result

* Delete __init__.py
feat: Add Structured Output as part of the agent loop (#943)

Add comprehensive structured output functionality allowing agents to return
Pydantic models in the AgentResult. Includes support for validation,
retry logic, streaming, and async operations.

- Add structured_output_model parameter to Agent constructor and invocation methods
- Implement StructuredOutputTool for handling Pydantic model validation
- Add structured output context management and retry mechanisms
- Extend event system with StructuredOutputEvent and reasoning events
- Add structured_output field to AgentResult for accessing parsed models
- Support structured output in streaming and async operations
- Add comprehensive test coverage for all structured output scenarios
- Add integration tests for real-world usage patterns
Partial fix to #1069 - previously the agent would prematurely exit if the agent generated a tool with an invalid name; this avoids that by ensuring the agent loop continues with zero tool-uses.

---------

Co-authored-by: Mackenzie Zastrow <[email protected]>
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.