lettactl 0.1.1
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/LICENSE +21 -0
- package/README.md +606 -0
- package/dist/commands/apply.d.ts +6 -0
- package/dist/commands/apply.d.ts.map +1 -0
- package/dist/commands/apply.js +337 -0
- package/dist/commands/apply.js.map +1 -0
- package/dist/commands/create.d.ts +13 -0
- package/dist/commands/create.d.ts.map +1 -0
- package/dist/commands/create.js +72 -0
- package/dist/commands/create.js.map +1 -0
- package/dist/commands/delete.d.ts +9 -0
- package/dist/commands/delete.d.ts.map +1 -0
- package/dist/commands/delete.js +179 -0
- package/dist/commands/delete.js.map +1 -0
- package/dist/commands/describe.d.ts +5 -0
- package/dist/commands/describe.d.ts.map +1 -0
- package/dist/commands/describe.js +121 -0
- package/dist/commands/describe.js.map +1 -0
- package/dist/commands/export.d.ts +6 -0
- package/dist/commands/export.d.ts.map +1 -0
- package/dist/commands/export.js +79 -0
- package/dist/commands/export.js.map +1 -0
- package/dist/commands/get.d.ts +5 -0
- package/dist/commands/get.d.ts.map +1 -0
- package/dist/commands/get.js +32 -0
- package/dist/commands/get.js.map +1 -0
- package/dist/commands/import.d.ts +10 -0
- package/dist/commands/import.d.ts.map +1 -0
- package/dist/commands/import.js +94 -0
- package/dist/commands/import.js.map +1 -0
- package/dist/commands/messages.d.ts +21 -0
- package/dist/commands/messages.d.ts.map +1 -0
- package/dist/commands/messages.js +254 -0
- package/dist/commands/messages.js.map +1 -0
- package/dist/commands/update.d.ts +11 -0
- package/dist/commands/update.d.ts.map +1 -0
- package/dist/commands/update.js +63 -0
- package/dist/commands/update.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +230 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/agent-manager.d.ts +125 -0
- package/dist/lib/agent-manager.d.ts.map +1 -0
- package/dist/lib/agent-manager.js +254 -0
- package/dist/lib/agent-manager.js.map +1 -0
- package/dist/lib/agent-resolver.d.ts +12 -0
- package/dist/lib/agent-resolver.d.ts.map +1 -0
- package/dist/lib/agent-resolver.js +27 -0
- package/dist/lib/agent-resolver.js.map +1 -0
- package/dist/lib/block-manager.d.ts +63 -0
- package/dist/lib/block-manager.d.ts.map +1 -0
- package/dist/lib/block-manager.js +288 -0
- package/dist/lib/block-manager.js.map +1 -0
- package/dist/lib/diff-engine.d.ts +129 -0
- package/dist/lib/diff-engine.d.ts.map +1 -0
- package/dist/lib/diff-engine.js +391 -0
- package/dist/lib/diff-engine.js.map +1 -0
- package/dist/lib/error-handler.d.ts +9 -0
- package/dist/lib/error-handler.d.ts.map +1 -0
- package/dist/lib/error-handler.js +25 -0
- package/dist/lib/error-handler.js.map +1 -0
- package/dist/lib/file-content-tracker.d.ts +42 -0
- package/dist/lib/file-content-tracker.d.ts.map +1 -0
- package/dist/lib/file-content-tracker.js +128 -0
- package/dist/lib/file-content-tracker.js.map +1 -0
- package/dist/lib/fleet-parser.d.ts +14 -0
- package/dist/lib/fleet-parser.d.ts.map +1 -0
- package/dist/lib/fleet-parser.js +282 -0
- package/dist/lib/fleet-parser.js.map +1 -0
- package/dist/lib/letta-client.d.ts +61 -0
- package/dist/lib/letta-client.d.ts.map +1 -0
- package/dist/lib/letta-client.js +208 -0
- package/dist/lib/letta-client.js.map +1 -0
- package/dist/lib/output-formatter.d.ts +15 -0
- package/dist/lib/output-formatter.d.ts.map +1 -0
- package/dist/lib/output-formatter.js +51 -0
- package/dist/lib/output-formatter.js.map +1 -0
- package/dist/lib/resource-classifier.d.ts +27 -0
- package/dist/lib/resource-classifier.d.ts.map +1 -0
- package/dist/lib/resource-classifier.js +84 -0
- package/dist/lib/resource-classifier.js.map +1 -0
- package/dist/lib/response-normalizer.d.ts +6 -0
- package/dist/lib/response-normalizer.d.ts.map +1 -0
- package/dist/lib/response-normalizer.js +27 -0
- package/dist/lib/response-normalizer.js.map +1 -0
- package/dist/lib/validators.d.ts +9 -0
- package/dist/lib/validators.d.ts.map +1 -0
- package/dist/lib/validators.js +26 -0
- package/dist/lib/validators.js.map +1 -0
- package/dist/types/fleet-config.d.ts +44 -0
- package/dist/types/fleet-config.d.ts.map +1 -0
- package/dist/types/fleet-config.js +3 -0
- package/dist/types/fleet-config.js.map +1 -0
- package/package.json +61 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,606 @@
|
|
|
1
|
+
# LettaCTL
|
|
2
|
+
|
|
3
|
+
[](https://github.com/letta-ai/lettactl/actions)
|
|
4
|
+
[](https://badge.fury.io/js/lettactl)
|
|
5
|
+
[](https://opensource.org/licenses/MIT)
|
|
6
|
+
[](https://www.typescriptlang.org/)
|
|
7
|
+
|
|
8
|
+
A kubectl-style CLI for managing stateful Letta AI agent fleets with declarative configuration. Think "Docker Compose" but for AI agents - define your entire agent setup in YAML and deploy with one command.
|
|
9
|
+
|
|
10
|
+
## Features
|
|
11
|
+
|
|
12
|
+
- 🚀 **Declarative Configuration** - Define agents in YAML, deploy with one command
|
|
13
|
+
- 🔄 **Smart Updates** - Only updates what actually changed, preserves conversation history
|
|
14
|
+
- 🎯 **Intelligent Change Detection** - Automatically detects file content changes, tool updates, and memory block modifications
|
|
15
|
+
- 🧠 **Fleet Management** - Deploy and manage multiple related agents together
|
|
16
|
+
- 💬 **Message Operations** - Send messages, stream responses, manage conversations
|
|
17
|
+
- 📦 **Resource Sharing** - Share memory blocks and tools across agents
|
|
18
|
+
- 🗑️ **Bulk Operations** - Pattern-based bulk delete with safety previews and shared resource preservation
|
|
19
|
+
- 🔧 **Tool And Documentation Discovery** - Auto-discover custom Python tools & all documents to be pushed to letta folders
|
|
20
|
+
|
|
21
|
+
## Installation & Setup
|
|
22
|
+
|
|
23
|
+
### Prerequisites
|
|
24
|
+
- Node.js 22+
|
|
25
|
+
- pnpm or npm
|
|
26
|
+
- A running Letta server instance
|
|
27
|
+
|
|
28
|
+
### Install and Build
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
# Clone the repository
|
|
32
|
+
git clone <repository-url>
|
|
33
|
+
cd lettactl
|
|
34
|
+
|
|
35
|
+
# Install dependencies
|
|
36
|
+
pnpm install
|
|
37
|
+
# or: npm install
|
|
38
|
+
|
|
39
|
+
# Build the CLI
|
|
40
|
+
pnpm build
|
|
41
|
+
# or: npm run build
|
|
42
|
+
|
|
43
|
+
# Set up your environment
|
|
44
|
+
export LETTA_API_URL=http://localhost:8283 # For self-hosting
|
|
45
|
+
export LETTA_API_KEY=your_api_key # Only needed for Letta Cloud
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
### Running Commands
|
|
49
|
+
|
|
50
|
+
Once built, you can run lettactl in several ways:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
# Using npm/pnpm scripts (recommended for development):
|
|
54
|
+
pnpm start -- get agents
|
|
55
|
+
npm start -- get agents
|
|
56
|
+
|
|
57
|
+
# Using the built binary directly:
|
|
58
|
+
node dist/index.js get agents
|
|
59
|
+
./dist/index.js get agents # if executable
|
|
60
|
+
|
|
61
|
+
# Development mode (with TypeScript):
|
|
62
|
+
pnpm dev get agents
|
|
63
|
+
npm run dev get agents
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
> **Note**: Once we finalize hosting and distribution details, we'll streamline the installation process. For now, these development commands work well for testing and evaluation.
|
|
67
|
+
|
|
68
|
+
### Testing
|
|
69
|
+
|
|
70
|
+
Run the comprehensive test suite:
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
pnpm test
|
|
74
|
+
# or: npm test
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Commands
|
|
78
|
+
|
|
79
|
+
### Deploy Configuration
|
|
80
|
+
```bash
|
|
81
|
+
lettactl apply -f agents.yml # Deploy all agents
|
|
82
|
+
lettactl apply -f agents.yml --agent my-agent # Deploy specific agent
|
|
83
|
+
lettactl apply -f agents.yml --dry-run # See what would change
|
|
84
|
+
lettactl apply -f agents.yml -v # Verbose output
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Create Agents
|
|
88
|
+
```bash
|
|
89
|
+
# Create basic agent
|
|
90
|
+
lettactl create agent my-agent --description "My helpful assistant"
|
|
91
|
+
|
|
92
|
+
# Create with full configuration
|
|
93
|
+
lettactl create agent advanced-agent \
|
|
94
|
+
--description "Advanced AI assistant" \
|
|
95
|
+
--model "google_ai/gemini-2.5-pro" \
|
|
96
|
+
--system "You are an expert assistant." \
|
|
97
|
+
--context-window 32000 \
|
|
98
|
+
--embedding "letta/letta-free" \
|
|
99
|
+
--tags "production,assistant"
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Update Agents
|
|
103
|
+
```bash
|
|
104
|
+
# Update description and model
|
|
105
|
+
lettactl update agent my-agent \
|
|
106
|
+
--description "Updated description" \
|
|
107
|
+
--model "google_ai/gemini-2.5-flash"
|
|
108
|
+
|
|
109
|
+
# Update system prompt and tags
|
|
110
|
+
lettactl update agent my-agent \
|
|
111
|
+
--system "You are a specialized assistant." \
|
|
112
|
+
--tags "updated,specialized"
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### Export/Import Agents
|
|
116
|
+
```bash
|
|
117
|
+
# Export agent to file
|
|
118
|
+
lettactl export agent my-agent --output my-agent-backup.json
|
|
119
|
+
|
|
120
|
+
# Export with legacy format
|
|
121
|
+
lettactl export agent my-agent --legacy-format --output legacy-backup.json
|
|
122
|
+
|
|
123
|
+
# Import agent from file
|
|
124
|
+
lettactl import my-agent-backup.json
|
|
125
|
+
|
|
126
|
+
# Import with custom name and copy suffix
|
|
127
|
+
lettactl import my-agent-backup.json \
|
|
128
|
+
--name restored-agent \
|
|
129
|
+
--append-copy
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
### Message Operations
|
|
133
|
+
```bash
|
|
134
|
+
# List agent conversation history
|
|
135
|
+
lettactl messages my-agent --limit 10
|
|
136
|
+
|
|
137
|
+
# Send a message to an agent
|
|
138
|
+
lettactl send my-agent "Hello, how are you?"
|
|
139
|
+
|
|
140
|
+
# Send with streaming response
|
|
141
|
+
lettactl send my-agent "Tell me about Tokyo" --stream
|
|
142
|
+
|
|
143
|
+
# Send asynchronous message
|
|
144
|
+
lettactl send my-agent "Plan a 7-day itinerary" --async
|
|
145
|
+
|
|
146
|
+
# Reset agent's conversation history
|
|
147
|
+
lettactl reset-messages my-agent --add-default
|
|
148
|
+
|
|
149
|
+
# Compact agent's message history (summarize)
|
|
150
|
+
lettactl compact-messages my-agent
|
|
151
|
+
|
|
152
|
+
# Cancel running message processes
|
|
153
|
+
lettactl cancel-messages my-agent --run-ids "run1,run2"
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### Bulk Delete Operations
|
|
157
|
+
```bash
|
|
158
|
+
# Preview agents to be deleted (safe mode)
|
|
159
|
+
lettactl delete-all agents --pattern "test.*" # Shows what would be deleted
|
|
160
|
+
lettactl delete-all agents # Preview all agents
|
|
161
|
+
|
|
162
|
+
# Bulk delete with pattern matching
|
|
163
|
+
lettactl delete-all agents --pattern "test.*" --force # Delete all test agents
|
|
164
|
+
lettactl delete-all agents --pattern "dev.*" --force # Delete all dev agents
|
|
165
|
+
lettactl delete-all agents --pattern "(old|temp).*" --force # Complex patterns
|
|
166
|
+
|
|
167
|
+
# Pattern matching by agent ID (useful for cleanup)
|
|
168
|
+
lettactl delete-all agents --pattern ".*abc123.*" --force # Match partial IDs
|
|
169
|
+
|
|
170
|
+
# Nuclear option - delete everything (be careful!)
|
|
171
|
+
lettactl delete-all agents --force # Deletes ALL agents
|
|
172
|
+
|
|
173
|
+
# Case-insensitive matching
|
|
174
|
+
lettactl delete-all agents --pattern "PROD.*" --force # Matches "prod-agent-1", etc.
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
**What gets deleted:**
|
|
178
|
+
- ✅ Agent-specific memory blocks
|
|
179
|
+
- ✅ Agent-specific folders (if not shared)
|
|
180
|
+
- ✅ Associated conversation history
|
|
181
|
+
- ❌ Shared blocks and folders (preserved)
|
|
182
|
+
|
|
183
|
+
**Safety Features:**
|
|
184
|
+
- Always shows preview before deletion
|
|
185
|
+
- Requires explicit `--force` confirmation
|
|
186
|
+
- Preserves shared resources used by other agents
|
|
187
|
+
- Pattern matching is case-insensitive
|
|
188
|
+
- Supports complex regex patterns
|
|
189
|
+
|
|
190
|
+
### View Resources
|
|
191
|
+
```bash
|
|
192
|
+
lettactl get agents # List all agents
|
|
193
|
+
lettactl describe agent my-agent # Detailed agent info
|
|
194
|
+
lettactl messages my-agent # View conversation history
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
### Validate Configuration
|
|
198
|
+
```bash
|
|
199
|
+
lettactl validate -f agents.yml # Check config syntax
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
### Remove Resources
|
|
203
|
+
```bash
|
|
204
|
+
# Delete single agent
|
|
205
|
+
lettactl delete agent my-agent --force # Delete agent
|
|
206
|
+
|
|
207
|
+
# Bulk delete with pattern matching
|
|
208
|
+
lettactl delete-all agents --pattern "test.*" --force # Delete all agents matching "test*"
|
|
209
|
+
lettactl delete-all agents --pattern "(dev|staging).*" # Complex regex patterns
|
|
210
|
+
lettactl delete-all agents --pattern ".*temp.*" # Match anywhere in name/ID
|
|
211
|
+
lettactl delete-all agents --force # Delete ALL agents (dangerous!)
|
|
212
|
+
|
|
213
|
+
# Preview what will be deleted (without --force)
|
|
214
|
+
lettactl delete-all agents --pattern "test.*" # Shows preview, asks for --force
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
### Try the Complete Example
|
|
218
|
+
|
|
219
|
+
The fastest way to get started is with our complete example:
|
|
220
|
+
|
|
221
|
+
```bash
|
|
222
|
+
cd example
|
|
223
|
+
lettactl apply -f agents.yml
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
See the [example README](./example/README.md) for detailed documentation and best practices.
|
|
227
|
+
|
|
228
|
+
### Your First Agent
|
|
229
|
+
|
|
230
|
+
Create a file called `agents.yml`:
|
|
231
|
+
|
|
232
|
+
```yaml
|
|
233
|
+
agents:
|
|
234
|
+
- name: my-first-agent
|
|
235
|
+
description: "A helpful AI assistant"
|
|
236
|
+
llm_config:
|
|
237
|
+
model: "google_ai/gemini-2.5-pro"
|
|
238
|
+
context_window: 32000
|
|
239
|
+
system_prompt:
|
|
240
|
+
value: "You are a helpful AI assistant."
|
|
241
|
+
tools:
|
|
242
|
+
- archival_memory_insert
|
|
243
|
+
- archival_memory_search
|
|
244
|
+
memory_blocks:
|
|
245
|
+
- name: user_preferences
|
|
246
|
+
description: "Remembers what the user likes"
|
|
247
|
+
limit: 2000
|
|
248
|
+
value: "User prefers concise, direct answers."
|
|
249
|
+
embedding: "letta/letta-free"
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
Deploy it:
|
|
253
|
+
|
|
254
|
+
```bash
|
|
255
|
+
lettactl apply -f agents.yml
|
|
256
|
+
```
|
|
257
|
+
|
|
258
|
+
That's it! Your agent is now running.
|
|
259
|
+
|
|
260
|
+
## Essential Configuration
|
|
261
|
+
|
|
262
|
+
### LLM Configuration (Required)
|
|
263
|
+
|
|
264
|
+
Every agent needs an LLM configuration as the first key:
|
|
265
|
+
|
|
266
|
+
```yaml
|
|
267
|
+
agents:
|
|
268
|
+
- name: my-agent
|
|
269
|
+
llm_config:
|
|
270
|
+
model: "google_ai/gemini-2.5-pro" # Required: which model to use
|
|
271
|
+
context_window: 32000 # Required: context window size
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
### System Prompts
|
|
275
|
+
|
|
276
|
+
Define how your agent behaves with system prompts. You have two options:
|
|
277
|
+
|
|
278
|
+
**Option 1: Inline prompt**
|
|
279
|
+
```yaml
|
|
280
|
+
system_prompt:
|
|
281
|
+
value: |
|
|
282
|
+
You are a helpful AI assistant focused on...
|
|
283
|
+
```
|
|
284
|
+
|
|
285
|
+
**Option 2: File-based prompt (recommended)**
|
|
286
|
+
```yaml
|
|
287
|
+
system_prompt:
|
|
288
|
+
from_file: "prompts/my-agent-prompt.md"
|
|
289
|
+
```
|
|
290
|
+
|
|
291
|
+
The system automatically combines your prompt with base Letta instructions for optimal behavior.
|
|
292
|
+
|
|
293
|
+
### Memory Blocks
|
|
294
|
+
|
|
295
|
+
Give your agents persistent memory with two content options:
|
|
296
|
+
|
|
297
|
+
**Option 1: Inline content**
|
|
298
|
+
```yaml
|
|
299
|
+
memory_blocks:
|
|
300
|
+
- name: user_preferences
|
|
301
|
+
description: "What the user likes and dislikes"
|
|
302
|
+
limit: 2000
|
|
303
|
+
value: "User prefers short, direct answers."
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
**Option 2: File-based content (recommended for large content)**
|
|
307
|
+
```yaml
|
|
308
|
+
memory_blocks:
|
|
309
|
+
- name: company_knowledge
|
|
310
|
+
description: "Company knowledge base"
|
|
311
|
+
limit: 10000
|
|
312
|
+
from_file: "memory-blocks/company-info.md"
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
### File Attachments
|
|
316
|
+
|
|
317
|
+
Attach documents to your agents with powerful auto-discovery:
|
|
318
|
+
|
|
319
|
+
**Option 1: Auto-discover all files (recommended for large document sets)**
|
|
320
|
+
```yaml
|
|
321
|
+
folders:
|
|
322
|
+
- name: documents
|
|
323
|
+
files:
|
|
324
|
+
- "files/*" # All files in files/ directory
|
|
325
|
+
- "files/**/*" # All files recursively (subdirectories too)
|
|
326
|
+
```
|
|
327
|
+
|
|
328
|
+
**Option 2: Specific files and patterns**
|
|
329
|
+
```yaml
|
|
330
|
+
folders:
|
|
331
|
+
- name: documents
|
|
332
|
+
files:
|
|
333
|
+
- "files/manual.pdf"
|
|
334
|
+
- "files/guidelines.txt"
|
|
335
|
+
- "files/specs/*.md" # All markdown in specs/ subdirectory
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
**Auto-Discovery Features:**
|
|
339
|
+
- `files/*` - Discovers ALL files in the files/ directory automatically
|
|
340
|
+
- `files/**/*` - Recursively discovers files in subdirectories
|
|
341
|
+
- `tools/*` - Auto-discovers all Python tools in tools/ directory
|
|
342
|
+
- No need to manually list every file!
|
|
343
|
+
|
|
344
|
+
## Intelligent Updates
|
|
345
|
+
|
|
346
|
+
lettactl only updates what actually changed and preserves conversation history:
|
|
347
|
+
|
|
348
|
+
- **Edit tool source code** → Tools automatically re-registered
|
|
349
|
+
- **Change memory block files** → Content updated seamlessly
|
|
350
|
+
- **Modify documents** → Files re-uploaded to folders
|
|
351
|
+
- **Update config** → Agent settings changed
|
|
352
|
+
- **No changes** → Nothing happens (fast!)
|
|
353
|
+
|
|
354
|
+
```bash
|
|
355
|
+
# Edit anything
|
|
356
|
+
vim tools/my_tool.py
|
|
357
|
+
vim memory-blocks/user-data.md
|
|
358
|
+
vim agents.yml
|
|
359
|
+
|
|
360
|
+
# Deploy - only changed parts update
|
|
361
|
+
lettactl apply -f agents.yml
|
|
362
|
+
# Conversation history preserved! 🎉
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
## Core Features
|
|
366
|
+
|
|
367
|
+
### Smart Versioning
|
|
368
|
+
|
|
369
|
+
lettactl automatically handles versioning when content changes:
|
|
370
|
+
|
|
371
|
+
```yaml
|
|
372
|
+
memory_blocks:
|
|
373
|
+
- name: user_data
|
|
374
|
+
description: "User information"
|
|
375
|
+
value: "Updated content here"
|
|
376
|
+
# lettactl creates: user_data__v__20241202-a1b2c3d4
|
|
377
|
+
```
|
|
378
|
+
|
|
379
|
+
**User-defined versions:**
|
|
380
|
+
```yaml
|
|
381
|
+
memory_blocks:
|
|
382
|
+
- name: campaign_brief
|
|
383
|
+
version: "summer-2024-launch" # Your custom tag
|
|
384
|
+
value: "Summer campaign details..."
|
|
385
|
+
# Creates: campaign_brief__v__summer-2024-launch
|
|
386
|
+
```
|
|
387
|
+
|
|
388
|
+
### Diff-Based Updates
|
|
389
|
+
|
|
390
|
+
When you change system prompts or memory content, lettactl creates new versioned agents instead of overwriting existing ones:
|
|
391
|
+
|
|
392
|
+
```bash
|
|
393
|
+
# First apply creates: recipe-assistant
|
|
394
|
+
lettactl apply -f agents.yml
|
|
395
|
+
|
|
396
|
+
# After changing system prompt, creates: recipe-assistant__v__20241202-abc123
|
|
397
|
+
lettactl apply -f agents.yml
|
|
398
|
+
|
|
399
|
+
# Unchanged agents are left alone
|
|
400
|
+
```
|
|
401
|
+
|
|
402
|
+
### Shared Resources
|
|
403
|
+
|
|
404
|
+
Share memory blocks across multiple agents:
|
|
405
|
+
|
|
406
|
+
```yaml
|
|
407
|
+
shared_blocks:
|
|
408
|
+
- name: company_guidelines
|
|
409
|
+
description: "Company-wide AI guidelines"
|
|
410
|
+
limit: 5000
|
|
411
|
+
from_file: "shared/guidelines.md"
|
|
412
|
+
|
|
413
|
+
agents:
|
|
414
|
+
- name: sales-agent
|
|
415
|
+
shared_blocks:
|
|
416
|
+
- company_guidelines
|
|
417
|
+
# ... rest of config
|
|
418
|
+
|
|
419
|
+
- name: support-agent
|
|
420
|
+
shared_blocks:
|
|
421
|
+
- company_guidelines
|
|
422
|
+
# ... rest of config
|
|
423
|
+
```
|
|
424
|
+
|
|
425
|
+
### Custom Tools
|
|
426
|
+
|
|
427
|
+
Auto-discover Python tools:
|
|
428
|
+
|
|
429
|
+
```yaml
|
|
430
|
+
tools:
|
|
431
|
+
- tools/* # Auto-discover all .py files
|
|
432
|
+
- specific_tool_name # Or reference specific tools
|
|
433
|
+
```
|
|
434
|
+
|
|
435
|
+
Create `tools/my_tool.py`:
|
|
436
|
+
```python
|
|
437
|
+
from pydantic import BaseModel
|
|
438
|
+
|
|
439
|
+
def my_custom_tool(query: str) -> str:
|
|
440
|
+
"""Does something amazing with the query"""
|
|
441
|
+
return f"Processed: {query}"
|
|
442
|
+
```
|
|
443
|
+
|
|
444
|
+
|
|
445
|
+
## Complete Configuration Reference
|
|
446
|
+
|
|
447
|
+
### Agent Schema
|
|
448
|
+
|
|
449
|
+
```yaml
|
|
450
|
+
agents:
|
|
451
|
+
- name: agent-name # Required: unique identifier
|
|
452
|
+
description: "What this agent does" # Required: human description
|
|
453
|
+
|
|
454
|
+
# LLM configuration (required, should be first)
|
|
455
|
+
llm_config:
|
|
456
|
+
model: "google_ai/gemini-2.5-pro" # Required
|
|
457
|
+
context_window: 32000 # Required
|
|
458
|
+
|
|
459
|
+
# System prompt (required)
|
|
460
|
+
system_prompt:
|
|
461
|
+
value: "Direct prompt text" # Option 1: inline
|
|
462
|
+
from_file: "prompts/agent.md" # Option 2: from file
|
|
463
|
+
|
|
464
|
+
# Tools (optional)
|
|
465
|
+
tools:
|
|
466
|
+
- archival_memory_insert # Built-in tools
|
|
467
|
+
- archival_memory_search
|
|
468
|
+
- tools/* # Auto-discover from tools/ folder
|
|
469
|
+
- custom_tool_name # Specific custom tools
|
|
470
|
+
|
|
471
|
+
# Shared blocks (optional)
|
|
472
|
+
shared_blocks:
|
|
473
|
+
- shared_block_name
|
|
474
|
+
|
|
475
|
+
# Agent-specific memory blocks (optional)
|
|
476
|
+
memory_blocks:
|
|
477
|
+
- name: block_name
|
|
478
|
+
description: "What this block stores"
|
|
479
|
+
limit: 5000 # Character limit
|
|
480
|
+
version: "optional-tag" # Optional: your version tag
|
|
481
|
+
value: "Direct content" # Option 1: inline
|
|
482
|
+
from_file: "blocks/file.md" # Option 2: from file
|
|
483
|
+
|
|
484
|
+
# File attachments (optional)
|
|
485
|
+
folders:
|
|
486
|
+
- name: folder_name
|
|
487
|
+
files:
|
|
488
|
+
- "files/*" # Auto-discover files
|
|
489
|
+
- "files/specific-file.pdf" # Specific files
|
|
490
|
+
|
|
491
|
+
embedding: "letta/letta-free" # Optional: embedding model
|
|
492
|
+
```
|
|
493
|
+
|
|
494
|
+
### Shared Blocks Schema
|
|
495
|
+
|
|
496
|
+
```yaml
|
|
497
|
+
shared_blocks:
|
|
498
|
+
- name: block_name
|
|
499
|
+
description: "Shared across agents"
|
|
500
|
+
limit: 10000
|
|
501
|
+
version: "optional-tag" # Optional: your version tag
|
|
502
|
+
value: "Content here" # Option 1: inline
|
|
503
|
+
from_file: "shared/file.md" # Option 2: from file
|
|
504
|
+
```
|
|
505
|
+
|
|
506
|
+
## File Organization
|
|
507
|
+
|
|
508
|
+
lettactl expects this folder structure:
|
|
509
|
+
|
|
510
|
+
```
|
|
511
|
+
your-project/
|
|
512
|
+
├── agents.yml # Main configuration
|
|
513
|
+
├── config/ # Base system configuration
|
|
514
|
+
│ └── base-letta-system.md
|
|
515
|
+
├── prompts/ # System prompts
|
|
516
|
+
│ ├── agent1-prompt.md
|
|
517
|
+
│ └── agent2-prompt.md
|
|
518
|
+
├── memory-blocks/ # Memory block content
|
|
519
|
+
│ ├── shared/
|
|
520
|
+
│ ├── agent1/
|
|
521
|
+
│ └── agent2/
|
|
522
|
+
├── files/ # Files to attach to agents
|
|
523
|
+
│ ├── document1.pdf
|
|
524
|
+
│ └── document2.md
|
|
525
|
+
└── tools/ # Custom Python tools
|
|
526
|
+
├── tool1.py
|
|
527
|
+
└── tool2.py
|
|
528
|
+
```
|
|
529
|
+
|
|
530
|
+
## Why lettactl?
|
|
531
|
+
|
|
532
|
+
Managing AI agents manually gets messy fast. You end up with:
|
|
533
|
+
- Inconsistent configurations across environments
|
|
534
|
+
- Lost work when recreating agents
|
|
535
|
+
- No version control for agent setups
|
|
536
|
+
- Painful collaboration between team members
|
|
537
|
+
|
|
538
|
+
lettactl treats your AI agents like infrastructure - versionable, reproducible, and manageable at scale.
|
|
539
|
+
|
|
540
|
+
## Advanced Features
|
|
541
|
+
|
|
542
|
+
### Fleet Cleanup Workflows
|
|
543
|
+
|
|
544
|
+
Common patterns for managing agent fleets at scale:
|
|
545
|
+
|
|
546
|
+
```bash
|
|
547
|
+
# Development workflow - clean up test agents after feature work
|
|
548
|
+
lettactl delete-all agents --pattern "feature-.*" --force
|
|
549
|
+
|
|
550
|
+
# Staging cleanup - remove old staging agents but keep current ones
|
|
551
|
+
lettactl delete-all agents --pattern "staging-old.*" --force
|
|
552
|
+
|
|
553
|
+
# Version cleanup - remove old versioned agents
|
|
554
|
+
lettactl delete-all agents --pattern ".*__v__2024.*" --force
|
|
555
|
+
|
|
556
|
+
# Emergency cleanup - remove all temporary/test agents
|
|
557
|
+
lettactl delete-all agents --pattern "(temp|test|debug).*" --force
|
|
558
|
+
|
|
559
|
+
# CI/CD cleanup - remove agents created by failed builds
|
|
560
|
+
lettactl delete-all agents --pattern ".*-pr-[0-9]+$" --force
|
|
561
|
+
```
|
|
562
|
+
|
|
563
|
+
### Environment Management
|
|
564
|
+
|
|
565
|
+
```bash
|
|
566
|
+
# Self-hosting Letta
|
|
567
|
+
export LETTA_API_URL=http://localhost:8283
|
|
568
|
+
# API key is optional for self-hosting
|
|
569
|
+
|
|
570
|
+
# Letta Cloud
|
|
571
|
+
export LETTA_API_URL=https://api.letta.com
|
|
572
|
+
export LETTA_API_KEY=your_cloud_key # Required for cloud
|
|
573
|
+
```
|
|
574
|
+
|
|
575
|
+
### Update Workflows
|
|
576
|
+
|
|
577
|
+
```bash
|
|
578
|
+
# Edit your configuration
|
|
579
|
+
vim agents.yml
|
|
580
|
+
|
|
581
|
+
# Preview changes
|
|
582
|
+
lettactl apply -f agents.yml --dry-run
|
|
583
|
+
|
|
584
|
+
# Deploy changes - only modified agents get new versions
|
|
585
|
+
lettactl apply -f agents.yml
|
|
586
|
+
|
|
587
|
+
# Check what was created
|
|
588
|
+
lettactl get agents
|
|
589
|
+
```
|
|
590
|
+
|
|
591
|
+
### Troubleshooting
|
|
592
|
+
|
|
593
|
+
**Use verbose mode when debugging:**
|
|
594
|
+
```bash
|
|
595
|
+
lettactl apply -v -f agents.yml
|
|
596
|
+
```
|
|
597
|
+
|
|
598
|
+
**Check connection:**
|
|
599
|
+
```bash
|
|
600
|
+
lettactl get agents
|
|
601
|
+
```
|
|
602
|
+
|
|
603
|
+
**Validate config:**
|
|
604
|
+
```bash
|
|
605
|
+
lettactl validate -f agents.yml
|
|
606
|
+
```
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"apply.d.ts","sourceRoot":"","sources":["../../src/commands/apply.ts"],"names":[],"mappings":"AAUA,wBAAsB,YAAY,CAAC,OAAO,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,OAAO,CAAA;CAAE,EAAE,OAAO,EAAE,GAAG,iBAwU3G"}
|