Session Management#
LIT manages sessions programmatically — context is structured, queryable, and controllable, not a fragile conversation thread you have to manage manually.
What Is a Session?#
A session is a bounded conversation with an LLM: a start point, a message thread, a model configuration, and an end point. Sessions are first-class objects in LIT — they have IDs, timestamps, and are stored persistently.
Unlike most AI tools where a "conversation" is an opaque browser tab, LIT sessions are structured data you can read, analyze, and act on programmatically.
Programmatic Session Control#
from lit import Session
# Start a new session with explicit configuration
session = Session.create(
channel="volatility-model",
model="claude-opus-4-6",
system_prompt="You are a deep learning research assistant...",
)
# Send a message and get a response
response = session.send("What architectures haven't we tried yet?")
# Session is automatically persisted — pick it up later
session_id = session.id
Context Management#
Sessions handle context automatically. As conversations grow, LIT manages the context window — summarizing prior history, preserving critical artifacts, and ensuring the model always has the most relevant context without blowing the token limit.
Unlike manual session management (copy-pasting summaries, starting new chats), LIT's context management is deterministic and auditable.
Safe Mode#
In safe mode, an agent pauses before any state-modifying action and requests human confirmation. The pause is logged, the confirmation is logged, and the subsequent action is logged. Safe mode is appropriate when:
- Agents have access to production systems
- Actions are hard to reverse (deleting data, sending external API calls)
- You want a human in the loop for a specific workflow
Safe mode can be set at the session level, the channel level, or the agent configuration level.
Session History#
Every channel maintains a full session history. You can browse prior sessions, search across them, and see exactly how a project evolved over time. This is the "context that compounds" — a new collaborator (human or AI) can onboard by reading the channel history.
Related#
- Audit Log & Transcripts — the full record of what happened in each session
- Channels & DM — how sessions relate to persistent channels