You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
asyncfor chunk in analyze_call_feedback(feedback_input):
258
+
# Just get the output as it's generated
259
+
print(chunk.output)
260
+
```
261
+
262
+
> Note: no need to mark the agent as async here ! It is already asynchronous since it returns an AsyncIterator.
263
+
> The type checkers some times get confused since they consider that an async function that returns an AsyncIterator is
264
+
> async twice.
265
+
> For example, a function with the signature `async def foo() -> AsyncIterator[int]` may be called
266
+
> `async for c in await foo():...` in certain cases...
267
+
268
+
269
+
#### Streaming the run object
270
+
271
+
Use `AsyncIterator[Run[Output]]` to get the **run** object as it is generated, which allows you, for the **last chunk**, to access the cost and duration of the run.
272
+
273
+
```python
274
+
import workflowai
275
+
from workflowai import Run
276
+
from collections.abc import AsyncIterator
277
+
250
278
# Stream the run object, the output is filled as it is generated
0 commit comments