ADocumentation Index
Fetch the complete documentation index at: https://docs.vectorshift.ai/llms.txt
Use this file to discover all available pages before exploring further.
Session is a live, multi-turn handle over a conversational Agent or Chatbot. You send() messages and listen() for streamed events — message deltas, tool calls, tool results, approval requests, errors.
Prerequisites: Installed SDK · API key set · a saved conversational Agent or Chatbot.
Mental model
- Created via
agent.create_session()orchatbot.create_session(). Use as an async context manager — it cleans up the websocket on exit. send()posts a single user turn.send_many()batches multiple posts into one LLM turn.listen()yieldsSessionEventobjects in real time. Filter byevent_types=[...]if you only care about a subset.- A session is stateful on the server. You can disconnect and resume by
session_id.terminate()destroys it server-side.
Quick start
What events you get
session.listen() yields events of several types. The most common:
MESSAGE_DELTA— a streamed token chunk.MESSAGE_COMPLETE— the assistant turn finished.event.textholds the full reply.TOOL_CALL/TOOL_RESULT— the agent is invoking a tool and getting a result.APPROVAL_REQUEST— the agent is asking for human approval before calling a tool.ERROR— something went wrong. Inspectevent.data.
SessionEventType for the full list.
What’s next
Reference
Lifecycle, messaging, streaming, types.
Agent examples
Runnable session examples.
Errors
SessionDisconnectedError and how to handle reconnects.