Conversation State Playground

Test conversation management with history tracking, auto-summarization, and context injection.

You are a helpful customer support agent for a SaaS product.

Injected Context

{
  "product": "AgentKit Pro",
  "tier": "Enterprise"
}

State

Messages0
Est. tokens0
SummaryNone

Manager Config

Max messages50
Summarize after15 messages
Context window8 messages
PersistenceIn-memory

Start a conversation to test state management

Code Example

import { ConversationManager, MemoryPersistenceAdapter } from 'agent-tools-kit/conversation'

const manager = new ConversationManager({
  model: 'openai/gpt-4o-mini',
  maxMessages: 50,
  summarizeAfter: 20,
  persistenceAdapter: new MemoryPersistenceAdapter(),
})

// Add messages
await manager.addMessage(conversationId, { role: 'user', content: 'Hello!' })

// Get context with automatic summarization
const { summary, messages } = await manager.getMessagesForContext(conversationId)

// Inject domain context
await manager.injectContext(conversationId, { product: 'AgentKit Pro' })