AssistantSession

data

assistant.data → object

The session's configuration as a plain object: what to store, what to log, what to hand to a page.

a property, not a callno networka snapshot
Using Python?

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

What it holds

assistant.data;
// {
//   id, model, settings, schema, memory,
//   title, createdAt, updatedAt
// }
assistant.data
# {
#   "id", "model", "settings", "schema", "memory",
#   "title", "createdAt", "updatedAt"
# }

The same values that sit on the object itself, gathered into one. Reading it touches nothing — there is no request, and no cost.

Why it exists

Because the object carries methods and a client, and most of the time what you want is the part you can store, send or print.

// To your own database
await db.sessions.insert({ userId, ...assistant.data });

// To a page — nothing here is a secret
return Response.json({ session: assistant.data });

// To a log that stays readable
console.log("session", assistant.data.id, assistant.data.model);
# To your own database
db.sessions.insert({"userId": user_id, **assistant.data})

# To a page — nothing here is a secret (Flask)
return jsonify(session=assistant.data)

# To a log that stays readable
print("session", assistant.data["id"], assistant.data["model"])
There is no key and no token in it

It is configuration and identifiers. That is what makes it safe to send to an interface — unlike the client that produced it.

It is a snapshot, not a live view

The values are what the SDK was told when the session was opened or fetched. Generating does not refresh them in place — title and updatedAt move on the server while your copy stays as it was.

const assistant = await api.models.create({ model: "gemini-3.5-flash" });
assistant.data.title;        // ""

await assistant.generate({ inputs: [{ type: "text", content: "Résume ce contrat." }] });
assistant.data.title;        // still "" — your copy did not move

const fresh = await api.models.get(assistant.id);
fresh.data.title;            // "Résume ce contrat."
assistant = api.models.create(model="gemini-3.5-flash")
assistant.data["title"]      # ""

assistant.generate(inputs=[{"type": "text", "content": "Résume ce contrat."}])
assistant.data["title"]      # still "" — your copy did not move

fresh = api.models.get(assistant.id)
fresh.data["title"]          # "Résume ce contrat."
Re-read before you display it

A list built from handles held in memory shows stale titles and dates. Build it from api.models.list(), or fetch the session again — both are free.

Comparing two sessions

Compare by id. Two handles to the same conversation are the same conversation, whatever else differs between the two snapshots.