Skip to main content
The session tools family contains a single tool — session_context — but it is the most important call in the entire workflow. It opens a traced research run, attaches the user’s question, and scopes every subsequent tool call the agent makes.

session_context

Open a traced research run and attach the user’s question. Every tool call after this one is recorded against the session and streamed live to the web UI via SSE.

Arguments

What it does

  1. Creates a new session row (or resumes an existing one) scoped to the caller’s tenant_id.
  2. Stores the prompt verbatim — this is the canonical record of what the human asked.
  3. Returns a session_id that the agent includes in every subsequent tool call (either explicitly or implicitly via the MCP session context).
  4. Begins streaming trace events to the web UI via SSE so the human can watch the research unfold live.

Why it’s always called first

No other tool can be called before session_context. The MCP server rejects calls that arrive without an active session — there is no unscoped execution path. This is enforced at the server, not just by the agent’s instructions.
Every Ithaca tool call is traced. Tracing requires a session to attach events to. Without session_context, there is no session, and the server returns an error:
This guarantee is what makes the web UI’s live trace and replay possible — there is never a tool call that happens “outside” a session.

Return value

session_context returns a session descriptor:

Example call

Example response

Resuming a session

Pass session_id to resume an existing session instead of creating a new one. This is useful when an agent is re-invoked to continue research from a previous turn:
The new prompt is appended to the session’s prompt history. The session’s status remains open and the trace stream continues from where it left off.
  • open — the session is active and accepting tool calls.
  • closed — the agent called session_close (or the session timed out). No further tool calls are accepted. The trace is still readable and replayable from the web UI.
  • archived — the session has been moved to cold storage after the retention window. Metadata is still queryable; raw trace events may take longer to load.
The human can close a session from the web UI at any time. When a session is closed, in-flight tool calls are allowed to finish but no new ones are accepted.