@letta-ai/letta-code 0.1.9 → 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 +41 -14
- package/letta.js +1112 -406
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -13,7 +13,7 @@ Letta Code is a command-line harness around the stateful Letta [Agents API](http
|
|
|
13
13
|
Letta Code is model agnostic, and supports Sonnet 4.5, GPT-5, Gemini 2.5, GLM-4.6, and more.
|
|
14
14
|
|
|
15
15
|
> [!IMPORTANT]
|
|
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
|
|
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.
|
|
17
17
|
|
|
18
18
|
## Quickstart
|
|
19
19
|
|
|
@@ -51,7 +51,7 @@ Letta Code uses a hierarchical memory system with both global and local blocks:
|
|
|
51
51
|
**Local** (`./.letta/settings.json`)
|
|
52
52
|
- `project` block - stores project-specific context
|
|
53
53
|
|
|
54
|
-
### Starting Letta
|
|
54
|
+
### Starting Letta Code
|
|
55
55
|
|
|
56
56
|
```bash
|
|
57
57
|
letta # New agent (attaches to existing memory blocks or creates new)
|
|
@@ -74,31 +74,35 @@ letta --agent <id> # Open specific agent
|
|
|
74
74
|
|
|
75
75
|
### Headless Mode
|
|
76
76
|
```bash
|
|
77
|
-
letta -p "
|
|
78
|
-
letta -p "
|
|
79
|
-
letta -p "
|
|
80
|
-
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
|
|
81
81
|
|
|
82
82
|
# Pipe input from stdin
|
|
83
83
|
echo "Explain this code" | letta -p
|
|
84
84
|
cat file.txt | letta -p
|
|
85
|
-
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)
|
|
86
90
|
```
|
|
87
91
|
|
|
88
92
|
You can also use the `--tools` flag to control the underlying *attachment* of tools (not just the permissions).
|
|
89
93
|
Compared to disallowing the tool, this will additionally remove the tool schema from the agent's context window.
|
|
90
94
|
```bash
|
|
91
|
-
letta -p "
|
|
92
|
-
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)
|
|
93
97
|
```
|
|
94
98
|
|
|
95
|
-
Use `--output-format json` to get
|
|
99
|
+
Use `--output-format json` to get structured output with metadata:
|
|
96
100
|
```bash
|
|
97
101
|
# regular text output
|
|
98
102
|
$ letta -p "hi there"
|
|
99
103
|
Hi! How can I help you today?
|
|
100
104
|
|
|
101
|
-
# structured output
|
|
105
|
+
# structured output (single JSON object at end)
|
|
102
106
|
$ letta -p "hi there" --output-format json
|
|
103
107
|
{
|
|
104
108
|
"type": "result",
|
|
@@ -108,14 +112,32 @@ $ letta -p "hi there" --output-format json
|
|
|
108
112
|
"duration_api_ms": 2098,
|
|
109
113
|
"num_turns": 1,
|
|
110
114
|
"result": "Hi! How can I help you today?",
|
|
111
|
-
"
|
|
115
|
+
"agent_id": "agent-8ab431ca-63e0-4ca1-ba83-b64d66d95a0f",
|
|
112
116
|
"usage": {
|
|
113
|
-
"
|
|
114
|
-
"
|
|
117
|
+
"prompt_tokens": 294,
|
|
118
|
+
"completion_tokens": 97,
|
|
119
|
+
"total_tokens": 391
|
|
115
120
|
}
|
|
116
121
|
}
|
|
117
122
|
```
|
|
118
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":{...}}
|
|
139
|
+
```
|
|
140
|
+
|
|
119
141
|
### Permissions
|
|
120
142
|
|
|
121
143
|
**Tool selection** (controls which tools are loaded):
|
|
@@ -151,6 +173,11 @@ Permissions are also configured in `.letta/settings.json`:
|
|
|
151
173
|
}
|
|
152
174
|
```
|
|
153
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
|
+
|
|
154
181
|
## Installing from source
|
|
155
182
|
|
|
156
183
|
First, install Bun if you don't have it yet: [https://bun.com/docs/installation](https://bun.com/docs/installation)
|