Skip to main content

Overview

File: src/tools/UserDataTool.ts Tools demonstrating the User API as a persistent per-user storage layer — from simple profile reads to multi-step onboarding state machines.

Tools Included

GetUserDataTool

Retrieve current user’s information.

UpdateUserDataTool

Update user profile information.

Use Cases

Onboarding State Machine (Persistent Across Sessions)

The most powerful use of the User API — track multi-step workflows that persist across conversations. If a user leaves mid-onboarding and comes back days later, your agent picks up exactly where they left off.

Personalized Greeting

User Preferences

Using save() Method (New!)

Sending Messages to Users (New!)

Sending Images and Files (New!)

What You’ll Learn

Persistent State

Store onboarding progress, workflow state, and custom data across sessions

State Machines

Build multi-step flows that resume where the user left off

Platform APIs

Using Lua’s built-in User API

save() Method

Simpler workflow for multiple changes

Messaging Users

Send proactive notifications

Media Support

Send images and files to users

Next Steps

User API Reference

Complete API documentation

Products Example

See CRUD operations