Skip to main content
Cedar’s mention system allows users to reference specific data, people, or objects in their messages using @ symbols. This provides a natural way to give agents precise context about what the user is referring to.

State-Based Mentions using useStateBasedMentionProvider

Prerequisite – the state referenced by stateKey must already be registered in Cedar with useCedarState or useRegisterState.
Automatically allows the user to @ mention any registered state items. The state must first be a cedarState. See the Agentic State documentation.
This keeps all mentionable data in the unified Cedar store and makes it automatically available to the agent. State-based mention providers take in the following configuration options:

Custom Rendering

Customize how mentions appear in different contexts:

Multiple Mention Types

Support different mention triggers:

Contextual Mentions

Show different mentions based on context:

Ordering Mentions

When you have multiple mention providers or context subscriptions, you can control their display order using the order property. This ensures the most important context appears first in the UI.

Order Property

The order property (optional) determines the display order of context badges:
  • Lower numbers appear first: order: 1 appears before order: 10
  • Default behavior: Items without an order appear last
  • Applies to both: Mention providers and useSubscribeInputContext

Example: Prioritized Mentions

Custom Provider with Order

When using useStateBasedMentionProvider, include order:

Best Practices for Ordering

  1. Reserve low numbers (1-9) for critical context like user info
  2. Use 10-49 for active/selected items
  3. Use 50-99 for general mentions
  4. Use 100+ for archived or low-priority items
  5. Leave gaps between orders for future additions

Mention Data in Context

Access mentioned items in your agent context:

Next Steps