GitHub
Examples

Procedural Memory

Define reusable workflows and 'skills' that the agent can execute.

Core Module
Scenario: Morning Check-in Routine

When to Use

Use procedural memory when your agent needs to follow a standard operating procedure (SOP) or execute a defined skill. Perfect for:

  • Standard workflows (e.g., "Onboarding", "Troubleshooting")
  • Checklists and step-by-step guides
  • Tracking the success/failure of specific actions

Key Operations

create()

Define a new procedure template

execute()

Log an execution of a procedure

Code Example

We define a "Morning Check-in" procedure that the companion agent should follow every day.

# 1. Define the Procedure
procedure_steps = [
"Recall user's last mood",
"Greet warmly based on time of day",
"Ask about today's primary goal",
"Offer one relevant tip"
]
client.memory.procedures.create(
procedure_id="morning_checkin",
name="Morning Wellness Check",
steps=procedure_steps,
description="Daily routine to start the user's day correctly"
)
# 2. Execute the Procedure
# When the agent runs this workflow, we log it
client.memory.procedures.execute(
procedure_id="morning_checkin",
inputs={
"user_mood": "anxious",
"time": "09:00 AM"
},
context={"session_id": "session_week1_day4"}
)

Key Takeaways

  • Procedural memory stores "how-to" knowledge.
  • By logging executions, you build a history of which procedures are used most and how often they succeed.
  • This helps separate the "logic" of a task from the general conversation flow.