Skip to main content
Glama
checkpointer.ts933 B
import { PostgresSaver } from '@langchain/langgraph-checkpoint-postgres'; import { LanggraphDatabase } from '@snakagent/database'; import { GraphError } from '../../utils/error.utils.js'; export class CheckpointerService { private static instance: PostgresSaver | undefined; private static initializing?: Promise<PostgresSaver>; static async getInstance(): Promise<PostgresSaver> { if (this.instance) { return this.instance; } if (!this.initializing) { const pool = LanggraphDatabase.getInstance().getPool(); if (!pool) { throw new GraphError('E08DB850', 'CheckpointerService.getInstance'); } this.initializing = (async () => { const saver = new PostgresSaver(pool); await saver.setup(); this.instance = saver; return saver; })().finally(() => { this.initializing = undefined; }); } return this.initializing!; } }

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/KasarLabs/snak'

If you have feedback or need assistance with the MCP directory API, please join our Discord server