Skip to content

Commit 17eb501

Browse files
Copilotpranaygp
andcommitted
Update DurableAgent documentation with new properties
Add examples showing the new CallSettings properties (temperature, maxOutputTokens, topP, etc.) in the DurableAgent documentation. Co-authored-by: pranaygp <1797812+pranaygp@users.noreply.github.com>
1 parent e99d331 commit 17eb501

File tree

1 file changed

+48
-0
lines changed

1 file changed

+48
-0
lines changed

docs/content/docs/api-reference/workflow-ai/durable-agent.mdx

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ async function myAgent() {
2929
const agent = new DurableAgent({
3030
model: 'anthropic/claude-haiku-4.5',
3131
system: 'You are a helpful weather assistant.',
32+
temperature: 0.7, // Control output randomness
33+
maxOutputTokens: 1000, // Limit response length
3234
tools: {
3335
getWeather: {
3436
description: 'Get weather for a city',
@@ -177,6 +179,52 @@ async function multiToolAgentWorkflow(userQuery: string) {
177179
}
178180
```
179181

182+
### Advanced Configuration
183+
184+
```typescript
185+
import { DurableAgent } from '@workflow/ai/agent';
186+
import { z } from 'zod';
187+
188+
async function calculateResult({ formula }: { formula: string }) {
189+
"use step";
190+
// Perform calculation
191+
return "42";
192+
}
193+
194+
async function advancedAgentWorkflow(userQuery: string) {
195+
'use workflow';
196+
197+
const agent = new DurableAgent({
198+
model: 'anthropic/claude-haiku-4.5',
199+
system: 'You are a precise calculator assistant.',
200+
// Model behavior controls
201+
temperature: 0.3, // Lower temperature for more deterministic responses
202+
maxOutputTokens: 500, // Limit response length
203+
topP: 0.9, // Nucleus sampling for response variety
204+
presencePenalty: 0.2, // Reduce repetition
205+
frequencyPenalty: 0.2, // Reduce word repetition
206+
seed: 12345, // For reproducible results
207+
stopSequences: ['END'], // Stop generation at specific sequences
208+
tools: {
209+
calculateResult: {
210+
description: 'Calculate a mathematical result',
211+
inputSchema: z.object({ formula: z.string() }),
212+
execute: calculateResult,
213+
},
214+
},
215+
});
216+
217+
await agent.stream({
218+
messages: [
219+
{
220+
role: 'user',
221+
content: userQuery,
222+
},
223+
],
224+
});
225+
}
226+
```
227+
180228
### Tools with Workflow Library Features
181229

182230
```typescript

0 commit comments

Comments
 (0)