Stream results and clean up
Read incremental agent results and release resources when a reader stops early.
Read results as they arrive
Stream when you want to show progress as the Agent works. The example prints one framework item and closes the stream early. Supply your model, tools, inputs and openeight_config. For Deep Agents, also supply your backend.
from openeight.langchain import create_agent
with create_agent(
model=model,
tools=tools,
openeight=openeight_config,
) as agent:
with agent.stream(inputs) as chunks:
for chunk in chunks:
print(chunk)
break # The stream closes before the agent context exits.When a reader disconnects
Close the iterator before leaving the Agent context so the SDK can finish work it has already accepted. A tool may have executed before the reader disconnected. Check the original attempt before retrying the action.
Tell us your framework and how your application handles disconnects or cancelled requests. We’ll help you choose the stream and shutdown boundaries. Keep credentials and private application data out of your message.
Email us at hello@openeight.ai.