-
Notifications
You must be signed in to change notification settings - Fork 0
How To Async and Streaming
Devrajsinh Gohil edited this page Aug 30, 2026
·
1 revision
AgentMesh natively supports asynchronous event loops and streaming interfaces.
ainvoke runs non-blocking on the running asyncio event loop:
import asyncio
import agentmesh_adapter
async def main():
app = agentmesh_adapter.compile(builder)
result = await app.ainvoke({"messages": []})
print("Async Result:", result)
asyncio.run(main())Consume state updates as streaming generators:
# Synchronous Stream
for state_chunk in app.stream({"query": "AI research"}):
print("State snapshot:", state_chunk)
# Asynchronous Stream
async def stream_workflow():
async for chunk in app.astream({"query": "AI research"}):
print("Async chunk:", chunk)
asyncio.run(stream_workflow())
```\nGetting Started
How-To Guides
- Compile a Graph
- Annotated Reducers
- Parallel Fanout
- Send() Map-Reduce
- Command() Routing
- Nested Subgraphs
- Async & Streaming
- Checkpointing & State
- Financial Swarm Example
Architecture
- System Overview
- C++ Engine Internals
- O(1) Scheduler
- Dual-Tier Graph
- Persistence & WAL
- Zero-Copy Pybind Bridge
- SOLID Design Principles
API Reference
Benchmarks
Contributing