sdac-start-conversation
Purpose
Initializes a new conversation session for SDAC cost report analysis by creating an initial system turn in SDAC.fact_ConversationHistory. If a valid (non-expired) conversation already exists for the given sessionId, it returns the existing session rather than creating a duplicate.
Tool type
Deterministic (write / idempotent)
Tool ID
sdac-start-conversation
Inputs
reportId(string, required, UUID) -- Cost report IDuserId(string, required) -- User identifier from authenticationsessionId(string, required) -- Browser session ID (UUID recommended)
Outputs
conversationId(string) -- Session ID to use for all subsequent session tool callscreatedAt(string) -- ISO 8601 timestamp of when this call ranisNew(boolean) -- True if a new conversation was created, false if resuming an existing one
Example output
{
"conversationId": "conv-7f2c6e2b",
"createdAt": "2026-05-08T14:20:00.000Z",
"isNew": true
}
Functional details
- Checks whether a conversation already exists for
sessionIdbefore inserting. - New conversations receive a turn 0 system message:
"Conversation started for report {reportId}". - Conversations expire after 90 days; expired sessions are treated as non-existent and a new one is created.
Usage notes
- Call once at the start of each chat handler before calling
sdac-log-conversation-turn. - The returned
conversationIdis always equal to the inputsessionId-- it is the stable identifier for the session. - Use
isNewto decide whether to greet the user fresh or acknowledge a resumed session. - Part of the session management trio:
sdac-start-conversation→sdac-get-conversation-history→sdac-log-conversation-turn.
Implementation details
- Reads from and writes to
SDAC.fact_ConversationHistoryviaconversationExistsandinsertConversationTurnDB helpers.
Code Location: packages/domain-sdac/src/tools/session/start-conversation.tool.ts