Skip to content

Commit 97abdb5

Browse files
committed
fix: address pr comments
1 parent 9f33f62 commit 97abdb5

File tree

6 files changed

+36
-1
lines changed

6 files changed

+36
-1
lines changed

src/strands/experimental/agent_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
99
agent = config_to_agent("config.json")
1010
# Add tools that need code-based instantiation
11-
agent.process_tools([ToolWithConfigArg(HttpsConnection("localhost"))])
11+
agent.tool_registry.process_tools([ToolWithConfigArg(HttpsConnection("localhost"))])
1212
"""
1313

1414
import json

test.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"prompt": "Hello!"
3+
}

test.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
from strands.experimental.agent_config import config_to_agent
2+
3+
agent = config_to_agent("test.json")
4+
5+
print(agent.system_prompt)
6+
agent.tool_registry.process_tools()

tests_integ/fixtures/say_tool.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
from strands import tool
2+
3+
4+
@tool
5+
def say(input: str) -> str:
6+
"""Say the input"""
7+
return f"Said: {input}"
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"model": "global.anthropic.claude-sonnet-4-5-20250929-v1:0",
3+
"tools": ["tests_integ.fixtures.say_tool:say"],
4+
"prompt": "You use the say tool to communicate",
5+
"name": "Sayer"
6+
}

tests_integ/test_agent_json.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
from strands.experimental import config_to_agent
2+
3+
4+
def test_load_agent_from_config():
5+
agent = config_to_agent("file://tests_integ/fixtures/test_agent.json")
6+
7+
result = agent("Say hello")
8+
9+
assert "Sayer" == agent.name
10+
assert "You use the say tool to communicate" == agent.system_prompt
11+
assert agent.tool_names[0] == "say"
12+
assert agent.model.get_config().get("model_id") == "global.anthropic.claude-sonnet-4-5-20250929-v1:0"
13+
assert "hello" in str(result).lower()

0 commit comments

Comments
 (0)