Parameters
idstringrequiredThe session id, from assistant.id or from list().
Returns
An AssistantSession, identical in kind to what create() gave you: same configuration, same id, and the conversation still behind it.
// First run
const assistant = await api.models.create({ model: "gemini-3.5-flash" });
await db.save(userId, assistant.id);
await assistant.generate({ inputs: [{ type: "text", content: "My name is Zayd." }] });
// A week later, a different process
const again = await api.models.get(await db.load(userId));
await again.generate({ inputs: [{ type: "text", content: "What is my name?" }] });
// It knows — the conversation came back with the session.# First run
assistant = api.models.create(model="gemini-3.5-flash")
db.save(user_id, assistant.id)
assistant.generate(inputs=[{"type": "text", "content": "My name is Zayd."}])
# A week later, a different process
again = api.models.get(db.load(user_id))
again.generate(inputs=[{"type": "text", "content": "What is my name?"}])
# It knows — the conversation came back with the session.Everything else — model, settings, schema, history — is on the server. Store the id next to whatever the session belongs to, and nothing else needs persisting.
Errors
| Code | Status | When |
|---|---|---|
| session_not_found | 404 | No session of this account carries that id — including a malformed one. |
It throws rather than returning null, so a missing session is an exception to catch, not a value to test.
import { IaGenifyError } from "iagenify";
async function resume(api, id, model) {
try {
return await api.models.get(id);
} catch (err) {
if (err instanceof IaGenifyError && err.status === 404) {
// Deleted, or belonging to another account. Start a fresh one.
return api.models.create({ model });
}
throw err;
}
}from iagenify import IaGenifyError
def resume(api, session_id, model):
try:
return api.models.get(session_id)
except IaGenifyError as error:
if error.status == 404:
# Deleted, or belonging to another account. Start a fresh one.
return api.models.create(model=model)
raiseA session belonging to another account answers the same 404: the lookup is scoped to the caller, so one account cannot reach — or even detect — another's sessions.
A session created with memory: false
It still exists and get() still returns it, because the configuration was recorded. What is not there is a conversation: reopening it gives you the same settings and a blank slate.