# AsyncSqliteSaver

> **Class** in `langgraph.checkpoint.sqlite`

📖 [View in docs](https://reference.langchain.com/python/langgraph.checkpoint.sqlite/aio/AsyncSqliteSaver)

An asynchronous checkpoint saver that stores checkpoints in a SQLite database.

This class provides an asynchronous interface for saving and retrieving checkpoints
using a SQLite database. It's designed for use in asynchronous environments and
offers better performance for I/O-bound operations compared to synchronous alternatives.

## Signature

```python
AsyncSqliteSaver(
    self,
    conn: aiosqlite.Connection,
    *,
    serde: SerializerProtocol | None = None,
)
```

## Description

**Tip:**

Requires the [aiosqlite](https://pypi.org/project/aiosqlite/) package.
Install it with `pip install aiosqlite`.

**Warning:**

While this class supports asynchronous checkpointing, it is not recommended
for production workloads due to limitations in SQLite's write performance.
For production use, consider a more robust database like PostgreSQL.

**Tip:**

Remember to **close the database connection** after executing your code,
otherwise, you may see the graph "hang" after execution (since the program
will not exit until the connection is closed).

The easiest way is to use the `async with` statement as shown in the examples.

```python
async with AsyncSqliteSaver.from_conn_string("checkpoints.sqlite") as saver:
    # Your code here
    graph = builder.compile(checkpointer=saver)
    config = {"configurable": {"thread_id": "thread-1"}}
    async for event in graph.astream_events(..., config, version="v1"):
        print(event)
```

## Extends

- `BaseCheckpointSaver[str]`

## Constructors

```python
__init__(
    self,
    conn: aiosqlite.Connection,
    *,
    serde: SerializerProtocol | None = None,
)
```

| Name | Type |
|------|------|
| `conn` | `aiosqlite.Connection` |
| `serde` | `SerializerProtocol \| None` |


## Properties

- `lock`
- `is_setup`
- `jsonplus_serde`
- `conn`
- `loop`

## Methods

- [`from_conn_string()`](https://reference.langchain.com/python/langgraph.checkpoint.sqlite/aio/AsyncSqliteSaver/from_conn_string)
- [`get_tuple()`](https://reference.langchain.com/python/langgraph.checkpoint.sqlite/aio/AsyncSqliteSaver/get_tuple)
- [`list()`](https://reference.langchain.com/python/langgraph.checkpoint.sqlite/aio/AsyncSqliteSaver/list)
- [`put()`](https://reference.langchain.com/python/langgraph.checkpoint.sqlite/aio/AsyncSqliteSaver/put)
- [`put_writes()`](https://reference.langchain.com/python/langgraph.checkpoint.sqlite/aio/AsyncSqliteSaver/put_writes)
- [`delete_thread()`](https://reference.langchain.com/python/langgraph.checkpoint.sqlite/aio/AsyncSqliteSaver/delete_thread)
- [`get_delta_channel_history()`](https://reference.langchain.com/python/langgraph.checkpoint.sqlite/aio/AsyncSqliteSaver/get_delta_channel_history)
- [`setup()`](https://reference.langchain.com/python/langgraph.checkpoint.sqlite/aio/AsyncSqliteSaver/setup)
- [`aget_tuple()`](https://reference.langchain.com/python/langgraph.checkpoint.sqlite/aio/AsyncSqliteSaver/aget_tuple)
- [`alist()`](https://reference.langchain.com/python/langgraph.checkpoint.sqlite/aio/AsyncSqliteSaver/alist)
- [`aput()`](https://reference.langchain.com/python/langgraph.checkpoint.sqlite/aio/AsyncSqliteSaver/aput)
- [`aput_writes()`](https://reference.langchain.com/python/langgraph.checkpoint.sqlite/aio/AsyncSqliteSaver/aput_writes)
- [`adelete_thread()`](https://reference.langchain.com/python/langgraph.checkpoint.sqlite/aio/AsyncSqliteSaver/adelete_thread)
- [`aget_delta_channel_history()`](https://reference.langchain.com/python/langgraph.checkpoint.sqlite/aio/AsyncSqliteSaver/aget_delta_channel_history)
- [`get_next_version()`](https://reference.langchain.com/python/langgraph.checkpoint.sqlite/aio/AsyncSqliteSaver/get_next_version)

---

[View source on GitHub](https://github.com/langchain-ai/langgraph/blob/aa322c13cd5f16a3f6254a931a4104e412cd687c/libs/checkpoint-sqlite/langgraph/checkpoint/sqlite/aio.py#L38)