Functor SDK Examples
Short, focused 'Guide for Dummies' examples demonstrating each capability of the Functor SDK.
Start Here
These examples follow the story of Emma (User ID: emma_2024) and her Personal AI Companion. While you can run the Python scripts directly from the functor_examples directory, these pages explain the concepts behind the code.
The Scenario
We simulate a Personal AI Companion for a user named Emma. The data spans 3 weeks of interactions, allowing us to demonstrate temporal memory, knowledge evolution, and long-term recall.
- Week 1 (Onboarding): Emma introduces herself, her new job as a PM, and her initial stress.
- Week 2 (Conflict & Growth): Work challenges with "ProjectX", family health scare (Nana Rose), and starting a running tracking habit.
- Week 3 (Resolution): Project success, family recovery, and reflecting on progress.
Data Structure
The examples utilize a structured JSON dataset (companion_conversations.json) that mimics real-world application state.
{
"user_profile": {
"user_id": "emma_2024",
"name": "Emma",
"timezone": "America/New_York"
},
"conversations": [
{
"session_id": "session_week1_day1",
"date": "2024-11-04",
"messages": [
{ "role": "user", "content": "I just started a new job..." }
],
"extracted_facts": [
{ "type": "job", "value": "Product Manager" }
]
}
]
}Example Modules
Episodic Memory
Learn how to store and search temporal interaction events like conversations.
CoreSemantic Memory
Extract and store general knowledge facts from interactions.
CoreProcedural Memory
Define and execute reusable workflow procedures.
StorageShort-term Memory
Manage session-scoped temporary buffers for immediate context.
StorageLong-term Memory
Archive consolidated memories for persistent storage.
LifecyclePruning
Manage memory lifecycle with intelligent forgetting policies.
IntelligencePersonalization
Infer and store user preferences to adapt behavior.
IntelligenceRollout
Simulate future scenarios using rollout memory.
OpsObservability
Monitor memory health, access logs, and usage metrics.
OpsMulti-Tenant
Isolate data and manage quotas for multiple tenants.
AdvancedCombined Workflow
See the full memory cycle in an end-to-end example.