Delete an agent session
beta.agents.sessions.delete(strsession_id) -> AgentSessionDeleted
DELETE/agents/sessions/{session_id}
Removes a managed agent session from the public API and returns a deletion confirmation. If backend execution has ended, deletion can cancel a still-open public turn and abandon unpublished outputs. Running execution must be cancelled first. Physical cleanup may continue asynchronously. See managing sessions.
Delete an agent session
import os
from openai import OpenAI
client = OpenAI(
api_key=os.environ.get("OPENAI_API_KEY"), # This is the default and can be omitted
)
agent_session_deleted = client.beta.agents.sessions.delete(
"session_id",
)
print(agent_session_deleted.id){
"id": "id",
"deleted": true,
"object": "agent.session.deleted"
}Returns Examples
{
"id": "id",
"deleted": true,
"object": "agent.session.deleted"
}