fleet-memory/hindsight-docs/docs/api-reference/endpoints/batch-put-async.api.mdx
2025-11-27 16:22:16 +01:00

90 lines
No EOL
7 KiB
Text

---
id: batch-put-async
title: "Store multiple memories asynchronously"
description: "Store multiple memory items in batch asynchronously using the task backend."
sidebar_label: "Store multiple memories asynchronously"
hide_title: true
hide_table_of_contents: true
api: eJztWVtv27gS/isD7sNpA8V23D0vAvbBTdMeA+02m3j34aRBMZbGFjcUqSUpu17D//1gSMqWc2tRnJcFmidLHA5nvrlwPmUrPC6dyG/EB6qN3cDHhix6abQTt5koyRVWNvwscnHtjSWoW+VlowjquEN6qh1IDXP0RQXoNrqorNGmdWoDrZN6Cb4i8OjuYI7FHely8El/0gAAs0o6IF02RmoPlnxrtQNZ11RK9KQ2gAtPFv5qqe0rymAtfWVaD2uUnlcWxkJh6kYRWzvo1BNg4VtU0FhTkAvWVNg0pIPNrI9tWlrT9sx6S+hbSy6Pj6cw7SwCS64x2hG80EafzpUp7qRevuwEX++V9U9cSYz+sx/UyV4sFrKQpH2C7rChk5i03tToZQELLDzQF2+xYP9gYU0Nmq1EBQr1ssXlQbH20m/AUmGWWgZ51CUoqe96yt+Yoq35dFbKCwFTwP2ZbePIenixrkhDmaQ/yxKkY1tXsqRy7/iM6sawMXySoxo1q9gfeYiH2zhP9eEYVGqTcD4bwG8MkEtxCaC0PkAXJcYDuHokSYLhri0Yvl9mtqUsIl2Gh7j11QAuI8CU0rWLVN4B6wLMLoMlaS4DckD1nMpS6qXLoLAU3rFTrnPpV+Mph+niKYACHqgsYbkB+iId62f3jCr3e4KQ9K6rqVbzw1oqBXOCkhR5KmFOCy7AYAaHS9MajCYHL1Kk5lThShr7ciAyYbpKnpYiFwHMz03rP4cCFZlo0GJNniyX/1ZorEnkApfRBZEJyTXfoK9EJiz91UpLpcg9oytcUVGNIt8Kv2l4n/NW6qXIhJde8YsJK4JpKXa727ifnH9tyg1vuq+uMNqT9ryETaNkEQwf/um472x7pzWW3fKSHD+F1nP043i9p/YpM8+T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X+KpwlhsoKwu94HmrGKmnpisXFCCVK5NqmMdanPJjYopKeCk4GftXjo60LdP+UEemo7HsmenzmudGail7YQiYikzFlHIUvCbKmuH0f/AfbuyRnygtO1lKh7aHGmxN1/8rJaeIOPNJhTRCisFdy3TDd5MSaMNBH2Csll4n0h24SL9uEYaopVJHb8l/qHFiEaymxxK5yAnTcWrnn8L1+EJk0WFQE48FIZKK1SuSi8r5x+XC4Xq8HGJYHxi6Haa8bvp+eX/x6fXE6HowGla8VK2YbY7s4G4wGI37FjbZG3TvrqbI9/hZ1vwH1+9+PT1s/Pm39+LT1T/m0lcY0vpuGjUIZJtDQY7Zp/roR2EiRidVZx1aYwOQ93tI1CV4Pg9htJioe4fIbsd3yNfe7Vbsdv+bLeCPym9tMrNBKnPN8c7MVpXT8uxT5ApWjZ9rLi6s0tb6Ep8zvhlPNfWqFquUnkYk72vQ/y4VRqyIsyQYb4nL6inUapubD9gckgoe+uGNSFNT4Z2Vve8Pt5cfrmcjEPH2/Y5YmcmFxzRM5rqOppon/OOAPfPxuK7rqFbmIOvnvf5AXhWg=
sidebar_class_name: "post api-method"
info_path: docs/api-reference/endpoints/agent-memory-api
custom_edit_url: null
---
import MethodEndpoint from "@theme/ApiExplorer/MethodEndpoint";
import ParamsDetails from "@theme/ParamsDetails";
import RequestSchema from "@theme/RequestSchema";
import StatusCodes from "@theme/StatusCodes";
import OperationTabs from "@theme/OperationTabs";
import TabItem from "@theme/TabItem";
import Heading from "@theme/Heading";
<Heading
as={"h1"}
className={"openapi__heading"}
children={"Store multiple memories asynchronously"}
>
</Heading>
<MethodEndpoint
method={"post"}
path={"/api/v1/memory banks/{agent_id}/memories/async"}
context={"endpoint"}
>
</MethodEndpoint>
Store multiple memory items in batch asynchronously using the task backend.
This endpoint returns immediately after queuing the task, without waiting for completion.
The actual processing happens in the background.
Features:
- Immediate response (non-blocking)
- Background processing via task queue
- Efficient batch processing
- Automatic fact extraction from natural language
- Entity recognition and linking
- Document tracking with automatic upsert (when document_id is provided)
- Temporal and semantic linking
The system automatically:
1. Queues the batch put task
2. Returns immediately with success=True, queued=True
3. Processes in background: extracts facts, generates embeddings, creates links
Note: If document_id is provided and already exists, the old document and its memory units will be deleted before creating new ones (upsert behavior).
<Heading
id={"request"}
as={"h2"}
className={"openapi-tabs__heading"}
children={"Request"}
>
</Heading>
<ParamsDetails
parameters={[{"name":"agent_id","in":"path","required":true,"schema":{"type":"string","title":"bank ID"}}]}
>
</ParamsDetails>
<RequestSchema
title={"Body"}
body={{"required":true,"content":{"application/json":{"schema":{"properties":{"items":{"items":{"properties":{"content":{"type":"string","title":"Content"},"event_date":{"anyOf":[{"type":"string","format":"date-time"},{"type":"null"}],"title":"Event Date"},"context":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Context"}},"type":"object","required":["content"],"title":"MemoryItem","description":"Single memory item for batch put.","example":{"content":"Alice mentioned she's working on a new ML model","context":"team meeting","event_date":"2024-01-15T10:30:00Z"}},"type":"array","title":"Items"},"document_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Document Id"}},"type":"object","required":["items"],"title":"BatchPutRequest","description":"Request model for batch put endpoint.","example":{"document_id":"conversation_123","items":[{"content":"Alice works at Google","context":"work"},{"content":"Bob went hiking yesterday","event_date":"2024-01-15T10:00:00Z"}]}}}}}}
>
</RequestSchema>
<StatusCodes
id={undefined}
label={undefined}
responses={{"200":{"description":"Successful Response","content":{"application/json":{"schema":{"properties":{"success":{"type":"boolean","title":"Success"},"message":{"type":"string","title":"Message"},"agent_id":{"type":"string","title":"bank ID"},"document_id":{"anyOf":[{"type":"string"},{"type":"null"}],"title":"Document Id"},"items_count":{"type":"integer","title":"Items Count"},"queued":{"type":"boolean","title":"Queued"}},"type":"object","required":["success","message","agent_id","items_count","queued"],"title":"BatchPutAsyncResponse","description":"Response model for async batch put endpoint.","example":{"agent_id":"user123","document_id":"conversation_123","items_count":2,"message":"Batch put task queued for background processing","queued":true,"success":true}}}}},"422":{"description":"Validation Error","content":{"application/json":{"schema":{"properties":{"detail":{"items":{"properties":{"loc":{"items":{"anyOf":[{"type":"string"},{"type":"integer"}]},"type":"array","title":"Location"},"msg":{"type":"string","title":"Message"},"type":{"type":"string","title":"Error Type"}},"type":"object","required":["loc","msg","type"],"title":"ValidationError"},"type":"array","title":"Detail"}},"type":"object","title":"HTTPValidationError"}}}}}}
>
</StatusCodes>