Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.maximem.ai/llms.txt

Use this file to discover all available pages before exploring further.

await sdk.conversation.record_messages_batch(
    messages: List[Dict[str, Any]],
) -> Dict[str, Any]
Records many messages in one call. Use this when backfilling an existing transcript, syncing a buffered queue, or recording a multi-turn exchange after it completes. Each entry in messages follows the same shape as the arguments to record_message.

Parameters

messages
List[Dict[str, Any]]
required
List of message dicts. Each dict supports the following keys:
  • conversation_id (str, required) — conversation identifier
  • role (str, required) — must be "user" or "assistant"
  • content (str, required) — message text
  • user_id (str, optional) — external user id
  • customer_id (str, optional) — external customer id
  • session_id (str, optional) — session identifier
  • metadata (dict, optional) — free-form metadata
Unlike record_message, user_id and customer_id are optional in batch mode. If omitted, the entry is recorded without explicit user/customer attribution.

Returns

A dict summarising the batch outcome.
total
int
Number of messages submitted.
succeeded
int
Number of messages accepted.
failed
int
Number of messages rejected.
results
List[Dict[str, Any]]
Per-message results in submission order. Successful entries include message_id and recorded_at; failed entries include an error field.

Example

from maximem_synap import MaximemSynapSDK

sdk = MaximemSynapSDK(api_key="synap_your_key_here")
await sdk.initialize()

result = await sdk.conversation.record_messages_batch(
    messages=[
        {
            "conversation_id": "conv_2026_05_16_alice",
            "role": "user",
            "content": "What's on my calendar today?",
            "user_id": "user_alice",
            "customer_id": "customer_acme",
        },
        {
            "conversation_id": "conv_2026_05_16_alice",
            "role": "assistant",
            "content": "You have two meetings and a dentist appointment.",
            "user_id": "user_alice",
            "customer_id": "customer_acme",
        },
    ]
)

print(f"Recorded {result['succeeded']} of {result['total']} messages")

Raises

  • InvalidInputError — when an entry is missing required keys or role is invalid.
  • AuthenticationError — when the API key is missing or invalid.
  • NetworkError — when the SDK cannot reach Synap.

See also