Skip to content

feat: add optional conversation title generation on conversation crea…#986

Merged
omeraplak merged 1 commit into
mainfrom
feat/conversation-title
Jan 23, 2026
Merged

feat: add optional conversation title generation on conversation crea…#986
omeraplak merged 1 commit into
mainfrom
feat/conversation-title

Conversation

@omeraplak

@omeraplak omeraplak commented Jan 23, 2026

Copy link
Copy Markdown
Member

…tion #981

PR Checklist

Please check if your PR fulfills the following requirements:

Bugs / Features

What is the current behavior?

What is the new behavior?

fixes (issue)

Notes for reviewers


Summary by cubic

Adds optional auto-generation of conversation titles at creation using the first user message. Titles use the agent’s model by default (or an override), respect max length, and align with Linear issue #981.

  • New Features

    • MemoryConfig.generateTitle: boolean or config with model, systemPrompt, maxLength, maxOutputTokens.
    • Title is generated once when the conversation is created; existing titles are never overwritten.
    • Agent adds an LLM operation “generateTitle” with sensible defaults and tracing.
    • Examples, tests, and docs updated.
  • Migration

    • Off by default. Enable via Memory({ generateTitle: true }) or provide a config.

Written for commit 069a00e. Summary will update on new commits.

Summary by CodeRabbit

Release Notes

  • New Features

    • Added optional automatic conversation title generation when conversations are created. Titles are intelligently derived from the first user message with configurable length limits and customizable models, system prompts, and token constraints via the generateTitle option in Memory construction.
  • Documentation

    • Updated documentation describing the new conversation title generation capability and configuration options.

✏️ Tip: You can customize this high-level summary in your review settings.

@changeset-bot

changeset-bot Bot commented Jan 23, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 069a00e

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@voltagent/core Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@omeraplak omeraplak linked an issue Jan 23, 2026 that may be closed by this pull request
@ghost

This comment has been minimized.

@coderabbitai

coderabbitai Bot commented Jan 23, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

Introduces a new optional feature to automatically generate conversation titles upon creation. The title is derived from the first user message, respects configurable length and model parameters, and integrates with the Memory configuration and Agent lifecycle through a titleGenerator function passed to the MemoryManager.

Changes

Cohort / File(s) Summary
Memory Configuration & Types
packages/core/src/memory/types.ts, packages/core/src/memory/index.ts
Added new exported types ConversationTitleConfig and ConversationTitleGenerator to enable configurable title generation. Extended MemoryConfig with new generateTitle option. Added public getTitleGenerationConfig() getter to Memory class.
Core Agent Title Generation
packages/core/src/agent/agent.ts
Integrated title generation into Agent lifecycle: creates titleGenerator from memory config, passes it to MemoryManager, adds default prompts and sanitization utility, extends LLM operation type with "generateTitle", and adds labeled span support for observable title-generation calls.
Agent Operation Types
packages/core/src/agent/types.ts
Extended AgentEvalOperationType union to include "generateTitle" as a new operation variant.
Memory Manager Title Logic
packages/core/src/memory/manager/memory-manager.ts
Implemented title generation in MemoryManager: added optional titleGenerator parameter to constructor, introduced resolveConversationTitle() helper for fallback logic, updated ensureConversationExists() to accept input parameter and resolve titles dynamically instead of using static defaults.
Memory Manager Testing
packages/core/src/memory/manager/memory-manager.spec.ts
Added test case verifying titleGenerator injection and invocation during conversation creation.
Documentation & Examples
website/docs/agents/memory/overview.md, website/docs/api/endpoints/memory.md, examples/base/src/index.ts
Added "Conversation Titles (Optional)" documentation section with usage examples and configuration details. Clarified API behavior for optional title field. Updated example to enable generateTitle: true.
Version Tracking
.changeset/ten-lines-repair.md
Added changelog entry documenting patch-level version bump for @voltagent/core.

Sequence Diagram

sequenceDiagram
    participant Agent
    participant MemoryMgr as MemoryManager
    participant Memory
    participant LLMSpan as LLM Span
    participant Model as Language Model

    Agent->>Agent: createConversationTitleGenerator(memory)
    Agent->>MemoryMgr: new MemoryManager(..., titleGenerator)
    
    Note over Agent,Model: User message saved to new conversation
    MemoryMgr->>MemoryMgr: saveMessage(context, userMessage)
    MemoryMgr->>MemoryMgr: ensureConversationExists(context, userId, convId, input)
    MemoryMgr->>MemoryMgr: resolveConversationTitle(context, input, "Conversation")
    
    alt generateTitle enabled
        MemoryMgr->>LLMSpan: createLLMSpan(op: "generateTitle", label: "Generate Conversation Title")
        LLMSpan->>Model: generateText(systemPrompt, firstUserMessage, maxTokens)
        Model-->>LLMSpan: generated title text
        LLMSpan-->>MemoryMgr: title (sanitized & length-limited)
    else generateTitle disabled
        MemoryMgr->>MemoryMgr: return fallback title "Conversation"
    end
    
    MemoryMgr->>Memory: createConversation(title)
    Memory-->>MemoryMgr: conversation created
    MemoryMgr-->>Agent: save complete
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

Poem

🐰 Whiskers twitch with delight!
Conversations now wear fitting titles bright,
From first words, a summary takes flight,
No more "Conversation" plain in sight—
Our chats are born with names just right!

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main feature being added: optional conversation title generation on conversation creation.
Description check ✅ Passed The description follows the template structure with all required sections completed: checklist items marked, current/new behavior documented, related issue linked, and changeset added.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 10 files

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying voltagent with  Cloudflare Pages  Cloudflare Pages

Latest commit: 069a00e
Status: ✅  Deploy successful!
Preview URL: https://136418bc.voltagent.pages.dev
Branch Preview URL: https://feat-conversation-title.voltagent.pages.dev

View logs

@omeraplak
omeraplak merged commit 850b5bb into main Jan 23, 2026
23 checks passed
@omeraplak
omeraplak deleted the feat/conversation-title branch January 23, 2026 21:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make use of the title field of the conversation.

1 participant