Multi-user Collaboration Kit

Multiple users interacting with the same agent in shared or isolated context modes.

Session Config

Participants (3/4)

Y
You
owner
AC
Alice Chen
editor
BW
Bob Wilson
editor
DL
Diana Lopez
viewer

Session Info

Session: sess-i8wczs

Mode: shared context

Messages: 3

Active: 3 users

Shared Agent Sessionshared context
AC
Alice Chen
Can we ask the agent about the Q3 timeline?
1:45:45 PM
AI
Agent
Based on the current project data, the Q3 deliverables are 78% on track. Two items need attention.
1:45:55 PM
BW
Bob Wilson
Good. What about the design review?
1:46:05 PM

Integration Code

import { createSharedSession, Presence } from 'agent-tools-kit/realtime'

const session = createSharedSession({
  mode: 'shared',
  contextIsolation: false,
  presence: new Presence({
    enabled: true,
    indicators: ['typing', 'viewing', 'idle'],
    heartbeatInterval: 5000,
  }),
  roles: {
    owner: { canWrite: true, canDelete: true, canInvite: true },
    editor: { canWrite: true, canDelete: false, canInvite: false },
    viewer: { canWrite: false, canDelete: false, canInvite: false },
  },
  sync: {
    strategy: 'operational-transform',  // or 'crdt'
    conflictResolution: 'last-write-wins',
  },
})

// Join session
await session.join({ userId: 'user-42', role: 'editor' })

// Send message visible to all participants
await session.send('What is the project status?')

// Listen for agent responses
session.on('agent-response', (msg) => {
  console.log('Agent:', msg.content)
  console.log('Context sources:', msg.contextSources)
})

// Get real-time participant info
const participants = session.getParticipants()
// => [{ id, name, status: 'online'|'typing'|'idle', role }]