generated from amazon-archives/__template_Apache-2.0
-
Notifications
You must be signed in to change notification settings - Fork 450
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Checks
- I have updated to the lastest minor and patch version of Strands
- I have checked the documentation and this is not expected behavior
- I have searched ./issues and there are no duplicates of my issue
Strands Version
source
Python Version
3.13
Operating System
macOS
Installation Method
git clone
Steps to Reproduce
When we pass Agent instance to direct tool calls, tool executes successfully.
But after that
>>> from strands import Agent
>>> from strands_tools import slack
>>> agent = Agent(tools=[slack])
>>> agent.tool.slack(action="start_socket_mode", agent=agent)
As `installation_store` or `authorize` has been used, `token` (or SLACK_BOT_TOKEN env variable) will be ignored.
{'toolUseId': 'tooluse_slack_477600603', 'status': 'success', 'content': [{'text': '✅ Socket Mode connection established and ready to receive real-time events'}]}
>>> agent("list your tools")
Traceback (most recent call last):
File "<python-input-4>", line 1, in <module>
agent("list your tools")
~~~~~^^^^^^^^^^^^^^^^^^^
File "/Users/cagatay/report-agent/.venv/lib/python3.13/site-packages/strands/agent/agent.py", line 377, in __call__
return future.result()
~~~~~~~~~~~~~^^
File "/opt/homebrew/Cellar/[email protected]/3.13.5/Frameworks/Python.framework/Versions/3.13/lib/python3.13/concurrent/futures/_base.py", line 456, in result
return self.__get_result()
~~~~~~~~~~~~~~~~~^^
File "/opt/homebrew/Cellar/[email protected]/3.13.5/Frameworks/Python.framework/Versions/3.13/lib/python3.13/concurrent/futures/_base.py", line 401, in __get_result
raise self._exception
File "/opt/homebrew/Cellar/[email protected]/3.13.5/Frameworks/Python.framework/Versions/3.13/lib/python3.13/concurrent/futures/thread.py", line 59, in run
result = self.fn(*self.args, **self.kwargs)
File "/Users/cagatay/report-agent/.venv/lib/python3.13/site-packages/opentelemetry/instrumentation/threading/__init__.py", line 171, in wrapped_func
return original_func(*func_args, **func_kwargs)
File "/Users/cagatay/report-agent/.venv/lib/python3.13/site-packages/strands/agent/agent.py", line 373, in execute
return asyncio.run(self.invoke_async(prompt, **kwargs))
~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/[email protected]/3.13.5/Frameworks/Python.framework/Versions/3.13/lib/python3.13/asyncio/runners.py", line 195, in run
return runner.run(main)
~~~~~~~~~~^^^^^^
File "/opt/homebrew/Cellar/[email protected]/3.13.5/Frameworks/Python.framework/Versions/3.13/lib/python3.13/asyncio/runners.py", line 118, in run
return self._loop.run_until_complete(task)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^
File "/opt/homebrew/Cellar/[email protected]/3.13.5/Frameworks/Python.framework/Versions/3.13/lib/python3.13/asyncio/base_events.py", line 725, in run_until_complete
return future.result()
~~~~~~~~~~~~~^^
File "/Users/cagatay/report-agent/.venv/lib/python3.13/site-packages/strands/agent/agent.py", line 398, in invoke_async
async for event in events:
_ = event
File "/Users/cagatay/report-agent/.venv/lib/python3.13/site-packages/strands/agent/agent.py", line 508, in stream_async
async for event in events:
...<2 lines>...
yield event["callback"]
File "/Users/cagatay/report-agent/.venv/lib/python3.13/site-packages/strands/agent/agent.py", line 544, in _run_loop
async for event in events:
...<13 lines>...
yield event
File "/Users/cagatay/report-agent/.venv/lib/python3.13/site-packages/strands/agent/agent.py", line 583, in _execute_event_loop_cycle
async for event in events:
yield event
File "/Users/cagatay/report-agent/.venv/lib/python3.13/site-packages/strands/event_loop/event_loop.py", line 187, in event_loop_cycle
raise e
File "/Users/cagatay/report-agent/.venv/lib/python3.13/site-packages/strands/event_loop/event_loop.py", line 132, in event_loop_cycle
async for event in stream_messages(agent.model, agent.system_prompt, agent.messages, tool_specs):
...<6 lines>...
}
File "/Users/cagatay/report-agent/.venv/lib/python3.13/site-packages/strands/event_loop/streaming.py", line 318, in stream_messages
async for event in process_stream(chunks):
yield event
File "/Users/cagatay/report-agent/.venv/lib/python3.13/site-packages/strands/event_loop/streaming.py", line 273, in process_stream
async for chunk in chunks:
...<16 lines>...
handle_redact_content(chunk["redactContent"], state)
File "/Users/cagatay/report-agent/.venv/lib/python3.13/site-packages/strands/models/bedrock.py", line 350, in stream
await task
File "/opt/homebrew/Cellar/[email protected]/3.13.5/Frameworks/Python.framework/Versions/3.13/lib/python3.13/asyncio/threads.py", line 25, in to_thread
return await loop.run_in_executor(None, func_call)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/homebrew/Cellar/[email protected]/3.13.5/Frameworks/Python.framework/Versions/3.13/lib/python3.13/concurrent/futures/thread.py", line 59, in run
result = self.fn(*self.args, **self.kwargs)
File "/Users/cagatay/report-agent/.venv/lib/python3.13/site-packages/opentelemetry/instrumentation/threading/__init__.py", line 171, in wrapped_func
return original_func(*func_args, **func_kwargs)
File "/Users/cagatay/report-agent/.venv/lib/python3.13/site-packages/strands/models/bedrock.py", line 384, in _stream
response = self.client.converse_stream(**request)
File "/Users/cagatay/report-agent/.venv/lib/python3.13/site-packages/botocore/client.py", line 601, in _api_call
return self._make_api_call(operation_name, kwargs)
~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/cagatay/report-agent/.venv/lib/python3.13/site-packages/botocore/context.py", line 123, in wrapper
return func(*args, **kwargs)
File "/Users/cagatay/report-agent/.venv/lib/python3.13/site-packages/botocore/client.py", line 1031, in _make_api_call
request_dict = self._convert_to_request_dict(
api_params=api_params,
...<3 lines>...
headers=additional_headers,
)
File "/Users/cagatay/report-agent/.venv/lib/python3.13/site-packages/botocore/client.py", line 1098, in _convert_to_request_dict
request_dict = self._serializer.serialize_to_request(
api_params, operation_model
)
File "/Users/cagatay/report-agent/.venv/lib/python3.13/site-packages/botocore/validate.py", line 381, in serialize_to_request
raise ParamValidationError(report=report.generate_report())
botocore.exceptions.ParamValidationError: Parameter validation failed:
Invalid type for document parameter agent, value: <strands.agent.agent.Agent object at 0x1041d9a90>, type: <class 'strands.agent.agent.Agent'>, valid types: <class 'str'>, <class 'int'>, <class 'bool'>, <class 'float'>, <class 'list'>, <class 'dict'>
>>> >>> agent.messages
[{'role': 'user', 'content': [{'text': 'agent.tool.slack direct tool call.\nInput parameters: {"action": "start_socket_mode", "agent": "<<non-serializable: Agent>>"}\n'}]}, {'role': 'assistant', 'content': [{'toolUse': {'toolUseId': 'tooluse_slack_477600603', 'name': 'slack', 'input': {'action': 'start_socket_mode', 'agent': <strands.agent.agent.Agent object at 0x1041d9a90>}}}]}, {'role': 'user', 'content': [{'toolResult': {'toolUseId': 'tooluse_slack_477600603', 'status': 'success', 'content': [{'text': '✅ Socket Mode connection established and ready to receive real-time events'}]}}]}, {'role': 'assistant', 'content': [{'text': 'agent.tool.slack was called.'}]}, {'role': 'user', 'content': [{'text': 'list your tools'}]}]
From agent.messages we can see that toolUse block have Agent object reference which breaks JSON parsing.
Expected Behavior
Replace / remove non-serializable parameter of agent from toolUse block and continue inference.
Actual Behavior
Crash because of reference.
Additional Context
No response
Possible Solution
No response
Related Issues
No response
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working