Steer
Compact context
Summarize a session’s context without asking the agent to take another turn.
POST
/
api
/
v2
/
sessions
/
{id}
/
compact
from hai_agents import Client
client = Client()
client.sessions.compact_session(session_id)
import { HaiAgentsClient } from "hai-agents";
const client = new HaiAgentsClient();
await client.sessions.compactSession({ id: sessionId });
curl -X POST "https://agp.eu.hcompany.ai/api/v2/sessions/$SESSION_ID/compact" \
-H "Authorization: Bearer $HAI_API_KEY"
holo compact "$SESSION_ID"
# In an interactive chat, use /compact for the current session.
Ask the agent to compact its history before your next message. An idle session stays idle: this call does not start another reasoning turn. Compaction summarizes context; it does not delete the session’s event history or its persistent memory.
Path parameters
Response
202 Accepted, with no body. Compaction is asynchronous; follow session events for the reset_history flow event.
from hai_agents import Client
client = Client()
client.sessions.compact_session(session_id)
import { HaiAgentsClient } from "hai-agents";
const client = new HaiAgentsClient();
await client.sessions.compactSession({ id: sessionId });
curl -X POST "https://agp.eu.hcompany.ai/api/v2/sessions/$SESSION_ID/compact" \
-H "Authorization: Bearer $HAI_API_KEY"
holo compact "$SESSION_ID"
# In an interactive chat, use /compact for the current session.
Errors
404 if the session is absent or inaccessible. See common errors.Was this page helpful?
⌘I
from hai_agents import Client
client = Client()
client.sessions.compact_session(session_id)
import { HaiAgentsClient } from "hai-agents";
const client = new HaiAgentsClient();
await client.sessions.compactSession({ id: sessionId });
curl -X POST "https://agp.eu.hcompany.ai/api/v2/sessions/$SESSION_ID/compact" \
-H "Authorization: Bearer $HAI_API_KEY"
holo compact "$SESSION_ID"
# In an interactive chat, use /compact for the current session.