You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
- Document current Agent(), Graph(), and Swarm() constructor modifications
- Detail config parameter integration approach before removal
- Highlight API fluidity advantages and developer experience benefits
- Preserve implementation approach for potential future use
- Focus on public interface rather than internal implementation details
Copy file name to clipboardExpand all lines: docs/experimental/config-loader/overview.md
+123Lines changed: 123 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -181,3 +181,126 @@ Loads and serializes Strands Graph instances via dictionary configurations. Supp
181
181
-`load_graph(config, cache_key=None)` - Load graph from dictionary configuration
182
182
-`serialize_graph(graph)` - Serialize graph to dictionary configuration
183
183
-`clear_cache()` - Clear internal graph cache
184
+
185
+
---
186
+
187
+
## Future: Constructor Integration
188
+
189
+
**Note**: This section documents a future enhancement that would integrate configuration loading directly into the main constructors for improved API fluidity and developer experience.
190
+
191
+
### Enhanced Constructor Interface
192
+
193
+
The future implementation would extend the main constructors (`Agent()`, `Graph()`, and `Swarm()`) with a `config` parameter, enabling seamless configuration-driven initialization alongside traditional programmatic instantiation.
194
+
195
+
#### Agent Constructor Enhancement
196
+
197
+
```python
198
+
from strands import Agent
199
+
200
+
# File-based configuration
201
+
agent = Agent(config="agent_config.yaml")
202
+
agent = Agent(config="agent_config.json")
203
+
204
+
# Dictionary-based configuration
205
+
agent = Agent(config={
206
+
"model": "us.amazon.nova-pro-v1:0",
207
+
"system_prompt": "You are a helpful assistant.",
208
+
"tools": [{"name": "calculator"}]
209
+
})
210
+
211
+
# Hybrid approach - config with parameter overrides
212
+
agent = Agent(
213
+
config="base_config.yaml",
214
+
model="us.amazon.nova-lite-v1:0", # Override config model
-**Better Maintainability**: Centralized configuration management separate from application logic
288
+
-**Version Control Friendly**: Configuration changes tracked separately from code changes
289
+
-**IDE Support**: Full IntelliSense and type checking for both config and parameter approaches
290
+
291
+
#### Backward Compatibility
292
+
-**Zero Breaking Changes**: Existing code continues to work unchanged
293
+
-**Gradual Adoption**: Teams can migrate to configuration-driven approach incrementally
294
+
-**Interoperability**: Mix and match approaches within the same application
295
+
296
+
### Implementation Benefits
297
+
298
+
The enhanced constructor approach provides superior API fluidity by:
299
+
300
+
1.**Eliminating Context Switching**: Developers stay within familiar constructor patterns rather than learning separate loader classes
301
+
2.**Reducing Import Complexity**: No need to import and manage separate config loader classes
302
+
3.**Maintaining Type Safety**: Full type hints and validation for both configuration and parameter approaches
303
+
4.**Enabling Hybrid Workflows**: Seamless combination of configuration defaults with runtime parameter overrides
304
+
5.**Preserving Existing Patterns**: All current usage patterns remain valid while adding new capabilities
305
+
306
+
This approach represents the natural evolution of the Strands Agents API, providing maximum flexibility while maintaining the simplicity and elegance that developers expect from the framework.
0 commit comments