Example 1: Basic workflow execution
()
| 8 | |
| 9 | |
| 10 | def basic_example(): |
| 11 | """Example 1: Basic workflow execution""" |
| 12 | client = SimStudioClient(api_key=os.getenv("SIM_API_KEY")) |
| 13 | |
| 14 | try: |
| 15 | # Execute a workflow without input |
| 16 | result = client.execute_workflow("your-workflow-id") |
| 17 | |
| 18 | if result.success: |
| 19 | print("✅ Workflow executed successfully!") |
| 20 | print(f"Output: {result.output}") |
| 21 | if result.metadata: |
| 22 | print(f"Duration: {result.metadata.get('duration')} ms") |
| 23 | else: |
| 24 | print(f"❌ Workflow failed: {result.error}") |
| 25 | |
| 26 | except SimStudioError as error: |
| 27 | print(f"SDK Error: {error} (Code: {error.code})") |
| 28 | except Exception as error: |
| 29 | print(f"Unexpected error: {error}") |
| 30 | |
| 31 | |
| 32 | def with_input_example(): |
no test coverage detected