File tree Expand file tree Collapse file tree 6 files changed +36
-1
lines changed Expand file tree Collapse file tree 6 files changed +36
-1
lines changed Original file line number Diff line number Diff line change 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
1414import json
Original file line number Diff line number Diff line change 1+ {
2+ "prompt" : " Hello!"
3+ }
Original file line number Diff line number Diff line change 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 ()
Original file line number Diff line number Diff line change 1+ from strands import tool
2+
3+
4+ @tool
5+ def say (input : str ) -> str :
6+ """Say the input"""
7+ return f"Said: { input } "
Original file line number Diff line number Diff line change 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+ }
Original file line number Diff line number Diff line change 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 ()
You can’t perform that action at this time.
0 commit comments