Skip to content

armgit / letta

Public Imported from GitHub
0

Platform for stateful agents: AI with advanced memory that can learn and self-improve over time.

docs: add OTID field description for idempotency context (#10154)

cthomas2d6ed8d117e4
diff --git a/fern/openapi.json b/fern/openapi.json
index 6132a28a3..69f3e1015 100644
--- a/fern/openapi.json
+++ b/fern/openapi.json
@@ -28637,7 +28637,7 @@
}
],
"title": "Otid",
- "description": "The offline threading id associated with this message"
+ "description": "The offline threading id (OTID). Set by the client to deduplicate requests. Used for idempotency in background streaming mode — each message in a request must have a unique OTID. Retries of the same request should reuse the same OTIDs."
},
"group_id": {
"anyOf": [
@@ -28762,7 +28762,8 @@
"type": "null"
}
],
- "title": "Otid"
+ "title": "Otid",
+ "description": "The offline threading id (OTID). Set by the client to deduplicate requests. Used for idempotency in background streaming mode — each message in a request must have a unique OTID. Retries of the same request should reuse the same OTIDs."
},
"sender_id": {
"anyOf": [
@@ -28894,7 +28895,8 @@
"type": "null"
}
],
- "title": "Otid"
+ "title": "Otid",
+ "description": "The offline threading id (OTID). Set by the client to deduplicate requests. Used for idempotency in background streaming mode — each message in a request must have a unique OTID. Retries of the same request should reuse the same OTIDs."
},
"sender_id": {
"anyOf": [
@@ -29330,7 +29332,8 @@
"type": "null"
}
],
- "title": "Otid"
+ "title": "Otid",
+ "description": "The offline threading id (OTID). Set by the client to deduplicate requests. Used for idempotency in background streaming mode — each message in a request must have a unique OTID. Retries of the same request should reuse the same OTIDs."
},
"sender_id": {
"anyOf": [
@@ -35262,7 +35265,8 @@
"type": "null"
}
],
- "title": "Otid"
+ "title": "Otid",
+ "description": "The offline threading id (OTID). Set by the client to deduplicate requests. Used for idempotency in background streaming mode — each message in a request must have a unique OTID. Retries of the same request should reuse the same OTIDs."
},
"sender_id": {
"anyOf": [
@@ -37265,7 +37269,8 @@
"type": "null"
}
],
- "title": "Otid"
+ "title": "Otid",
+ "description": "The offline threading id (OTID). Set by the client to deduplicate requests. Used for idempotency in background streaming mode — each message in a request must have a unique OTID. Retries of the same request should reuse the same OTIDs."
},
"sender_id": {
"anyOf": [
@@ -40066,7 +40071,8 @@
"type": "null"
}
],
- "title": "Otid"
+ "title": "Otid",
+ "description": "The offline threading id (OTID). Set by the client to deduplicate requests. Used for idempotency in background streaming mode — each message in a request must have a unique OTID. Retries of the same request should reuse the same OTIDs."
},
"sender_id": {
"anyOf": [
@@ -41565,7 +41571,7 @@
}
],
"title": "Otid",
- "description": "The offline threading id associated with this message"
+ "description": "The offline threading id (OTID). Set by the client to deduplicate requests. Used for idempotency in background streaming mode — each message in a request must have a unique OTID. Retries of the same request should reuse the same OTIDs."
},
"group_id": {
"anyOf": [
@@ -43848,7 +43854,8 @@
"type": "null"
}
],
- "title": "Otid"
+ "title": "Otid",
+ "description": "The offline threading id (OTID). Set by the client to deduplicate requests. Used for idempotency in background streaming mode — each message in a request must have a unique OTID. Retries of the same request should reuse the same OTIDs."
},
"sender_id": {
"anyOf": [
@@ -46500,7 +46507,8 @@
"type": "null"
}
],
- "title": "Otid"
+ "title": "Otid",
+ "description": "The offline threading id (OTID). Set by the client to deduplicate requests. Used for idempotency in background streaming mode — each message in a request must have a unique OTID. Retries of the same request should reuse the same OTIDs."
},
"sender_id": {
"anyOf": [
@@ -46688,7 +46696,8 @@
"type": "null"
}
],
- "title": "Otid"
+ "title": "Otid",
+ "description": "The offline threading id (OTID). Set by the client to deduplicate requests. Used for idempotency in background streaming mode — each message in a request must have a unique OTID. Retries of the same request should reuse the same OTIDs."
},
"sender_id": {
"anyOf": [
@@ -47376,7 +47385,8 @@
"type": "null"
}
],
- "title": "Otid"
+ "title": "Otid",
+ "description": "The offline threading id (OTID). Set by the client to deduplicate requests. Used for idempotency in background streaming mode — each message in a request must have a unique OTID. Retries of the same request should reuse the same OTIDs."
},
"sender_id": {
"anyOf": [
@@ -47831,7 +47841,7 @@
}
],
"title": "Otid",
- "description": "The offline threading id associated with this message"
+ "description": "The offline threading id (OTID). Set by the client to deduplicate requests. Used for idempotency in background streaming mode — each message in a request must have a unique OTID. Retries of the same request should reuse the same OTIDs."
},
"group_id": {
"anyOf": [
@@ -47897,7 +47907,8 @@
"type": "null"
}
],
- "title": "Otid"
+ "title": "Otid",
+ "description": "The offline threading id (OTID). Set by the client to deduplicate requests. Used for idempotency in background streaming mode — each message in a request must have a unique OTID. Retries of the same request should reuse the same OTIDs."
},
"sender_id": {
"anyOf": [
@@ -49593,7 +49604,8 @@
"type": "null"
}
],
- "title": "Otid"
+ "title": "Otid",
+ "description": "The offline threading id (OTID). Set by the client to deduplicate requests. Used for idempotency in background streaming mode — each message in a request must have a unique OTID. Retries of the same request should reuse the same OTIDs."
},
"sender_id": {
"anyOf": [
@@ -50877,7 +50889,7 @@
}
],
"title": "Otid",
- "description": "The offline threading id associated with this message"
+ "description": "The offline threading id (OTID). Set by the client to deduplicate requests. Used for idempotency in background streaming mode — each message in a request must have a unique OTID. Retries of the same request should reuse the same OTIDs."
},
"group_id": {
"anyOf": [
diff --git a/letta/schemas/letta_message.py b/letta/schemas/letta_message.py
index cb533511b..91487bda0 100644
--- a/letta/schemas/letta_message.py
+++ b/letta/schemas/letta_message.py
@@ -76,7 +76,9 @@ class LettaMessage(BaseModel):
date (datetime): The date the message was created in ISO format
name (Optional[str]): The name of the sender of the message
message_type (MessageType): The type of the message
- otid (Optional[str]): The offline threading id associated with this message
+ otid (Optional[str]): The offline threading id (OTID) associated with this message. Set by the client to deduplicate
+ requests. This key is used for idempotency in background mode for streaming — it is critical that each message
+ in a request has a unique OTID. The only exception is retries of the same request, which should reuse the same OTIDs.
sender_id (Optional[str]): The id of the sender of the message, can be an identity id or agent id
step_id (Optional[str]): The step id associated with the message
is_err (Optional[bool]): Whether the message is an errored message or not. Used for debugging purposes only.
@@ -86,7 +88,12 @@ class LettaMessage(BaseModel):
date: datetime
name: str | None = None
message_type: MessageType = Field(..., description="The type of the message.")
- otid: str | None = None
+ otid: str | None = Field(
+ None,
+ description="The offline threading id (OTID). Set by the client to deduplicate requests. "
+ "Used for idempotency in background streaming mode — each message in a request must have a unique OTID. "
+ "Retries of the same request should reuse the same OTIDs.",
+ )
sender_id: str | None = None
step_id: str | None = None
is_err: bool | None = None
diff --git a/letta/schemas/message.py b/letta/schemas/message.py
index 9c9d6f677..957997991 100644
--- a/letta/schemas/message.py
+++ b/letta/schemas/message.py
@@ -131,7 +131,12 @@ class MessageCreateType(str, Enum):
class MessageCreateBase(BaseModel):
type: MessageCreateType = Field(..., description="The message type to be created.")
- otid: Optional[str] = Field(default=None, description="The offline threading id associated with this message")
+ otid: Optional[str] = Field(
+ default=None,
+ description="The offline threading id (OTID). Set by the client to deduplicate requests. "
+ "Used for idempotency in background streaming mode — each message in a request must have a unique OTID. "
+ "Retries of the same request should reuse the same OTIDs.",
+ )
group_id: Optional[str] = Field(default=None, description="The multi-agent group that the message was sent in")
@model_validator(mode="after")