Skip to content

Commit e55788f

Browse files
committed
feat: enhance config loader overview with supported formats
- Add comprehensive introduction explaining configuration loading benefits - Document native support for Python Dict, JSON, and YAML formats - Include practical examples for each format type - Add quick start examples for agent and swarm configurations - Show migration path from programmatic to configuration-driven approach - Maintain original feature specification for reference
1 parent f297041 commit e55788f

File tree

1 file changed

+163
-0
lines changed

1 file changed

+163
-0
lines changed

docs/experimental/config-loader/overview.md

Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,166 @@
1+
# Configuration Loaders Overview
2+
3+
## Introduction
4+
5+
Configuration loaders enable declarative, configuration-driven definition of agents, tools, swarms, and graphs. This approach provides:
6+
7+
- **Version Control**: Track agent configurations alongside code
8+
- **Environment Management**: Different configs for dev/staging/production
9+
- **Team Collaboration**: Non-developers can modify agent behavior
10+
- **Reproducibility**: Consistent agent behavior across deployments
11+
12+
## Supported Configuration Formats
13+
14+
Configuration loaders natively support multiple input formats for maximum flexibility:
15+
16+
### 1. Python Dictionary
17+
Load configurations directly from Python dictionaries for programmatic use:
18+
19+
```python
20+
from strands import Agent
21+
22+
config = {
23+
"model": "us.amazon.nova-pro-v1:0",
24+
"system_prompt": "You are a helpful assistant.",
25+
"tools": [{"name": "calculator"}]
26+
}
27+
28+
agent = Agent(config=config)
29+
```
30+
31+
### 2. JSON Files
32+
Load configurations from JSON files for structured data storage:
33+
34+
```python
35+
# config.json
36+
{
37+
"model": "us.amazon.nova-pro-v1:0",
38+
"system_prompt": "You are a helpful assistant.",
39+
"tools": [{"name": "calculator"}]
40+
}
41+
```
42+
43+
```python
44+
from strands import Agent
45+
46+
agent = Agent(config="config.json")
47+
```
48+
49+
### 3. YAML Files
50+
Load configurations from YAML files for human-readable configuration:
51+
52+
```yaml
53+
# config.yml
54+
model: "us.amazon.nova-pro-v1:0"
55+
system_prompt: "You are a helpful assistant."
56+
tools:
57+
- name: "calculator"
58+
```
59+
60+
```python
61+
from strands import Agent
62+
63+
agent = Agent(config="config.yml")
64+
```
65+
66+
## Configuration Schema
67+
68+
All configuration loaders follow consistent patterns:
69+
- YAML-first design with JSON and dictionary support
70+
- Validation and error handling
71+
- Environment variable substitution
72+
- External file references
73+
- Caching and performance optimization
74+
75+
## Supported Configuration Types
76+
77+
### Agent Configuration
78+
Define individual agents with models, prompts, tools, and behavior settings.
79+
80+
### Tool Configuration
81+
Configure tools from Python functions, external modules, or MCP servers.
82+
83+
### Swarm Configuration
84+
Define multi-agent swarms with specialized roles and coordination patterns.
85+
86+
### Graph Configuration
87+
Create complex multi-agent workflows with conditional routing and dependencies.
88+
89+
## Quick Start Examples
90+
91+
### Basic Agent Configuration
92+
93+
```yaml
94+
# agent.yml
95+
model: "us.amazon.nova-pro-v1:0"
96+
system_prompt: "You are a helpful customer service agent."
97+
tools:
98+
- "strands_tools.calculator"
99+
- "strands_tools.web_search"
100+
```
101+
102+
```python
103+
from strands import Agent
104+
105+
# Load agent from YAML file
106+
agent = Agent(config='agent.yml')
107+
response = agent("Help me calculate my order total")
108+
```
109+
110+
### Multi-Agent Swarm Configuration
111+
112+
```yaml
113+
# swarm.yml
114+
max_handoffs: 20
115+
agents:
116+
- name: "research_agent"
117+
model: "us.amazon.nova-lite-v1:0"
118+
system_prompt: "You are a research specialist."
119+
- name: "creative_agent"
120+
model: "us.amazon.nova-lite-v1:0"
121+
system_prompt: "You are a creative solution generator."
122+
```
123+
124+
```python
125+
from strands.multiagent import Swarm
126+
127+
# Load swarm from YAML file
128+
swarm = Swarm(config='swarm.yml')
129+
result = swarm("Create a blog post about AI")
130+
```
131+
132+
## Migration from Programmatic Approach
133+
134+
### Before (Programmatic)
135+
```python
136+
from strands import Agent
137+
from strands_tools import calculator, web_search
138+
139+
agent = Agent(
140+
model="us.amazon.nova-pro-v1:0",
141+
system_prompt="You are a helpful assistant.",
142+
tools=[calculator, web_search]
143+
)
144+
```
145+
146+
### After (Configuration-Driven)
147+
```yaml
148+
# agent.yml
149+
model: "us.amazon.nova-pro-v1:0"
150+
system_prompt: "You are a helpful assistant."
151+
tools:
152+
- "strands_tools.calculator"
153+
- "strands_tools.web_search"
154+
```
155+
156+
```python
157+
from strands import Agent
158+
159+
agent = Agent(config='agent.yml')
160+
```
161+
162+
---
163+
1164
# FEATURE: Config Loaders
2165

3166
[FEATURE Load Agentic Configurations from a Dictionary \#606](https://github.com/strands-agents/sdk-python/issues/606)

0 commit comments

Comments
 (0)