LangSmith's built-in storage is fine for a demo, but paying them to hold your trace data long-term? That's a tax on your own data.
Exporting to your own Postgres is straightforward and cuts the vendor lock-in. You'll need a table. Here's the basic schema:
CREATE TABLE langsmith_traces (
id UUID PRIMARY KEY,
session_id UUID,
run_type TEXT,
name TEXT,
inputs JSONB,
outputs JSONB,
error TEXT,
start_time TIMESTAMPTZ,
end_time TIMESTAMPTZ,
metadata JSONB,
tags TEXT[]
);
Then, set up a callback handler. Use the LangSmith SDK to listen for run ends and batch insert. The key is to keep it async and handle failures gracefully—queue to a local log file if Postgres is down.
Your main cost now is a mid-tier Postgres instance, which is about 1/10th of scaling your LangSmith plan. Plus, you can actually query it properly.
CRM is a means, not an end.