MCPcopy Index your code
hub / github.com/simstudioai/sim / streaming_example

Function streaming_example

packages/python-sdk/examples/basic_usage.py:157–181  ·  view source on GitHub ↗

Example 6: Workflow execution with streaming

()

Source from the content-addressed store, hash-verified

155
156
157def streaming_example():
158 """Example 6: Workflow execution with streaming"""
159 client = SimStudioClient(api_key=os.getenv("SIM_API_KEY"))
160
161 try:
162 result = client.execute_workflow(
163 "your-workflow-id",
164 input_data={"message": "Count to five"},
165 stream=True,
166 selected_outputs=["agent1.content"], # Use blockName.attribute format
167 timeout=60.0
168 )
169
170 if result.success:
171 print("✅ Workflow executed successfully!")
172 print(f"Output: {result.output}")
173 if result.metadata:
174 print(f"Duration: {result.metadata.get('duration')} ms")
175 else:
176 print(f"❌ Workflow failed: {result.error}")
177
178 except SimStudioError as error:
179 print(f"SDK Error: {error} (Code: {error.code})")
180 except Exception as error:
181 print(f"Unexpected error: {error}")
182
183
184def error_handling_example():

Callers 1

basic_usage.pyFile · 0.85

Calls 3

execute_workflowMethod · 0.95
SimStudioClientClass · 0.90
getMethod · 0.65

Tested by

no test coverage detected