Overview
The Data API allows you to store custom data in collections with powerful semantic search capabilities using vector embeddings. Returns DataEntryInstance objects with direct property access.Data is agent-owned collection storage: a collection can contain many independent entries. For one persistent record tied to a particular end user, use the User API instead.
Direct Access
Access
entry.title not entry.data.titleSearch Scores
Results include relevance scores
Instance Methods
Built-in
update(), patch(), unset(), save(), and delete()Array Methods
Use
.map(), .filter() on search resultsReturn Shape Reference
Quick examples:
Key Features
Custom Collections
Store any JSON data in named collections
Vector Search
Semantic similarity search using AI embeddings
Flexible Schema
No fixed schema - store any structure
Filtering
Query by field values with operators
Methods
create()
Create a new entry in a collection.string
required
Name of the collection (e.g., ‘movies’, ‘customers’, ‘articles’)
object
required
Any JSON-serializable object to store
string
Text to index for vector search. Include all searchable content.
search()
Semantic search using vector embeddings.string
required
Name of the collection to search
string
required
Search text (natural language query)
number
default:10
Maximum number of results to return
number
Minimum similarity score (0-1). Higher = more similar.
DataEntryInstance objects, each with a score property.
Similarity Scores:
1.0= Perfect match0.8-0.9= Very similar0.6-0.7= Somewhat similar<0.6= Low similarity
get()
Retrieve entries with optional filtering and pagination.string
required
Name of the collection
object
Bounded filter criteria for fields stored in the entry’s
data objectnumber
default:1
Page number (1-indexed)
number
default:10
Items per page (maximum 100)
getEntry()
Retrieve a specific entry by ID.update()
Update an existing entry.string
required
Name of the collection
string
required
ID of the entry to update
object
required
Data to merge with existing entry
string
Optional new text for vector search indexing
Updates merge with existing data. Only the specified fields are updated; other fields are preserved.
DataEntryInstance Methods
When you retrieve or create data entries, you get aDataEntryInstance object with convenient instance methods.
save()
Save the current state of the data entry to the server. This is a convenience method that persists all changes made to the entry.string
Optional new text for vector search indexing
true if successful
Example:
The
save() method provides a simpler workflow - modify properties then save, rather than calling Data.update() with the collection name and entry ID.update() (Instance Method)
Update the entry using the instance method.patch() and unset()
Atomically set and remove top-level fields from an entry. You can also replace the semantic-search text, or clear it withnull.
searchText is changed in the same request. set and unset cannot contain the same field, and field names must be non-empty and cannot start with $ or contain . or a null byte.
null is a stored value inside set; use unset for deletion. Existing update() merge behavior is unchanged.
delete() (Instance Method)
Delete the entry using the instance method.Static Methods
delete()
Delete an entry using the static method.Use Cases
Knowledge Base
Customer CRM
Task Management
Filter Operators
Data filters use the platform-wide Lua Query language. The grammar, validation, limits, and errors are identical to every other API that accepts afilter.
Best Practices
Create Rich Search Text
Create Rich Search Text
Include all searchable content in searchText:
Use Appropriate Score Thresholds
Use Appropriate Score Thresholds
0.8+: High precision, few results0.7: Balanced (recommended default)0.6: More results, lower precision<0.6: May return irrelevant results
Structure Data Consistently
Structure Data Consistently
Use consistent field names across entries:
Add Timestamps
Add Timestamps
Track when entries are created/modified:
Vector Search Tips
- What It Is
- Best For
- Tips
Vector search uses AI to understand meaning, not just match keywords.Example:
- Query: “affordable laptop for students”
- Finds: “budget-friendly notebook for college”
- Even though no words match exactly!
If your Data results don’t look right, log the raw return value before transforming it:Then run
lua logs --type skill --limit 5 after sending a test message to see the actual shape at runtime. See the Debugging Skills guide for the full 5-step workflow.Next Steps
Custom Data Examples
See working examples
Build Your First Skill
Complete tutorial using Data API
Debugging Skills
Inspect runtime return values

