Skip to content
Sign up
Reference

CLI reference

Command-line options and flags for Letta Code

Terminal window
letta [options] [-p "prompt"]
FlagDescription
lettaStart interactive session (resumes last used agent, or creates new)
letta --newForce create a new agent
letta --from-af <path>Create new agent from an AgentFile (.af)
letta --agent <id>Use a specific agent by ID
letta --name <name>, -nResume agent by name (matches pinned or recent agents)
letta --infoShow project info, skills directory, and pinned agents (without starting session)
letta --helpShow help
letta --versionShow version
FlagDescription
--model <model>, -mSpecify model (e.g., sonnet-4.5, gpt-5-codex)
--system <preset>Use a system prompt preset (e.g., letta-claude, codex)
--system-custom <text>Use a custom system prompt string (for new agents)
--system-append <text>Append text to the resolved system prompt (for new agents)
--toolset <name>Force toolset: default, codex, or gemini
--skills <path>Custom skills directory
--sleeptimeEnable sleeptime memory management (only for new agents)

Run Letta Code non-interactively for automation and CI/CD. See Headless mode for detailed usage.

FlagDescription
-p "prompt"Run a one-off prompt (headless mode)
--output-format <fmt>Output format: text, json, or stream-json
--input-format <fmt>Input format: stream-json for bidirectional mode
--yoloBypass all permission prompts
--permission-mode <mode>Set permission mode
--tools "Tool1,Tool2"Limit available tools
--allowedTools "..."Allow specific tool patterns
--disallowedTools "..."Block specific tool patterns

Configure memory blocks when creating new agents.

FlagDescription
--init-blocks <names>Comma-separated preset block names (e.g., "persona,project")
--memory-blocks <json>JSON array of custom memory blocks
--block-value <label>=<value>Set value for a preset block (can be specified multiple times)
FlagDescription
letta updateManually check and install updates
VariableDescription
LETTA_API_KEYAPI key for authentication (get yours at app.letta.com/api-keys)
LETTA_BASE_URLBase URL for self-hosted Letta server (e.g., http://localhost:8283)
LETTA_DEBUGSet to 1 to enable debug logging
LETTA_CODE_TELEMSet to 0 to disable anonymous telemetry
DISABLE_AUTOUPDATERSet to 1 to disable auto-updates

Set these in your shell profile (~/.bashrc, ~/.zshrc) or .env file:

Terminal window
export LETTA_API_KEY="your-key-here"
export LETTA_BASE_URL="http://localhost:8283"

These shortcuts work during interactive sessions.

ShortcutDescription
/Open command autocomplete
@Open file autocomplete
!Enter bash mode (run shell commands directly)
TabAutocomplete command or file path
Shift+EnterInsert newline (multi-line input)
/ Navigate history or menu items
EscCancel dialog or clear input (double press)
Ctrl+CInterrupt operation or exit (double press)
Ctrl+VPaste content or image

Bash mode lets you run shell commands directly without involving the agent. Press ! on an empty input line to enter bash mode (prompt changes to !), type your command, and press Enter. Press Backspace on an empty line to exit bash mode.