Skip to content
中文

Feed an agent an experience

Call Create agent first and replace the example agent ID with its returned ID.

POST/agent/v1/agents/{agent_id}/consolidations● Supported

Request parameters

  • agent_idstringrequired

    path: Agent id from agents.create or agents.list, the eight character identity number or the handle; the agent must belong to your organization. Also accepts an 8-character identity number (0–9, A–Z); malformed, absent and foreign references return 404, and response ids always use agent_….

  • messagesarrayoptional

    The experience as a conversation, oldest first, at most 200 messages and 60000 characters in all, with at least one user message; send this or text, not both.

    Expand sub-fields (3)
    • rolestringrequired

      Who spoke: user is the person, assistant is the agent.

      values userassistant
    • contentstringrequired

      What was said, as plain text.

    • atstringoptional

      RFC 3339 time this message happened; defaults to occurred_at, must not be later than occurred_at and not earlier than the message above it.

  • textstringoptional

    The experience as one piece of text, taken as a single user message; send this or messages, not both; at most 60000 characters.

  • occurred_atstringrequired

    RFC 3339 time the experience happened, not in the future; the engram is stamped with it, so recall orders the memory by when it happened and not by when you sent it.

  • aboutarrayoptional

    Entity ids or ref: ids the experience is about, as hints for consolidation; optional, at most 50.

  • idempotency_keystringoptional

    Your own key for this experience, scoped to the agent; the same key with the same body returns the first consolidation, with a different body is 409. Omit it and a hash of the body is the key.

Returns

202

The experience becomes an imported session of the agent, archived, and consolidated like any session.

Errors follow the Anthropic error format (type / message / request_id) — see error codes

Request

curl
# Call Create agent first and replace the example agent ID with its returned ID.
curl https://api.deepraxis.com/agent/v1/agents/agent_123/consolidations \
  -H "Authorization: Bearer $PRAXIS_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"text":"客户李先生来电:新加坡仓的季度报价改按月结,币种用新加坡元,总价下周一前确认。","occurred_at":"2026-11-02T09:30:00Z","idempotency_key":"call-li-2026-11-02"}'
Python
# Call Create agent first and replace the example agent ID with its returned ID.
import requests

opts = dict(
    base_url="https://api.deepraxis.com/agent",
    api_key="$PRAXIS_API_KEY",
)

# /agent 是我们自己的 Managed Agents 形状,直接发 HTTP 请求(Bearer 认证)
resp = requests.post(
    f"{opts['base_url']}/v1/agents/agent_123/consolidations",
    headers={"Authorization": f"Bearer {opts['api_key']}"},
    json={"text":"客户李先生来电:新加坡仓的季度报价改按月结,币种用新加坡元,总价下周一前确认。","occurred_at":"2026-11-02T09:30:00Z","idempotency_key":"call-li-2026-11-02"},
)
print(resp.status_code, resp.json())
TypeScript
// Call Create agent first and replace the example agent ID with its returned ID.
const opts = {
  baseURL: "https://api.deepraxis.com/agent",
  apiKey: "$PRAXIS_API_KEY",
};

// /agent 是我们自己的 Managed Agents 形状,直接发 HTTP 请求(Bearer 认证)
const resp = await fetch(`${opts.baseURL}/v1/agents/agent_123/consolidations`, {
  method: "POST",
  headers: { Authorization: `Bearer ${opts.apiKey}`, "Content-Type": "application/json" },
  body: JSON.stringify({"text":"客户李先生来电:新加坡仓的季度报价改按月结,币种用新加坡元,总价下周一前确认。","occurred_at":"2026-11-02T09:30:00Z","idempotency_key":"call-li-2026-11-02"}),
});
console.log(resp.status, await resp.json());

Response 202

{
  "id": "cns_1e66df0ead03e8112e5e4785c4f9229a",
  "session_id": "sesn_1e66df0ead03e8112e5e4785c4f9229a",
  "status": "queued"
}

Response

HTTP 202

Accepted: the experience is held by an imported session and its consolidation is queued; poll agents.consolidations.retrieve with id.

application/json

Name Type Description
id string Consolidation id (cns_...), the id to pass to agents.consolidations.retrieve; derived from the agent and the idempotency_key (or the body), so a replay returns the same id.
session_id string The imported session (sesn_...) that holds the episode: its events are your messages at the times you gave, it is archived, and it is readable with sessions.events.list.
status string Where the consolidation is: queued, running, done or failed.
engram_id string The engram the pass wrote, present only when status is done and the experience held something worth keeping; recall reads it back.
error string Why the pass failed, present only when status is failed.