Gen-AI Developer Classroom notes 11/Jun/2025

Streaming in langgraph

  • Refer Here for graph
  • Initially we have setup synchronous execution with invoke
  • Graph as streaming support with two methods
    • stream
    • astream
  • Refer Here for official docs
  • stream modes
    • updates: display only the updates
    • values: display all the values updated so far.

Async and Await in python

import asyncio

async def task1():
    print("Task 1 started")
    await asyncio.sleep(6)
    print("Task 1 finished")

async def task2():
    print("Task 2 started")
    await asyncio.sleep(3)
    print("Task 2 finished")

async def task3():
    print("Task 3 started")
    await asyncio.sleep(1)
    print("Task 3 finished")

async def main():
    await asyncio.gather(task1(), task2(), task3())  # Runs both tasks together

asyncio.run(main())

By continuous learner

enthusiastic technology learner

Leave a Reply

Discover more from Direct AI Powered By Quality Thought

Subscribe now to keep reading and get access to the full archive.

Continue reading