MCPcopy
hub / github.com/simstudioai/sim / statusExample

Function statusExample

packages/ts-sdk/examples/basic-usage.ts:71–107  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

69
70// Example 3: Workflow validation and status checking
71async function statusExample() {
72 const client = new SimStudioClient({
73 apiKey: process.env.SIM_API_KEY!,
74 })
75
76 try {
77 // Check if workflow is ready
78 const isReady = await client.validateWorkflow('your-workflow-id')
79 console.log('Workflow ready:', isReady)
80
81 // Get detailed status
82 const status = await client.getWorkflowStatus('your-workflow-id')
83 console.log('Status:', {
84 deployed: status.isDeployed,
85 needsRedeployment: status.needsRedeployment,
86 deployedAt: status.deployedAt,
87 })
88
89 if (status.isDeployed) {
90 // Execute the workflow
91 const result = await client.executeWorkflow('your-workflow-id')
92
93 if (result.success) {
94 console.log('✅ Workflow executed successfully!')
95 console.log('Output:', result.output)
96 } else {
97 console.log('❌ Workflow failed:', result.error)
98 }
99 }
100 } catch (error) {
101 if (error instanceof SimStudioError) {
102 console.error('SDK Error:', error.message, 'Code:', error.code)
103 } else {
104 console.error('Unexpected error:', error)
105 }
106 }
107}
108
109// Example 4: Workflow execution with streaming
110async function streamingExample() {

Callers 1

runExamplesFunction · 0.85

Calls 5

validateWorkflowMethod · 0.95
getWorkflowStatusMethod · 0.95
executeWorkflowMethod · 0.95
logMethod · 0.80
errorMethod · 0.80

Tested by

no test coverage detected