The LLM remembers nothing. That’s a feature — until you want it to.
hb.LLM stays stateless on purpose. Conversation history is just a message list you pass to chat or stream. When you need multi-turn chat without rebuilding that list every time, LLMSession holds the history and optional tools for you.
1. Motivation
You can manage history yourself when you only need one or two turns:2. Session Tools
LLMSession can hold session tools and use them on every turn. Tools follow the same tools=[...] contract as LLM.chat: Python callables, Tool, Toolkit, and schema dictionaries are accepted.
role="tool" result, and the final assistant response in messages. See Tool Use for the full executable-tool contract.
3. Session Lifecycle
LLMSession exposes small helpers for interactive workflows:
to_dict() and from_dict() return JSON-safe payloads with the same message-only contract.
Callers that already own history can mutate session.messages directly or pass that history to
stateless LLM.chat(...); the session does not expose role-specific append helpers.
4. CLI Interactive Sessions
Start a multi-turn CLI session with thechat preset:
>>> prompt. Slash commands:
Attach MCP tools at startup with repeated
--mcp values:
/mcp:
namespace.toolkit:version. Negative versions count back from latest: -1 is latest, -2 is second-most latest.
When a provider emits separate thinking content, the CLI session prints it inside <think> and </think> before the visible assistant text. Tool iterations print step-by-step with STEPS: 001 / 020, followed by tool calls and tool results.
5. Inspect Resolved State
Usespec when you need to see how a client resolved:
spec.to_dict() is a reconstructive envelope whose bindings may contain credentials. Do not log it. The print Apply profile returns the redacted inspection view.
Resolved specs also produce stable hash keys for deduplication and cache lookup:
client_key() includes only gateway client construction fields, so duplicate LLM instances can reuse the same in-memory OpenAI-compatible SDK client.
Summary
hb.LLMremains stateless;LLMSessionowns runtime message history.- Saved sessions contain messages, not live MCP Toolkit objects.
- Use the redacted
printApply profile for route inspection.

