0aff31e2d3
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
48 lines
911 B
Markdown
48 lines
911 B
Markdown
---
|
|
layout: default
|
|
---
|
|
|
|
# Checkpointer: PostgresSaver
|
|
|
|
<div class="mt-4 text-xs">
|
|
|
|
<v-click>
|
|
|
|
**PostgresSaver**: Persistencia en PostgreSQL (producción)
|
|
|
|
```bash
|
|
npm install @langchain/langgraph-checkpoint-postgres
|
|
```
|
|
|
|
</v-click>
|
|
|
|
<v-click>
|
|
|
|
```typescript
|
|
import { createAgent } from "langchain";
|
|
import { PostgresSaver } from "@langchain/langgraph-checkpoint-postgres";
|
|
|
|
const DB_URI = "postgresql://user:pass@localhost:5432/mydb";
|
|
const checkpointer = PostgresSaver.fromConnString(DB_URI);
|
|
await checkpointer.setup();
|
|
|
|
const agent = createAgent({
|
|
model: "mistral:mistral-large-latest",
|
|
tools: [weatherTool],
|
|
checkpointer,
|
|
});
|
|
```
|
|
|
|
</v-click>
|
|
|
|
<v-click>
|
|
|
|
<div class="mt-4 text-xs opacity-80">
|
|
También disponibles: **MongoDB** (`@langchain/langgraph-checkpoint-mongodb`),
|
|
**Redis** (`@langchain/langgraph-checkpoint-redis`), y **Custom** (implementar `BaseCheckpointSaver`)
|
|
</div>
|
|
|
|
</v-click>
|
|
|
|
</div>
|