Skip to main content
The Runflow Context is a global singleton that manages execution information and user identification. It allows you to identify once and all agents/workflows automatically use this context.

Why Identify Matters

When you call identify(), you’re telling Runflow who is interacting with your agent. This single call connects three critical systems:
  • Memory — conversation history is stored and retrieved by this identifier. Same identifier = same conversation history.
  • Traces — all execution traces are linked to this user, so you can search and filter by user in the dashboard.
  • Metrics — business events emitted with track() are associated with this user.
Without identify(), your agent still works, but memory won’t persist correctly between sessions and your dashboard data won’t be linked to specific users.

Basic Usage

Smart Identification (Auto-Detection)

New in v2.1: The identify() function now auto-detects entity type from value format:
Supported patterns:
  • Email: Standard RFC 5322 format
  • Phone: E.164 format (with/without +, with/without formatting)
  • UUID: Standard UUID v1-v5
  • URL: With or without protocol
  • Fallback: Generic id type for custom identifiers

Explicit Identification

For custom entity types or when auto-detection is not desired:

Common Patterns

WhatsApp / Phone Integration

The phone number is the natural identifier. Memory persists across all conversations with the same number:

Email-Based

For web apps or email integrations:

Multi-Conversation

When the same user can have multiple independent conversations (e.g., different support tickets):

Integration Webhooks

Parse the identifier from the webhook payload:

Backward Compatibility

The old Runflow.identify() API still works but is not recommended. Prefer the direct import:

State Management

Next Steps

Best Practices

Identify patterns and more tips

Memory

Learn about memory management

Observability

Track execution with observability

Quick Start

See identify in action