Skip to content

Commit 21cacb2

Browse files
update
1 parent fbddcb4 commit 21cacb2

File tree

6 files changed

+17
-6
lines changed

6 files changed

+17
-6
lines changed

examples/exceptions/agents_exception.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
from __future__ import annotations
22

33
import asyncio
4+
45
from agents import Agent, Runner, function_tool
56
from agents.exceptions import AgentsException
67

7-
88
"""
99
This example demonstrates the use of the OpenAI Agents SDK with tools and comprehensive error handling.
1010

examples/exceptions/input_guardrail_tripwire_triggered.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
from __future__ import annotations
2+
23
import asyncio
4+
35
from pydantic import BaseModel
6+
47
from agents import (
58
Agent,
69
GuardrailFunctionOutput,

examples/exceptions/max_turns_exceeded.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
from __future__ import annotations
2+
23
import asyncio
4+
35
from agents import Agent, Runner, function_tool
46
from agents.exceptions import MaxTurnsExceeded
57

@@ -34,7 +36,7 @@ async def main():
3436
print(result.final_output)
3537
except MaxTurnsExceeded as e:
3638
print(f"Caught MaxTurnsExceeded: {e}")
37-
39+
3840

3941

4042
if __name__ == "__main__":

examples/exceptions/model_behavior_error.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
from __future__ import annotations
2+
23
import asyncio
3-
from pydantic import BaseModel
44
from typing import Literal
5+
6+
from pydantic import BaseModel
7+
58
from agents import Agent, Runner
69
from agents.exceptions import ModelBehaviorError
710

examples/exceptions/output_guardrail_tripwire_triggered.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
from __future__ import annotations
2+
23
import asyncio
4+
35
from pydantic import BaseModel
6+
47
from agents import (
58
Agent,
69
GuardrailFunctionOutput,
@@ -9,7 +12,6 @@
912
output_guardrail,
1013
)
1114

12-
1315
"""
1416
This example demonstrates an OpenAI Agents SDK agent with an output guardrail to block math homework responses.
1517

examples/exceptions/user_error.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
from __future__ import annotations
2+
23
import asyncio
4+
35
from agents import Agent, Runner, function_tool
46
from agents.exceptions import UserError
57

6-
78
"""
89
This example demonstrates an OpenAI Agents SDK agent that triggers a UserError due to incorrect SDK usage.
910
@@ -32,4 +33,4 @@ async def main():
3233

3334

3435
if __name__ == "__main__":
35-
asyncio.run(main())
36+
asyncio.run(main())

0 commit comments

Comments
 (0)