api.agents

list()

api.agents.list({ limit }) → Promise<Session[]>

The account's agent sessions, newest first. Enough to build a conversation list without opening any of them.

GET /api/ai/agents/sessionsfree30 by default
Using Python?

Switch any code block to Python: the choice applies to every page. Python SDK guide and resource reference.

limitinteger30

How many to return.

const sessions = await api.agents.list({ limit: 50 });

for (const session of sessions) {
  console.log(session.title);
}
sessions = api.agents.list(limit=50)

for session in sessions:
    print(session.get("title"))

What a session carries here

The identifier, the title taken from its first message, the model, when it was last active, and its usage. Enough for a sidebar; the conversation itself comes from get() and getHistory().

Only agents with memory are in it

A run without memory: true leaves nothing behind

It is not recorded, so it cannot be listed, reopened or recalled. That is the normal shape for a one-off task — and the reason an account can look empty after a lot of work.

A conversation list

const sessions = await api.agents.list();

// Open the most recent one
const [latest] = sessions;
const agent = api.agents.get(latest.id, { machine: pc });
const messages = await agent.getHistory();
sessions = api.agents.list()

# Open the most recent one
latest = sessions[0]
agent = api.agents.get(latest["id"], machine=pc)
messages = agent.get_history()

Removing one

agent.destroy() on a reopened session removes the account's copy, the device journal and its checkpoints. A refusal from the account is raised rather than swallowed, so a session that still exists is never reported as gone.