From 6727834e7a28b38a4065d596690d93d13fdefaab Mon Sep 17 00:00:00 2001 From: Strands Agent <217235299+strands-agent@users.noreply.github.com> Date: Fri, 23 Jan 2026 19:47:08 +0000 Subject: [PATCH 1/2] feat(agent): add debug log message on agent initialization Add a debug log statement when an Agent is initialized to provide more debugging information. The log includes the agent_id and name following the structured logging format defined in AGENTS.md. --- src/strands/agent/agent.py | 2 ++ tests/strands/agent/test_agent.py | 12 ++++++++++++ 2 files changed, 14 insertions(+) diff --git a/src/strands/agent/agent.py b/src/strands/agent/agent.py index cacc69ece..dda0fba3a 100644 --- a/src/strands/agent/agent.py +++ b/src/strands/agent/agent.py @@ -278,6 +278,8 @@ def __init__( self.hooks.add_hook(hook) self.hooks.invoke_callbacks(AgentInitializedEvent(agent=self)) + logger.debug("agent_id=<%s>, name=<%s> | agent initialized", self.agent_id, self.name) + @property def system_prompt(self) -> str | None: """Get the system prompt as a string for backwards compatibility. diff --git a/tests/strands/agent/test_agent.py b/tests/strands/agent/test_agent.py index eb039185c..1bcc84912 100644 --- a/tests/strands/agent/test_agent.py +++ b/tests/strands/agent/test_agent.py @@ -288,6 +288,18 @@ def test_agent__init__invalid_id(agent_id): Agent(agent_id=agent_id) +def test_agent__init__logs_debug_message(mock_model, caplog): + import logging + + with caplog.at_level(logging.DEBUG, logger="strands.agent.agent"): + agent = Agent(model=mock_model, agent_id="test-agent-123", name="TestAgent") + + assert any("agent initialized" in record.message for record in caplog.records) + assert any("agent_id=" in record.message for record in caplog.records) + assert any("name=" in record.message for record in caplog.records) + assert agent.agent_id == "test-agent-123" + + def test_agent__call__( mock_model, system_prompt, From dbc24ac6dc4721902842804683d8e2fcdb5aea4d Mon Sep 17 00:00:00 2001 From: Strands Agent <217235299+strands-agent@users.noreply.github.com> Date: Fri, 23 Jan 2026 19:47:50 +0000 Subject: [PATCH 2/2] Additional changes from write operations --- test_output.log | 1 + 1 file changed, 1 insertion(+) create mode 100644 test_output.log diff --git a/test_output.log b/test_output.log new file mode 100644 index 000000000..726a4d159 --- /dev/null +++ b/test_output.log @@ -0,0 +1 @@ +/bin/sh: 1: hatch: not found