Skip to content

Commit 013f272

Browse files
committed
Address PR feedback
1 parent d33740e commit 013f272

File tree

2 files changed

+25
-38
lines changed

2 files changed

+25
-38
lines changed

samples-v2/openai_agents/docs/getting-started.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ def main():
126126
return result.final_output
127127
```
128128

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.
130130

131131
## Execution and Monitoring
132132

samples-v2/openai_agents/docs/reference.md

Lines changed: 24 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ Complete reference for Durable OpenAI Agents integration.
44

55
## Durable Orchestration
66

7-
### @durable_openai_agent_orchestrator
7+
### @app.durable_openai_agent_orchestrator
88

99
Primary decorator enabling durable execution for agent invocations.
1010

1111
```python
1212
from azure.durable_functions.openai_agents import durable_openai_agent_orchestrator
1313

1414
@app.orchestration_trigger(context_name="context")
15-
@durable_openai_agent_orchestrator
15+
@app.durable_openai_agent_orchestrator
1616
def my_agent_orchestrator(context):
1717
# Agent implementation
1818
pass
@@ -31,11 +31,11 @@ def my_agent_orchestrator(context):
3131

3232
### @app.orchestration_trigger
3333

34-
Azure Functions orchestration trigger decorator. Required with `@durable_openai_agent_orchestrator`.
34+
Azure Functions orchestration trigger decorator. Required with `@app.durable_openai_agent_orchestrator`.
3535

3636
```python
3737
@app.orchestration_trigger(context_name="context")
38-
@durable_openai_agent_orchestrator
38+
@app.durable_openai_agent_orchestrator
3939
def my_orchestrator(context):
4040
# ...
4141
```
@@ -63,30 +63,9 @@ def my_orchestrator(context):
6363

6464
## Tools
6565

66-
### Open AI Function Tools
67-
68-
Simple, deterministic tools that execute within the orchestration context.
69-
70-
```python
71-
from agents import function_tool
72-
73-
@function_tool
74-
def calculate(expression: str) -> str:
75-
"""Calculate mathematical expressions."""
76-
return str(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-
8766
### Durable Functions Activity Tools
8867

89-
Durable Function Activities that execute as durable tool invocations for 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**
9069

9170
```python
9271
# 1. Define activity function
@@ -97,7 +76,7 @@ async def my_activity(input_param):
9776

9877
# 2. Use in orchestrator
9978
@app.orchestration_trigger(context_name="context")
100-
@durable_openai_agent_orchestrator
79+
@app.durable_openai_agent_orchestrator
10180
def my_orchestrator(context):
10281
agent = Agent(
10382
tools=[context.create_activity_tool(my_activity)]
@@ -111,18 +90,26 @@ def my_orchestrator(context):
11190

11291
**Best For**: External API calls, database operations, file I/O, expensive computations, non-deterministic operations
11392

114-
### Tool Selection Guide
93+
### Open AI Function Tools
94+
95+
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+
def calculate(expression: str) -> str:
102+
"""Calculate mathematical expressions."""
103+
return str(eval(expression))
104+
```
115105

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
120111

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
126113

127114
### Current Limitations
128115

0 commit comments

Comments
 (0)