Agent Chat History

A comprehensive chat history component that displays conversation sessions with search, filtering, and management capabilities.

Features

  • Session Management: View and manage multiple chat sessions
  • Search Functionality: Search through conversations by title or content
  • Filtering Options: Filter by starred or archived sessions
  • Message Preview: View full conversation history for selected sessions
  • Actions: Star, archive, export, and delete sessions
  • Token Tracking: Display token usage per message
  • Time Formatting: Smart date/time display (Today, Yesterday, etc.)

Examples

Basic Chat History

A complete chat history interface with sessions list and message preview.

Building a React App

2 messages | Updated Today

You15 tokens

Can you help me build a simple React app with TypeScript?

Assistantgpt-428 tokens

I'd be happy to help you build a React app with TypeScript! Let me guide you through the process step by step.

Installation

npx shadcn@latest add "https://agents-ui.github.io/agents-kit/c/agent-chat-history.json"

API Reference

AgentChatHistory

PropTypeDefaultDescription
sessionsChatSession[]-Array of chat sessions
selectedSessionIdstring-ID of the currently selected session
onSelectSession(session: ChatSession) => void-Callback when a session is selected
onDeleteSession(sessionId: string) => void-Callback to delete a session
onStarSession(sessionId: string) => void-Callback to star/unstar a session
onArchiveSession(sessionId: string) => void-Callback to archive a session
onExportSession(sessionId: string) => void-Callback to export a session
classNamestring-Additional CSS classes

ChatSession

PropertyTypeRequiredDescription
idstringYesUnique session identifier
titlestringYesSession title
messagesChatMessage[]YesArray of messages in the session
createdAtDateYesSession creation date
updatedAtDateYesLast update date
starredbooleanNoWhether session is starred
archivedbooleanNoWhether session is archived

ChatMessage

PropertyTypeRequiredDescription
idstringYesUnique message identifier
role"user" | "assistant"YesMessage sender role
contentstringYesMessage content
timestampDateYesMessage timestamp
tokensnumberNoToken count for the message
modelstringNoModel used (for assistant messages)