Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.vectorshift.ai/llms.txt

Use this file to discover all available pages before exploring further.

Demonstrates resuming an existing session using just the session_id. No agent or chatbot object needed — just the session ID and a message.
import asyncio

from vectorshift.session import Session
from vectorshift.events import SessionEventType

SESSION_ID = "69de3cbd9b196c7bf0a75f20"


async def main() -> None:
    session = Session(session_id=SESSION_ID)
    async with session:
        print(f"Resumed session: {session.session_id}")

        await session.send("Pick up where we left off — what were we discussing?")

        async for event in session.listen(
            event_types=[
                SessionEventType.MESSAGE_DELTA,
                SessionEventType.MESSAGE_COMPLETE,
            ]
        ):
            if event.delta:
                print(event.delta, end="", flush=True)
            if event.is_complete:
                break

    print("\nDone.")


if __name__ == "__main__":
    asyncio.run(main())
Source: examples/agents/08_session_resume.py in the SDK repo.