> ## Documentation Index
> Fetch the complete documentation index at: https://praison.ai/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Commit Memory Batch • AI Agent SDK

> commit_memory_batch: Persist a batch of staged memory writes.

# commit\_memory\_batch

<div className="flex items-center gap-2">
  <Badge color="purple">Method</Badge>
</div>

> This is a method of the [**Memory**](../classes/Memory) class in the [**memory**](../modules/memory) module.

Persist a batch of staged memory writes.

Mirrors `FileMemory.commit_memory_batch` so the pre-compaction fact
flush (compaction/memory\_flush.py) durably commits extracted facts for
sqlite/chroma/mongodb/mem0 backends instead of raising and being
swallowed. Each staged tuple is `(method_name, args, kwargs)` produced
by \_StagedMemory; `add_*` names map to the `store_*` equivalents.

The `store_*` methods serialize their own SQLite writes with
`_write_lock`; this method therefore must NOT hold that lock while
calling them (it is a non-reentrant `threading.Lock` and doing so
would deadlock). Each write goes through `commit_guard.commit` so a
write is skipped once the flush has been cancelled or the shared
`deadline` has passed, honoring the same atomic-commit contract as the
file backend.

## Signature

```python theme={"theme":{"light":"vitesse-light","dark":"vitesse-dark"}}
def commit_memory_batch(writes: List[tuple]) -> None
```

## Parameters

<ParamField query="writes" type="List[tuple]" required={true}>
  No description available.
</ParamField>

## Uses

* `store`

## Source

<Card title="View on GitHub" icon="github" href="https://github.com/MervinPraison/PraisonAI/blob/main/src/praisonai-agents/praisonaiagents/memory/memory.py#L402">
  `praisonaiagents/memory/memory.py` at line 402
</Card>

***

## Related Documentation

<CardGroup cols={2}>
  <Card title="Memory Concept" icon="brain" href="/docs/docs/concepts/memory" />

  <Card title="Memory Overview" icon="database" href="/docs/docs/memory/overview" />

  <Card title="Memory Configuration" icon="gear" href="/docs/docs/configuration/memory-config" />

  <Card title="Session Resume" icon="rotate-right" href="/docs/docs/memory/session-resume" />
</CardGroup>
