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: docs/src/content/docs/guides/guardrails.mdx
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -19,8 +19,8 @@ There are two kinds of guardrails:
19
19
Input guardrails run in three steps:
20
20
21
21
1. The guardrail receives the same input passed to the agent.
22
-
2. The guardrail function executes and returns a [`GuardrailFunctionOutput`](/openai/agents/interfaces/guardrailfunctionoutput) wrapped inside an [`InputGuardrailResult`](/openai/agents/interfaces/inputguardrailresult).
23
-
3. If `tripwireTriggered` is `true`, an [`InputGuardrailTripwireTriggered`](/openai/agents/classes/inputguardrailtripwiretriggered) error is thrown.
22
+
2. The guardrail function executes and returns a [`GuardrailFunctionOutput`](/openai-agents-js/openai/agents/interfaces/guardrailfunctionoutput) wrapped inside an [`InputGuardrailResult`](/openai-agents-js/openai/agents/interfaces/inputguardrailresult).
23
+
3. If `tripwireTriggered` is `true`, an [`InputGuardrailTripwireTriggered`](/openai-agents-js/openai/agents/classes/inputguardrailtripwiretriggered) error is thrown.
24
24
25
25
> **Note**
26
26
> Input guardrails are intended for user input, so they only run if the agent is the _first_ agent in the workflow. Guardrails are configured on the agent itself because different agents often require different guardrails.
@@ -30,11 +30,11 @@ Input guardrails run in three steps:
30
30
Output guardrails follow the same pattern:
31
31
32
32
1. The guardrail receives the same input passed to the agent.
33
-
2. The guardrail function executes and returns a [`GuardrailFunctionOutput`](/openai/agents/interfaces/guardrailfunctionoutput) wrapped inside an [`OutputGuardrailResult`](/openai/agents/interfaces/outputguardrailresult).
34
-
3. If `tripwireTriggered` is `true`, an [`OutputGuardrailTripwireTriggered`](/openai/agents/classes/outputguardrailtripwiretriggered) error is thrown.
33
+
2. The guardrail function executes and returns a [`GuardrailFunctionOutput`](/openai-agents-js/openai/agents/interfaces/guardrailfunctionoutput) wrapped inside an [`OutputGuardrailResult`](/openai-agents-js/openai/agents/interfaces/outputguardrailresult).
34
+
3. If `tripwireTriggered` is `true`, an [`OutputGuardrailTripwireTriggered`](/openai-agents-js/openai/agents/classes/outputguardrailtripwiretriggered) error is thrown.
35
35
36
36
> **Note**
37
-
> Output guardrails only run if the agent is the _last_ agent in the workflow. For realtime voice interactions see [the voice agents guide](./voice-agents#guardrails).
37
+
> Output guardrails only run if the agent is the _last_ agent in the workflow. For realtime voice interactions see [the voice agents guide](/openai-agents-js/guides/voice-agents/build#guardrails).
Copy file name to clipboardExpand all lines: docs/src/content/docs/guides/human-in-the-loop.mdx
+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
@@ -29,7 +29,7 @@ You can define a tool that requires approval by setting the `needsApproval` opti
29
29
- If approval has not been granted or rejected, the tool will return a static message to the agent that the tool call cannot be executed.
30
30
- If approval / rejection is missing it will trigger a tool approval request.
31
31
3. The agent will gather all tool approval requests and interrupt the execution.
32
-
4. If there are any interruptions, the [result](/guides/result) will contain an `interruptions` array describing pending steps. A `ToolApprovalItem` with `type: "tool_approval_item"` appears when a tool call requires confirmation.
32
+
4. If there are any interruptions, the [result](/openai-agents-js/guides/result) will contain an `interruptions` array describing pending steps. A `ToolApprovalItem` with `type: "tool_approval_item"` appears when a tool call requires confirmation.
33
33
5. You can call `result.state.approve(interruption)` or `result.state.reject(interruption)` to approve or reject the tool call.
34
34
6. After handling all interruptions, you can resume execution by passing the `result.state` back into `runner.run(agent, state)` where `agent` is the original agent that triggered the overall run.
Copy file name to clipboardExpand all lines: docs/src/content/docs/guides/quickstart.mdx
+3-3Lines changed: 3 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -169,6 +169,6 @@ To review what happened during your agent run, navigate to the
169
169
170
170
Learn how to build more complex agentic flows:
171
171
172
-
- Learn about configuring [Agents](/guides/agents).
173
-
- Learn about [running agents](/guides/running-agents).
174
-
- Learn about [tools](/guides/tools), [guardrails](/guides/guardrails), and [models](/guides/models).
172
+
- Learn about configuring [Agents](/openai-agents-js/guides/agents).
173
+
- Learn about [running agents](/openai-agents-js/guides/running-agents).
174
+
- Learn about [tools](/openai-agents-js/guides/tools), [guardrails](/openai-agents-js/guides/guardrails), and [models](/openai-agents-js/guides/models).
When you [run your agent](/guides/running-agents), you will either receive a:
10
+
When you [run your agent](/openai-agents-js/guides/running-agents), you will either receive a:
11
11
12
-
-[`RunResult`](/openai/agents/classes/runresult) if you call `run` without `stream: true`
13
-
-[`StreamedRunResult`](/openai/agents/classes/streamedrunresult) if you call `run` with `stream: true`. For details on streaming, also check the [streaming guide](/guides/streaming).
12
+
-[`RunResult`](/openai-agents-js/openai/agents/classes/runresult) if you call `run` without `stream: true`
13
+
-[`StreamedRunResult`](/openai-agents-js/openai/agents/classes/streamedrunresult) if you call `run` with `stream: true`. For details on streaming, also check the [streaming guide](/openai-agents-js/guides/streaming).
14
14
15
15
## Final output
16
16
@@ -52,23 +52,23 @@ In streaming mode it can also be useful to access the `currentAgent` property th
52
52
53
53
## New items
54
54
55
-
The `newItems` property contains the new items generated during the run. The items are [`RunItem`](/openai/agents/type-aliases/runitem)s. A run item wraps the raw item generated by the LLM. These can be used to access additionally to the output of the LLM which agent these events were associated with.
55
+
The `newItems` property contains the new items generated during the run. The items are [`RunItem`](/openai-agents-js/openai/agents/type-aliases/runitem)s. A run item wraps the raw item generated by the LLM. These can be used to access additionally to the output of the LLM which agent these events were associated with.
56
56
57
-
-[`RunMessageOutputItem`](/openai/agents/classes/runmessageoutputitem) indicates a message from the LLM. The raw item is the message generated.
58
-
-[`RunHandoffCallItem`](/openai/agents/classes/runhandoffcallitem) indicates that the LLM called the handoff tool. The raw item is the tool call item from the LLM.
59
-
-[`RunHandoffOutputItem`](/openai/agents/classes/runhandoffoutputitem) indicates that a handoff occurred. The raw item is the tool response to the handoff tool call. You can also access the source/target agents from the item.
60
-
-[`RunToolCallItem`](/openai/agents/classes/runtoolcallitem) indicates that the LLM invoked a tool.
61
-
-[`RunToolCallOutputItem`](/openai/agents/classes/runtoolcalloutputitem) indicates that a tool was called. The raw item is the tool response. You can also access the tool output from the item.
62
-
-[`RunReasoningItem`](/openai/agents/classes/runreasoningitem) indicates a reasoning item from the LLM. The raw item is the reasoning generated.
63
-
-[`RunToolApprovalItem`](/openai/agents/classes/runtoolapprovalitem) indicates that the LLM requested approval for a tool call. The raw item is the tool call item from the LLM.
57
+
-[`RunMessageOutputItem`](/openai-agents-js/openai/agents/classes/runmessageoutputitem) indicates a message from the LLM. The raw item is the message generated.
58
+
-[`RunHandoffCallItem`](/openai-agents-js/openai/agents/classes/runhandoffcallitem) indicates that the LLM called the handoff tool. The raw item is the tool call item from the LLM.
59
+
-[`RunHandoffOutputItem`](/openai-agents-js/openai/agents/classes/runhandoffoutputitem) indicates that a handoff occurred. The raw item is the tool response to the handoff tool call. You can also access the source/target agents from the item.
60
+
-[`RunToolCallItem`](/openai-agents-js/openai/agents/classes/runtoolcallitem) indicates that the LLM invoked a tool.
61
+
-[`RunToolCallOutputItem`](/openai-agents-js/openai/agents/classes/runtoolcalloutputitem) indicates that a tool was called. The raw item is the tool response. You can also access the tool output from the item.
62
+
-[`RunReasoningItem`](/openai-agents-js/openai/agents/classes/runreasoningitem) indicates a reasoning item from the LLM. The raw item is the reasoning generated.
63
+
-[`RunToolApprovalItem`](/openai-agents-js/openai/agents/classes/runtoolapprovalitem) indicates that the LLM requested approval for a tool call. The raw item is the tool call item from the LLM.
64
64
65
65
## State
66
66
67
-
The `state` property contains the state of the run. Most of what is attached to the `result` is derived from the `state` but the `state` is serializable/deserializable and can also be used as input for a subsequent call to `run` in case you need to [recover from an error](/guides/running-agents#exceptions) or deal with an [`interruption`](#interruptions).
67
+
The `state` property contains the state of the run. Most of what is attached to the `result` is derived from the `state` but the `state` is serializable/deserializable and can also be used as input for a subsequent call to `run` in case you need to [recover from an error](/openai-agents-js/guides/running-agents#exceptions) or deal with an [`interruption`](#interruptions).
68
68
69
69
## Interruptions
70
70
71
-
If you are using `needsApproval` in your agent, your `run` might trigger some `interruptions` that you need to handle before continuing. In that case `interruptions` will be an array of `ToolApprovalItem`s that caused the interruption. Check out the [human-in-the-loop guide](/guides/human-in-the-loop) for more information on how to work with interruptions.
71
+
If you are using `needsApproval` in your agent, your `run` might trigger some `interruptions` that you need to handle before continuing. In that case `interruptions` will be an array of `ToolApprovalItem`s that caused the interruption. Check out the [human-in-the-loop guide](/openai-agents-js/guides/human-in-the-loop) for more information on how to work with interruptions.
0 commit comments