We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent cec3a9a commit 4b229d1Copy full SHA for 4b229d1
examples/basic/lifecycle_example.py
@@ -88,11 +88,16 @@ class FinalResult(BaseModel):
88
89
async def main() -> None:
90
user_input = input("Enter a max number: ")
91
- await Runner.run(
92
- start_agent,
93
- hooks=hooks,
94
- input=f"Generate a random number between 0 and {user_input}.",
95
- )
+ try:
+ max_number = int(user_input)
+ await Runner.run(
+ start_agent,
+ hooks=hooks,
96
+ input=f"Generate a random number between 0 and {max_number}.",
97
+ )
98
+ except ValueError:
99
+ print("Please enter a valid integer.")
100
+ return
101
102
print("Done!")
103
0 commit comments