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
Copy file name to clipboardExpand all lines: samples-v2/openai_agents/docs/getting-started.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -126,7 +126,7 @@ def main():
126
126
return result.final_output
127
127
```
128
128
129
-
**Durable Transformation**: The `@durable_openai_agent_orchestrator` decorator in `function_app.py` wraps this agent execution within a Durable Functions orchestrator, providing agent state persisted at each LLM and tool interaction.
129
+
**Durable Transformation**: The `@app.durable_openai_agent_orchestrator` decorator in `function_app.py` wraps this agent execution within a Durable Functions orchestrator, providing agent state persisted at each LLM and tool interaction.
Simple, deterministic tools that execute within the orchestration context.
69
-
70
-
```python
71
-
from agents import function_tool
72
-
73
-
@function_tool
74
-
defcalculate(expression: str) -> str:
75
-
"""Calculate mathematical expressions."""
76
-
returnstr(eval(expression))
77
-
```
78
-
79
-
**Requirements**:
80
-
- Must be deterministic (same input → same output)
81
-
- Should be fast-executing
82
-
- No external API calls (use activity tools instead)
83
-
- Input/output must be JSON serializable
84
-
85
-
**Best For**: Calculations, data transformations, validation logic, quick lookups
86
-
87
66
### Durable Functions Activity Tools
88
67
89
-
Durable Function Activities that execute as durable tool invocationsfor complex operations.
68
+
Durable Function Activities that execute as durable tool invocations. **This is the recommended approach for most use cases** as it provides the strongest correctness guarantees. - **When in doubt - this is the safe choice**
Simple, deterministic tools that execute within the orchestration context. **Recommended only as a performance optimization when you're certain the tool meets all deterministic requirements.**
96
+
97
+
```python
98
+
from agents import function_tool
99
+
100
+
@function_tool
101
+
defcalculate(expression: str) -> str:
102
+
"""Calculate mathematical expressions."""
103
+
returnstr(eval(expression))
104
+
```
115
105
116
-
**Use Function Tools when**:
117
-
- Operations are deterministic and fast
118
-
- No external dependencies required
119
-
- Simple calculations or data transformations
106
+
**Requirements**:
107
+
- Must be deterministic (same input → same output)
108
+
- Should be fast-executing
109
+
- No external API calls (use activity tools instead)
110
+
- Input/output must be JSON serializable
120
111
121
-
**Use Activity Tools when**:
122
-
- Making external API calls or database queries
123
-
- Operations may fail and need retry logic
124
-
- Long-running or expensive computations
125
-
- Non-deterministic operations
112
+
**Best For**: Calculations, data transformations, validation logic, quick lookups
0 commit comments