@letta-ai/letta-code 0.1.8 → 0.1.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +64 -11
- package/letta.js +3912 -1636
- package/package.json +5 -3
package/README.md
CHANGED
|
@@ -10,8 +10,10 @@ https://github.com/user-attachments/assets/5561a3ff-afd9-42a9-8601-55d245946394
|
|
|
10
10
|
|
|
11
11
|
Letta Code is a command-line harness around the stateful Letta [Agents API](https://docs.letta.com/api-reference/overview). You can use Letta Code to create and connect with any Letta agent (even non-coding agents!) - Letta Code simply gives your agents the ability to interact with your local dev environment, directly in your terminal.
|
|
12
12
|
|
|
13
|
+
Letta Code is model agnostic, and supports Sonnet 4.5, GPT-5, Gemini 2.5, GLM-4.6, and more.
|
|
14
|
+
|
|
13
15
|
> [!IMPORTANT]
|
|
14
|
-
> Letta Code is a **research preview** in active development, and may have bugs or unexpected issues. To learn more about the roadmap and chat with the dev team, visit our [Discord](https
|
|
16
|
+
> Letta Code is a **research preview** in active development, and may have bugs or unexpected issues. To learn more about the roadmap and chat with the dev team, visit our [Discord](https://discord.gg/letta). Contributions welcome, join the fun.
|
|
15
17
|
|
|
16
18
|
## Quickstart
|
|
17
19
|
|
|
@@ -49,7 +51,7 @@ Letta Code uses a hierarchical memory system with both global and local blocks:
|
|
|
49
51
|
**Local** (`./.letta/settings.json`)
|
|
50
52
|
- `project` block - stores project-specific context
|
|
51
53
|
|
|
52
|
-
### Starting Letta
|
|
54
|
+
### Starting Letta Code
|
|
53
55
|
|
|
54
56
|
```bash
|
|
55
57
|
letta # New agent (attaches to existing memory blocks or creates new)
|
|
@@ -72,22 +74,68 @@ letta --agent <id> # Open specific agent
|
|
|
72
74
|
|
|
73
75
|
### Headless Mode
|
|
74
76
|
```bash
|
|
75
|
-
letta -p "
|
|
76
|
-
letta -p "
|
|
77
|
-
letta -p "
|
|
78
|
-
letta -p "
|
|
77
|
+
letta -p "Run bun lint and correct errors" # Run non-interactive
|
|
78
|
+
letta -p "Pick up where you left off" --continue # Continue previous session
|
|
79
|
+
letta -p "Run all the test" --allowedTools "Bash" # Control tool permissions
|
|
80
|
+
letta -p "Just read the code" --disallowedTools "Bash" # Control tool permissions
|
|
79
81
|
|
|
80
82
|
# Pipe input from stdin
|
|
81
83
|
echo "Explain this code" | letta -p
|
|
82
84
|
cat file.txt | letta -p
|
|
83
|
-
gh pr diff 123 | letta -p --yolo
|
|
85
|
+
gh pr diff 123 | letta -p --yolo
|
|
86
|
+
|
|
87
|
+
# Output formats
|
|
88
|
+
letta -p "Analyze this codebase" --output-format json # Structured JSON at end
|
|
89
|
+
letta -p "Analyze this codebase" --output-format stream-json # JSONL stream (one event per line)
|
|
84
90
|
```
|
|
85
91
|
|
|
86
92
|
You can also use the `--tools` flag to control the underlying *attachment* of tools (not just the permissions).
|
|
87
93
|
Compared to disallowing the tool, this will additionally remove the tool schema from the agent's context window.
|
|
88
94
|
```bash
|
|
89
|
-
letta -p "
|
|
90
|
-
letta -p "analyze code" --tools ""
|
|
95
|
+
letta -p "Run all tests" --tools "Bash,Read" # Only load specific tools
|
|
96
|
+
letta -p "Just analyze the code" --tools "" # No tools (analysis only)
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Use `--output-format json` to get structured output with metadata:
|
|
100
|
+
```bash
|
|
101
|
+
# regular text output
|
|
102
|
+
$ letta -p "hi there"
|
|
103
|
+
Hi! How can I help you today?
|
|
104
|
+
|
|
105
|
+
# structured output (single JSON object at end)
|
|
106
|
+
$ letta -p "hi there" --output-format json
|
|
107
|
+
{
|
|
108
|
+
"type": "result",
|
|
109
|
+
"subtype": "success",
|
|
110
|
+
"is_error": false,
|
|
111
|
+
"duration_ms": 5454,
|
|
112
|
+
"duration_api_ms": 2098,
|
|
113
|
+
"num_turns": 1,
|
|
114
|
+
"result": "Hi! How can I help you today?",
|
|
115
|
+
"agent_id": "agent-8ab431ca-63e0-4ca1-ba83-b64d66d95a0f",
|
|
116
|
+
"usage": {
|
|
117
|
+
"prompt_tokens": 294,
|
|
118
|
+
"completion_tokens": 97,
|
|
119
|
+
"total_tokens": 391
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
Use `--output-format stream-json` to get streaming outputs, in addition to a final JSON response.
|
|
125
|
+
This is useful if you need to have data flowing to prevent automatic timeouts:
|
|
126
|
+
```bash
|
|
127
|
+
# streaming JSON output (JSONL - one event per line, token-level streaming)
|
|
128
|
+
# Note: Messages are streamed at the token level - each chunk has the same otid and incrementing seqId.
|
|
129
|
+
$ letta -p "hi there" --output-format stream-json
|
|
130
|
+
{"type":"init","agent_id":"agent-...","model":"claude-sonnet-4-5-20250929","tools":[...]}
|
|
131
|
+
{"type":"message","messageType":"reasoning_message","reasoning":"The user is asking","otid":"...","seqId":1}
|
|
132
|
+
{"type":"message","messageType":"reasoning_message","reasoning":" me to say hello","otid":"...","seqId":2}
|
|
133
|
+
{"type":"message","messageType":"reasoning_message","reasoning":". This is a simple","otid":"...","seqId":3}
|
|
134
|
+
{"type":"message","messageType":"reasoning_message","reasoning":" greeting.","otid":"...","seqId":4}
|
|
135
|
+
{"type":"message","messageType":"assistant_message","content":"Hi! How can I help you today?","otid":"...","seqId":5}
|
|
136
|
+
{"type":"message","messageType":"stop_reason","stopReason":"end_turn"}
|
|
137
|
+
{"type":"message","messageType":"usage_statistics","promptTokens":294,"completionTokens":97,"totalTokens":391}
|
|
138
|
+
{"type":"result","subtype":"success","result":"Hi! How can I help you today?","agent_id":"agent-...","usage":{...}}
|
|
91
139
|
```
|
|
92
140
|
|
|
93
141
|
### Permissions
|
|
@@ -125,6 +173,11 @@ Permissions are also configured in `.letta/settings.json`:
|
|
|
125
173
|
}
|
|
126
174
|
```
|
|
127
175
|
|
|
176
|
+
## Self-hosting
|
|
177
|
+
|
|
178
|
+
To use Letta Code with a self-hosted server, set `LETTA_BASE_URL` to your server IP, e.g. `export LETTA_BASE_URL="http://localhost:8283"`.
|
|
179
|
+
See our [self-hosting guide](https://docs.letta.com/guides/selfhosting) for more information.
|
|
180
|
+
|
|
128
181
|
## Installing from source
|
|
129
182
|
|
|
130
183
|
First, install Bun if you don't have it yet: [https://bun.com/docs/installation](https://bun.com/docs/installation)
|
|
@@ -135,8 +188,8 @@ First, install Bun if you don't have it yet: [https://bun.com/docs/installation]
|
|
|
135
188
|
bun install
|
|
136
189
|
|
|
137
190
|
# run the CLI from TypeScript sources (pick up changes immediately)
|
|
138
|
-
bun run dev
|
|
139
|
-
bun run dev
|
|
191
|
+
bun run dev
|
|
192
|
+
bun run dev -- -p "Hello world" # example with args
|
|
140
193
|
```
|
|
141
194
|
|
|
142
195
|
### Build + link the standalone binary
|