Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/strands/agent/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
1 change: 1 addition & 0 deletions test_output.log
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/bin/sh: 1: hatch: not found
12 changes: 12 additions & 0 deletions tests/strands/agent/test_agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -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=<test-agent-123>" in record.message for record in caplog.records)
assert any("name=<TestAgent>" in record.message for record in caplog.records)
assert agent.agent_id == "test-agent-123"


def test_agent__call__(
mock_model,
system_prompt,
Expand Down