Letta Quick Reference
Section titled “Letta Quick Reference”Quick reference for Letta APIs. For detailed documentation, see docs.letta.com.
Installation
Section titled “Installation”pip install letta # Serverpip install letta-client # Python SDKServer
Section titled “Server”letta server # Start on :8283Client
Section titled “Client”from letta_client import Letta
client = Letta(base_url="http://localhost:8283")Common Operations
Section titled “Common Operations”Agents
Section titled “Agents”# Createagent = client.agents.create( name="my-agent", model="openai/gpt-4o-mini", embedding="openai/text-embedding-3-small", memory_blocks=[ {"label": "persona", "value": "I am..."}, {"label": "human", "value": "User info..."}, ],)
# Listagents = client.agents.list()
# Getagent = client.agents.retrieve(agent_id)
# Deleteclient.agents.delete(agent_id)Messages
Section titled “Messages”# Synchronousresponse = client.agents.messages.create( agent_id=agent.id, input="Hello!")
# Streamingwith client.agents.messages.stream( agent_id=agent.id, input="Hello!",) as stream: for chunk in stream: print(chunk)Memory
Section titled “Memory”# Core memoryblocks = client.agents.core_memory.list(agent_id)client.agents.core_memory.update(agent_id, block_id, value="...")
# Archival memoryclient.agents.archival_memory.insert(agent_id, text="...")results = client.agents.archival_memory.search(agent_id, query="...")# Create from functiontool = client.tools.upsert_from_function(func=my_function)
# Attach to agentclient.agents.tools.attach(agent_id, tool_id)Model Formats
Section titled “Model Formats”# LLM models"openai/gpt-4o-mini""anthropic/claude-3-5-sonnet""ollama/llama2:7b"
# Embedding models"openai/text-embedding-3-small""letta/letta-free"Environment Variables
Section titled “Environment Variables”OPENAI_API_KEY=sk-...ANTHROPIC_API_KEY=sk-ant-...LETTA_BASE_URL=http://localhost:8283Official Documentation
Section titled “Official Documentation”| Topic | Link |
|---|---|
| Getting Started | docs.letta.com/quickstart |
| Core Concepts | docs.letta.com/core-concepts |
| Agent Memory | docs.letta.com/guides/agents/memory |
| Streaming | docs.letta.com/guides/agents/streaming |
| Tools | docs.letta.com/guides/agents/tools |
| REST API | docs.letta.com/api-reference |
Version Compatibility
Section titled “Version Compatibility”YouLab requires letta>=0.6.0. Current stable: 0.10.x
See GitHub releases for changelog.
Related Pages
Section titled “Related Pages”- Letta Integration - YouLab-specific patterns
- Configuration - Environment setup