Maxim Logo
How toLog your application

Log multi-turn interactions as a session

Learn how to group related traces into sessions to track complete user interactions with your GenAI system.

Sessions are particularly useful for tracking multi-turn conversations or complex workflows that span multiple API calls or user interactions. Maintain context across multiple traces, analyze user behavior, and debug multi-interaction issues with sessions. Track the full lifecycle of user engagement by organizing traces into sessions.

Create a new session

const session = logger.session({
    id: "session-id",
    name: "session-name",
});

Add a trace to the session

After creating a session object, you can add multiple traces across the lifecycle of the conversation.

const trace = session.trace({
    id: "trace-id",
    name: "trace-name",
});

Linking traces using session IDs

const trace = logger.trace({
    id: "trace-id",
    name: "trace-name",
    sessionId: "session-id",
});

On this page