<@U07PFEYHY58> been thinking a lot about what you ...
# marvin-ai
j
@Constantin Teo been thinking a lot about what you were trying with streaming, and have been experimenting with the following order of operations: • instead of just emiting AgentMessage events (and deltas), also emit AgentContent and AgentTool events (and deltas) to allow more precise event filter • AgentTool events would only start to be emitted when we know the tool name and can load e.g. its metadata (so you can filter by system tool or whatever you want) • A new handler called a Queue handler that accepts an arbitrary true/false filter function that you can use to decide which events to put into a queue • New streaming methods (e.g.
controlflow.stream.run()
, names still tbd) that essentially create and iterate over queue handlers for you, so you get the exact same signature as cf.run() except the result is an interator over (delta, snapshot) pairs • If that all works out, we'd pick some sane set of default streaming behaviors and let you do
for delta, snapshot in cf.run(stream=True):
Should have bullets 1-4 in the next couple days for tire kicking
catjam 1
🙌 1
c
That sounds great, surely abstracts away most of the complexities and use cases. Let me know if I can help - if there's a public branch I'll surely take a look as it's going
👍 1
• A new handler called a Queue handler that accepts an arbitrary true/false filter function that you can use to decide which events to put into a queue @Jeremiah I don't wanna get too crazy on it but if you think a callback might be too naive especially for the asyncio traits, try looking into
asyncio.Condition
,what it can do ( as in stropping and waking up loops from hanging ) and if it fits the use case
j
Nice I'll check it out -- I was just trying to get a handler that had a "first class" iterator attached to it (there's already a callback handler that could be used to do this on an ad-hoc basis)
Still experimenting and will get something for feedback shortly
🙌 1
c
this component applies especially to the "wait until... [tool identified, etc]" use cases
👍 1
the most fun part of python tbh, enjoy it!