Skip to content

Commit aa226a4

Browse files
committed
Add model override docs
1 parent 0559bc7 commit aa226a4

File tree

1 file changed

+41
-2
lines changed

1 file changed

+41
-2
lines changed

docs/user-guide/concepts/experimental/agent-config.md

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ agent = config_to_agent("file:///path/to/config.json")
6161

6262
### Supported Keys
6363

64-
- `model`: Model identifier (string) - see [model provider documentation](https://strandsagents.com/latest/user-guide/quickstart/#using-a-string-model-id)
64+
- `model`: Model identifier (string) - [[Only supports AWS Bedrock model provider string](../../../quickstart/#using-a-string-model-id)]
6565
- `prompt`: System prompt for the agent (string)
6666
- `tools`: List of tool specifications (list of strings)
6767
- `name`: Agent name (string)
@@ -100,12 +100,51 @@ The Agent class handles all tool loading internally, including:
100100
agent.process_tools([ToolWithConfigArg(http.client.HTTPSConnection("localhost"))])
101101
```
102102

103+
### Model Configurations
104+
105+
The `model` property uses the [string based model id feature](../../../quickstart/#using-a-string-model-id). You can reference [AWS's Model Id's](https://docs.aws.amazon.com/bedrock/latest/userguide/inference-profiles-support.html) to identify a model id to use. If you want to use a different model provider, you can pass in a model as part of the `**kwargs` of the `config_to_agent` function:
106+
107+
```python
108+
from strands.experimental import config_to_agent
109+
from strands.models.openai import OpenAIModel
110+
111+
# Create agent from dictionary
112+
agent = config_to_agent(
113+
config={"name": "Data Analyst"},
114+
model=OpenAIModel(
115+
client_args={
116+
"api_key": "<KEY>",
117+
},
118+
model_id="gpt-4o",
119+
)
120+
)
121+
```
122+
123+
Additionally, you can override the `agent.model` attribute of an agent to configure a new model provider:
124+
125+
```python
126+
from strands.experimental import config_to_agent
127+
from strands.models.openai import OpenAIModel
128+
129+
# Create agent from dictionary
130+
agent = config_to_agent(
131+
config={"name": "Data Analyst"}
132+
)
133+
134+
agent.model = OpenAIModel(
135+
client_args={
136+
"api_key": "<KEY>",
137+
},
138+
model_id="gpt-4o",
139+
)
140+
```
141+
103142
## Function Parameters
104143

105144
The `config_to_agent` function accepts:
106145

107146
- `config`: Either a file path (string) or configuration dictionary
108-
- `**kwargs`: Additional [Agent constructor parameters](https://strandsagents.com/latest/api-reference/agent/#strands.agent.agent.Agent.__init__) that override config values
147+
- `**kwargs`: Additional [Agent constructor parameters](../../../../api-reference/agent/#strands.agent.agent.Agent.__init__) that override config values
109148

110149
```python
111150
# Override config values with valid Agent parameters

0 commit comments

Comments
 (0)