Compact Conversation
Compact (summarize) a conversation’s message history.
This endpoint summarizes the in-context messages for a specific conversation, reducing the message count while preserving important context.
Agent-direct mode: Pass conversation_id=“default” with agent_id in request body to compact the agent’s default conversation messages.
Deprecated: Passing an agent ID as conversation_id still works but will be removed.
Path ParametersExpand Collapse
Body ParametersJSONExpand Collapse
agent_id: optional string
Agent ID for agent-direct mode with ‘default’ conversation. Use with conversation_id=‘default’ in the URL path.
compaction_settings: optional object { clip_chars, mode, model, 4 more }
Configuration for conversation compaction / summarization.
Per-model settings (temperature, max tokens, etc.) are derived from the default configuration for that handle.
clip_chars: optional number
The maximum length of the summary in characters. If none, no clipping is performed.
model: optional string
Model handle to use for sliding_window/all summarization (format: provider/model-name). If None, uses lightweight provider-specific defaults.
model_settings: optional OpenAIModelSettings { max_output_tokens, parallel_tool_calls, provider_type, 4 more } or object { max_output_tokens, parallel_tool_calls, provider_type, 5 more } or AnthropicModelSettings { effort, max_output_tokens, parallel_tool_calls, 6 more } or 14 more
Optional model settings used to override defaults for the summarizer model.
OpenAIModelSettings object { max_output_tokens, parallel_tool_calls, provider_type, 4 more }
response_format: optional TextResponseFormat { type } or JsonSchemaResponseFormat { json_schema, type } or JsonObjectResponseFormat { type }
Sglang object { max_output_tokens, parallel_tool_calls, provider_type, 5 more }
SGLang model configuration (OpenAI-compatible runtime with SGLang-specific parsing).
response_format: optional TextResponseFormat { type } or JsonSchemaResponseFormat { json_schema, type } or JsonObjectResponseFormat { type }
AnthropicModelSettings object { effort, max_output_tokens, parallel_tool_calls, 6 more }
response_format: optional TextResponseFormat { type } or JsonSchemaResponseFormat { json_schema, type } or JsonObjectResponseFormat { type }
strict: optional boolean
Enable strict mode for tool calling. When true, tool outputs are guaranteed to match JSON schemas.
GoogleAIModelSettings object { max_output_tokens, parallel_tool_calls, provider_type, 3 more }
response_schema: optional TextResponseFormat { type } or JsonSchemaResponseFormat { json_schema, type } or JsonObjectResponseFormat { type }
GoogleVertexModelSettings object { max_output_tokens, parallel_tool_calls, provider_type, 3 more }
response_schema: optional TextResponseFormat { type } or JsonSchemaResponseFormat { json_schema, type } or JsonObjectResponseFormat { type }
AzureModelSettings object { max_output_tokens, parallel_tool_calls, provider_type, 2 more }
Azure OpenAI model configuration (OpenAI-compatible).
response_format: optional TextResponseFormat { type } or JsonSchemaResponseFormat { json_schema, type } or JsonObjectResponseFormat { type }
XaiModelSettings object { max_output_tokens, parallel_tool_calls, provider_type, 2 more }
xAI model configuration (OpenAI-compatible).
response_format: optional TextResponseFormat { type } or JsonSchemaResponseFormat { json_schema, type } or JsonObjectResponseFormat { type }
Moonshot object { max_output_tokens, parallel_tool_calls, provider_type, 3 more }
Moonshot/Kimi model configuration (OpenAI-compatible).
response_format: optional TextResponseFormat { type } or JsonSchemaResponseFormat { json_schema, type } or JsonObjectResponseFormat { type }
Zai object { max_output_tokens, parallel_tool_calls, provider_type, 3 more }
Z.ai (ZhipuAI) model configuration (OpenAI-compatible).
response_format: optional TextResponseFormat { type } or JsonSchemaResponseFormat { json_schema, type } or JsonObjectResponseFormat { type }
MoonshotCoding object { effort, max_output_tokens, parallel_tool_calls, 6 more }
Kimi Code model configuration (Anthropic-compatible).
response_format: optional TextResponseFormat { type } or JsonSchemaResponseFormat { json_schema, type } or JsonObjectResponseFormat { type }
strict: optional boolean
Enable strict mode for tool calling. When true, tool outputs are guaranteed to match JSON schemas.
GroqModelSettings object { max_output_tokens, parallel_tool_calls, provider_type, 2 more }
Groq model configuration (OpenAI-compatible).
response_format: optional TextResponseFormat { type } or JsonSchemaResponseFormat { json_schema, type } or JsonObjectResponseFormat { type }
DeepseekModelSettings object { max_output_tokens, parallel_tool_calls, provider_type, 2 more }
Deepseek model configuration (OpenAI-compatible).
response_format: optional TextResponseFormat { type } or JsonSchemaResponseFormat { json_schema, type } or JsonObjectResponseFormat { type }
TogetherModelSettings object { max_output_tokens, parallel_tool_calls, provider_type, 2 more }
Together AI model configuration (OpenAI-compatible).
response_format: optional TextResponseFormat { type } or JsonSchemaResponseFormat { json_schema, type } or JsonObjectResponseFormat { type }
BedrockModelSettings object { max_output_tokens, parallel_tool_calls, provider_type, 2 more }
AWS Bedrock model configuration.
response_format: optional TextResponseFormat { type } or JsonSchemaResponseFormat { json_schema, type } or JsonObjectResponseFormat { type }
Baseten object { max_output_tokens, parallel_tool_calls, provider_type, temperature }
Baseten model configuration (OpenAI-compatible).
Openrouter object { max_output_tokens, parallel_tool_calls, provider_type, 2 more }
OpenRouter model configuration (OpenAI-compatible).
response_format: optional TextResponseFormat { type } or JsonSchemaResponseFormat { json_schema, type } or JsonObjectResponseFormat { type }
Compact Conversation
curl https://api.letta.com/v1/conversations/$CONVERSATION_ID/compact \
-X POST \
-H "Authorization: Bearer $LETTA_API_KEY"{
"num_messages_after": 0,
"num_messages_before": 0,
"summary": "summary"
}Returns Examples
{
"num_messages_after": 0,
"num_messages_before": 0,
"summary": "summary"
}