-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun_sync.py
More file actions
42 lines (30 loc) · 944 Bytes
/
run_sync.py
File metadata and controls
42 lines (30 loc) · 944 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#!/usr/bin/env python3
"""
Run Sync Example
This example demonstrates synchronous agent execution.
"""
import os
from roe import RoeClient
AGENT_ID = os.getenv("AGENT_ID", "your-agent-uuid-here")
def main():
client = RoeClient()
# Run synchronously - blocks until complete
outputs = client.agents.run_sync(
agent_id=AGENT_ID,
text="Analyze this text for sentiment and key topics.",
)
print("Results:")
for output in outputs:
print(f"{output.key}: {output.value}")
# Run a specific version synchronously
VERSION_ID = os.getenv("VERSION_ID", "your-version-uuid-here")
outputs = client.agents.run_version_sync(
agent_id=AGENT_ID,
version_id=VERSION_ID,
text="Process with specific version.",
)
print("\nVersion-specific results:")
for output in outputs:
print(f"{output.key}: {output.value}")
if __name__ == "__main__":
main()