Sessions

Persistent Agent Sessions

A session ID is a permanent identity for a conversation, task, or workflow. Agents restart, networks blip, processes crash — the session survives all of it.

Why Persistence Matters

Stateless REST (the old way)
Agent restarts → all conversation history gone
Network interruption → must rebuild context from scratch
Scaling to 2 instances → context lives in only one
Debugging a past failure → no replay possible
Cross-framework handoff → manual serialization required
AISP Sessions (the new way)
Agent restarts → resumes with same session_id and memory
Network interruption → session suspends, auto-resumes
Scaling to N instances → all share same session namespace
Debugging → full replay from JetStream archive
Cross-framework → same session_id works in any SDK

Session Resume

The session_id is the only thing you need to resume. Same ID = same memory, same peers, same context.

session-resumePython
from aisp import AISPClient

# First run
client = AISPClient()
session = client.session.init()
print(session.id)
# session_ffc4a366...

# After restart — resume it
client = AISPClient()
session = client.session.resume(
    "session_ffc4a366..."
)
# Memory is intact
session-resumeGo
package main

import "aisp.network/go-sdk"

// First run
c := aisp.NewClient()
sess, _ := c.Session.Init()
fmt.Println(sess.ID)

// After restart
c := aisp.NewClient()
sess, _ := c.Session.Resume(
    "session_ffc4a366...",
)
// Memory is intact
session-resumeNode.js
import { AISPClient } from 'aisp'

// First run
const client = new AISPClient()
const session = await client.session.init()
console.log(session.id)

// After restart
const client = new AISPClient()
const session = await client.session.resume(
  'session_ffc4a366...'
)
// Memory is intact

Build Resilient Agents

Sessions are the foundation. Memory and discovery build on top.