skills/cpfiffer/central/using-letta-api

using-letta-api

SKILL.md

Using Letta API for Self-Management

This skill provides runnable Python snippets for self-modification via the Letta API.

Setup

from letta_client import Letta
client = Letta(base_url='https://api.letta.com')

# Your agent ID (from environment or hardcoded)
import os
AGENT_ID = os.environ.get('LETTA_AGENT_ID', 'agent-xxx')

Quick Reference

Task Reference File
Disable sleeptime, change model, update config self-management.md
Create, deploy, message subagents subagents.md
List, create, update, delete memory blocks memory-blocks.md

Common Patterns

Disable Sleeptime

client.agents.update(AGENT_ID, enable_sleeptime=False)

Message a Subagent

response = client.agents.messages.create(
    agent_id='agent-xxx-subagent-id',
    messages=[{'role': 'user', 'content': 'Your task here'}]
)
print(response.messages[-1].content)

Update a Memory Block

client.agents.blocks.update(
    'block-label',
    agent_id=AGENT_ID,
    value='New content here'
)

When to Use API vs Other Methods

Method Use When
Letta API Modifying subagents, agent config, programmatic block updates
memfs (file edits) Updating your own memory blocks (auto-syncs)
Task tool Deploying subagents for work (preferred for most tasks)

Load the reference files as needed for detailed patterns.

Weekly Installs
12
GitHub Stars
18
First Seen
Feb 13, 2026
Installed on
opencode12
gemini-cli12
claude-code12
github-copilot12
codex12
kimi-cli12