aui-agent-builder 0.3.45 → 0.3.47

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 CHANGED
@@ -1,6 +1,44 @@
1
1
  # AUI Agent Builder CLI
2
2
 
3
- Build, version, and deploy AI agents from your terminal. Import agent configurations as local JSON files, edit them in your editor with full schema autocomplete, validate, push changes, and manage versions.
3
+ [![npm version](https://img.shields.io/npm/v/aui-agent-builder.svg)](https://www.npmjs.com/package/aui-agent-builder)
4
+ [![npm downloads](https://img.shields.io/npm/dw/aui-agent-builder.svg)](https://www.npmjs.com/package/aui-agent-builder)
5
+ [![node](https://img.shields.io/node/v/aui-agent-builder.svg)](https://nodejs.org)
6
+
7
+ Build, version, and deploy AI agents from your terminal. Import agent configurations as local JSON files, edit them in your editor with full schema autocomplete, validate changes, push to the backend, and manage versions — all from the command line.
8
+
9
+ ---
10
+
11
+ ## Features
12
+
13
+ - **Code-first agent development** — Edit agent configurations as JSON files in your editor with schema-driven autocomplete
14
+ - **Version management** — Create drafts, publish, activate, and archive agent versions with full lifecycle control
15
+ - **Smart diff & validation** — See exactly what changed, validate against domain schemas before pushing
16
+ - **Knowledge base management** — Upload documents and URLs, export/import KB configurations
17
+ - **Scope-level control** — Import and push at network, account, organization, or category scope
18
+ - **IDE integration** — Auto-generated schemas, Cursor rules, Claude skills, and OpenCode skills for AI-assisted editing
19
+ - **CI/CD ready** — Every command has a non-interactive mode with flags for automation
20
+ - **Web playground** — Built-in chat UI for testing agents locally
21
+
22
+ ---
23
+
24
+ ## Table of Contents
25
+
26
+ - [Installation](#installation)
27
+ - [Quick Start](#quick-start)
28
+ - [Core Concepts](#core-concepts)
29
+ - [Commands Reference](#commands-reference)
30
+ - [Workflows](#workflows)
31
+ - [Project Structure](#project-structure)
32
+ - [Configuration File Reference](#configuration-file-reference)
33
+ - [Version Management](#version-management)
34
+ - [Scope Levels](#scope-levels)
35
+ - [Knowledge Bases](#knowledge-bases)
36
+ - [CI/CD & Automation](#cicd--automation)
37
+ - [Configuration](#configuration)
38
+ - [Troubleshooting](#troubleshooting)
39
+ - [Local Development](#local-development)
40
+
41
+ ---
4
42
 
5
43
  ## Installation
6
44
 
@@ -8,7 +46,15 @@ Build, version, and deploy AI agents from your terminal. Import agent configurat
8
46
  npm install -g aui-agent-builder
9
47
  ```
10
48
 
11
- Requires Node.js 18+.
49
+ Requires **Node.js 18+**.
50
+
51
+ Verify installation:
52
+
53
+ ```bash
54
+ aui -v
55
+ ```
56
+
57
+ ---
12
58
 
13
59
  ## Quick Start
14
60
 
@@ -16,23 +62,30 @@ Requires Node.js 18+.
16
62
  # 1. Authenticate
17
63
  aui login
18
64
 
19
- # 2. Create a new agent
20
- aui agents --create
21
-
22
- # 3. Import agent config as local files
65
+ # 2. Import an existing agent (or create one with: aui agents --create)
23
66
  aui import-agent
24
67
 
25
- # 4. Edit .aui.json files in your editor / Cursor
68
+ # 3. Edit .aui.json files in your editor (schema autocomplete works out of the box)
26
69
 
27
- # 5. Push changes back
70
+ # 4. See what changed
71
+ aui diff
72
+
73
+ # 5. Validate
74
+ aui validate
75
+
76
+ # 6. Push changes
28
77
  aui push
29
78
 
30
- # 6. Publish and activate the version
79
+ # 7. Publish and go live
31
80
  aui version publish
32
81
  aui version activate
33
82
  ```
34
83
 
35
- ## Hierarchy
84
+ ---
85
+
86
+ ## Core Concepts
87
+
88
+ ### Hierarchy
36
89
 
37
90
  ```
38
91
  Organization
@@ -41,247 +94,523 @@ Organization
41
94
  └── Version (v1.0, v1.1, v2.0, ...)
42
95
  ```
43
96
 
44
- - **Organization** top-level workspace, tied to your login credentials
45
- - **Account (Project)** — a project within the organization
46
- - **Agent (Network)** an AI agent within a project
47
- - **Version** a snapshot of the agent's configuration (draft → published → active)
97
+ | Concept | Description |
98
+ |---------|-------------|
99
+ | **Organization** | Top-level workspace, tied to your login credentials |
100
+ | **Account** | A project within the organization |
101
+ | **Agent** | An AI agent (also called a "network") within a project |
102
+ | **Version** | An immutable snapshot of the agent's full configuration |
103
+
104
+ ### Agent Configuration
105
+
106
+ Each agent is composed of seven configuration types:
107
+
108
+ | Config | File | Purpose |
109
+ |--------|------|---------|
110
+ | **General Settings** | `agent.aui.json` | Name, objective, persona, tone, guardrails |
111
+ | **Parameters** | `parameters.aui.json` | Data the agent collects from users and outputs |
112
+ | **Entities** | `entities.aui.json` | Groups of related parameters |
113
+ | **Integrations** | `integrations.aui.json` | API, RAG, and MCP connections |
114
+ | **Tools** | `tools/*.aui.json` | Agent capabilities (one file per tool) |
115
+ | **Rules** | `rules.aui.json` | Global behavioral rules |
116
+ | **Widgets** | `widgets.aui.json` | Card templates for rich UI responses |
117
+
118
+ ### Version Lifecycle
119
+
120
+ ```
121
+ draft ──→ published ──→ active
122
+ └──→ archived
123
+ ```
124
+
125
+ | State | Editable | Can Activate | Description |
126
+ |-------|----------|-------------|-------------|
127
+ | **Draft** | Yes | No | Work in progress. Receives pushes |
128
+ | **Published** | No | Yes | Locked permanently. Ready to go live |
129
+ | **Active** | No | — | The live production configuration |
130
+ | **Archived** | No | No | Retired. Can still be viewed and cloned |
131
+
132
+ ---
48
133
 
49
- ## Commands
134
+ ## Commands Reference
50
135
 
51
136
  ### Authentication
52
137
 
53
- | Command | Description |
54
- |---------|-------------|
55
- | `aui login` | Authenticate with AUI |
56
- | `aui login --environment custom` | Login to a specific environment |
57
- | `aui login --token <jwt>` | Login with a JWT token directly |
58
- | `aui logout` | Clear local session and credentials |
138
+ ```bash
139
+ aui login # Open browser for authentication
140
+ aui login --environment staging # Login to a specific environment
141
+ aui login --token <jwt> # Login with a JWT token (for CI/CD)
142
+ aui logout # Clear session and credentials
143
+ ```
144
+
145
+ ### Agent Management
59
146
 
60
- After login, the CLI suggests your next steps: import an existing agent or create a new one.
147
+ ```bash
148
+ aui agents # Interactive menu: list, create, switch, import
149
+ aui agents --list # List all agents in the current account
150
+ aui agents --create # Interactive creation (org → account → name)
151
+ aui agents --switch # Switch the active agent in your session
152
+ ```
61
153
 
62
- ### Agent Creation
154
+ **Non-interactive creation:**
63
155
 
64
- | Command | Description |
65
- |---------|-------------|
66
- | `aui agents --create` | Interactive: select org → account → enter name. Uses General category by default |
67
- | `aui agents --create --name "My Agent"` | Create with a specific name (still prompts for org/account) |
68
- | `aui agents --create --name "My Agent" --category GOOGLE_FLIGHTS-V3` | Create with a specific category (by key or name) |
69
- | `aui agents --create --name "My Agent" --account-id <id>` | Skip org/account selection |
70
- | `aui agents --create --name "My Agent" --network-id <id>` | Register agent on an existing network |
71
- | `aui agents --create --full` | Create + version + publish + activate in one command |
72
- | `aui agents --list` | List all agents in the current account |
73
- | `aui agents --switch` | Switch which agent is selected in your session |
156
+ ```bash
157
+ # Minimal — still prompts for org/account
158
+ aui agents --create --name "My Agent"
159
+
160
+ # Fully non-interactive
161
+ aui agents --create --name "My Agent" --account-id <id>
162
+
163
+ # With a specific category (e.g. Amazon, Google Flights)
164
+ aui agents --create --name "My Agent" --account-id <id> --category Amazon
165
+
166
+ # Create + v1.0 draft (ready to import, edit, and push)
167
+ aui agents --create --name "My Agent" --account-id <id> --draft
168
+
169
+ # One-step: create + version + publish + activate
170
+ aui agents --create --name "My Agent" --account-id <id> --full
171
+ ```
74
172
 
75
173
  ### Import & Pull
76
174
 
77
- | Command | Description |
78
- |---------|-------------|
79
- | `aui import-agent` | Interactive: select org → account → agent. Auto-selects active version |
80
- | `aui import-agent <agent-id>` | Import a specific agent by network ID |
81
- | `aui import-agent --version <id>` | Import a specific version of the current session's agent |
82
- | `aui pull` | Pull latest config into an existing project (requires `.auirc`) |
83
- | `aui pull --force` | Pull without overwrite confirmation |
175
+ ```bash
176
+ aui import-agent # Interactive: select org → account → agent
177
+ aui import-agent <agent-id> # Import by network ID
178
+ aui import-agent --version <id> # Import a specific version
179
+ aui import-agent --scope-level category # Import at category scope
180
+ aui import-agent --dir ./my-folder # Output to a specific directory
181
+ aui import-agent --skip-kb-files # Skip knowledge base file downloads
182
+ aui import-agent --skills claude,cursor # Generate AI coding skills
183
+ aui import-agent --no-skills # Skip skill generation
184
+ aui import-agent --include-evaluate # Include test_questions schema
185
+ ```
186
+
187
+ ```bash
188
+ aui pull # Pull latest into existing project
189
+ aui pull --force # Skip overwrite confirmation
190
+ aui pull --scope-level <level> # Pull at a specific scope level
191
+ ```
192
+
193
+ ### Push
194
+
195
+ ```bash
196
+ aui push # Push changes (auto-creates version draft)
197
+ aui push --dry-run # Preview without pushing
198
+ aui push --scope-level category # Push at a specific scope level
199
+ aui push --version-id <id> # Push into a specific draft
200
+ aui push --force # Push even with validation errors
201
+ aui push --skip-validation # Skip validation step
202
+ aui push --api-key <key> # Use a specific API key
203
+ ```
84
204
 
85
205
  ### Version Management
86
206
 
87
- | Command | Description |
88
- |---------|-------------|
89
- | `aui version` | Interactive version menu |
90
- | `aui version list` | List all versions with status, stats, and active marker |
91
- | `aui version list --base-only` | List only base versions (no revisions) |
92
- | `aui version list --version-number 3` | List all revisions of version 3 |
93
- | `aui version create` | Interactive: choose source, bump mode, metadata |
94
- | `aui version create --source agent-scope` | Create new major version from live scope (v1.0, v2.0) |
95
- | `aui version create --source version --from <id>` | Create revision by cloning (v1.0 → v1.1) |
96
- | `aui version create --source version --from <id> --bump version_number` | Major bump from clone (v1.0 → v2.0) |
97
- | `aui version publish` | Publish a draft (locks it permanently) |
98
- | `aui version publish <id>` | Publish a specific draft |
99
- | `aui version activate` | Activate a published version as live |
100
- | `aui version activate <id>` | Activate a specific version |
101
- | `aui version archive <id>` | Archive a published version |
102
- | `aui version get <id>` | View full version details |
103
- | `aui version update <id> --label X --tags Y --notes Z` | Update version metadata |
207
+ ```bash
208
+ aui version # Interactive version menu
209
+ aui version list # List all versions
210
+ aui version list --base-only # List base versions only (no revisions)
211
+ aui version list --version-number 3 # List all revisions of v3
212
+
213
+ # Create
214
+ aui version create # Interactive
215
+ aui version create --source agent-scope # Major version from live (v2.0)
216
+ aui version create --source version --from <id> # Revision (v1.0 → v1.1)
217
+ aui version create --source version --from <id> --bump version_number # Major from clone
218
+
219
+ # Lifecycle
220
+ aui version publish # Interactive select draft to publish
221
+ aui version publish <id> # Publish a specific draft
222
+ aui version activate # Interactive select version to activate
223
+ aui version activate <id> # Activate a specific version
224
+ aui version archive <id> # Archive (cannot be re-activated)
225
+
226
+ # Metadata
227
+ aui version get <id> # View full version details
228
+ aui version update <id> --label "Release 2" --tags "prod,stable" --notes "Bug fixes"
229
+ ```
104
230
 
105
- ### Push
231
+ ### Knowledge Bases & Documents
106
232
 
107
- | Command | Description |
108
- |---------|-------------|
109
- | `aui push` | Push changes. Versioned agents: finds/creates draft, pushes with `agent_version_id`. Old agents: pushes to live scope |
110
- | `aui push --version-id <id>` | Push into a specific version draft |
111
- | `aui push --dry-run` | Preview what would be pushed |
112
- | `aui push --force` | Push even if validation fails |
113
- | `aui push --skip-validation` | Skip validation step |
233
+ ```bash
234
+ # RAG management
235
+ aui rag # Interactive KB menu
236
+ aui rag --list # List all knowledge bases
237
+ aui rag --export # Export KBs to knowledge-hubs/
238
+ aui rag --import # Import KBs from knowledge-hubs/
239
+
240
+ # Document upload
241
+ aui document report.pdf data.csv --kb "Policies" # Upload files
242
+ aui document --url "https://docs.example.com" --kb "Docs" # Scrape URLs
243
+ aui document status # Recent upload status
244
+ aui document status --hours 24 --kb "Policies" # Filtered status
245
+ ```
114
246
 
115
- ### Development
247
+ ### Development Tools
116
248
 
117
- | Command | Description |
118
- |---------|-------------|
119
- | `aui validate [path]` | Validate `.aui.json` files against schemas |
120
- | `aui diff [a] [b]` | Compare configs or show changes since import |
121
- | `aui status` | Show session, linked agent, and project summary |
249
+ ```bash
250
+ aui validate # Validate all .aui.json files
251
+ aui validate ./tools/ # Validate specific directory
252
+ aui validate --strict # Treat warnings as errors
253
+ aui diff # Changes since last import/push
254
+ aui diff ./folder-a ./folder-b # Compare two directories
255
+ aui status # Session, agent, and project info
256
+ aui revert # Discard local changes
257
+ ```
122
258
 
123
- ### Configuration
259
+ ### Chat & Testing
124
260
 
125
- | Command | Description |
126
- |---------|-------------|
127
- | `aui account` | Manage accounts list, create, switch |
128
- | `aui env [environment]` | Show or switch environment |
129
- | `aui pull-schema` | Fetch domain schemas from backend |
130
- | `aui add-integration` | Add an integration (API, RAG, or MCP) |
131
- | `aui rag` | Manage RAG knowledge bases and files |
261
+ ```bash
262
+ aui chat # Interactive conversation with agent
263
+ aui chat --api-key <key> # Chat with a specific API key
264
+ aui chat --rest # REST API only (no streaming)
265
+ aui serve # Web chat playground (localhost:3141)
266
+ aui serve --port 8080 # Custom port
267
+ ```
132
268
 
133
- ### Tools
269
+ ### Configuration & Utilities
134
270
 
135
- | Command | Description |
136
- |---------|-------------|
137
- | `aui chat` | Start a conversation with an AUI agent |
138
- | `aui serve` | Launch web-based chat playground |
139
- | `aui revert` | Reset to HEAD (discard local changes) |
140
- | `aui upgrade` | Update aui-agent-builder to latest version |
271
+ ```bash
272
+ aui account # Manage accounts (list, create, switch)
273
+ aui env # Show current environment
274
+ aui env staging # Switch environment
275
+ aui pull-schema # Fetch domain schemas from backend
276
+ aui add-integration # Add API / RAG / MCP integration
277
+ aui upgrade # Update to latest version
278
+ ```
141
279
 
142
- ### Aliases
280
+ ### Command Aliases
143
281
 
144
282
  | Alias | Equivalent |
145
283
  |-------|------------|
146
284
  | `aui import` | `aui import-agent` |
147
- | `aui account` | `aui accounts` |
148
- | `aui agent` | `aui agents` |
285
+ | `aui accounts` | `aui account` |
286
+ | `aui agents` | `aui agent` |
149
287
  | `aui ls` | `aui list-agents` |
150
288
  | `aui versions` | `aui version` |
151
289
 
290
+ ---
291
+
152
292
  ## Workflows
153
293
 
154
- ### Creating a New Agent
294
+ ### Create and Deploy a New Agent
155
295
 
156
296
  ```bash
157
- # Interactive flow
158
- aui agents --create
159
- # → Select org → Select account → Enter name → Agent created
297
+ # Step 1: Create the agent (with a v1.0 draft ready to edit)
298
+ aui agents --create --name "Support Agent" --account-id <id> --draft
160
299
 
161
- # Then either:
162
- # Option A: Import, edit, push, version
300
+ # Step 2: Import as local files
163
301
  aui import-agent
164
- cd ./my-agent
165
- # edit files
302
+
303
+ # Step 3: Edit configuration in your editor
304
+ cd ./support-agent
305
+ # → Edit agent.aui.json, tools/*.aui.json, parameters.aui.json, etc.
306
+
307
+ # Step 4: Validate and push
308
+ aui validate
166
309
  aui push
167
- aui version publish
168
- aui version activate
169
310
 
170
- # Option B: Version immediately
171
- aui version create --source agent-scope
311
+ # Step 5: Publish and activate
172
312
  aui version publish
173
313
  aui version activate
174
-
175
- # Shortcut: all at once
176
- aui agents --create --full
177
314
  ```
178
315
 
179
- ### Editing an Existing Agent
316
+ **Three creation modes:**
180
317
 
181
318
  ```bash
182
- # 1. Import (auto-selects active version)
183
- aui import-agent
319
+ # Agent only (no version) — create version manually later
320
+ aui agents --create --name "Support Agent" --account-id <id>
321
+
322
+ # Agent + v1.0 draft — ready to import, edit, and push
323
+ aui agents --create --name "Support Agent" --account-id <id> --draft
324
+
325
+ # Agent + v1.0 + publish + activate — fully deployed in one step (CI/CD)
326
+ aui agents --create --name "Support Agent" --account-id <id> --full
327
+ ```
184
328
 
185
- # 2. Edit .aui.json files
329
+ ### Edit Push → Deploy Cycle
330
+
331
+ ```bash
332
+ aui import-agent # Downloads active version as .aui.json files
186
333
  cd ./my-agent
187
334
 
188
- # 3. Push (creates version draft automatically)
189
- aui push
335
+ # Make changes to any .aui.json file...
190
336
 
191
- # 4. Publish and activate
192
- aui version publish
193
- aui version activate
337
+ aui diff # See what changed
338
+ aui validate # Validate against schemas
339
+ aui push # Push changes into a new draft
340
+
341
+ aui version publish # Lock the draft
342
+ aui version activate # Make it live
194
343
  ```
195
344
 
196
- ### Working with Versions
345
+ ### Version Branching
197
346
 
198
347
  ```bash
199
- # List versions
200
- aui version list
201
-
202
- # Create revision (v1.0 → v1.1)
348
+ # Create a revision from v1.0 (→ v1.1)
203
349
  aui version create --source version --from <v1.0-id>
204
350
 
205
- # Create major version (v2.0)
351
+ # Or create a new major version from live scope (v2.0)
206
352
  aui version create --source agent-scope
207
353
 
208
- # Publish and go live
209
- aui version publish <id>
210
- aui version activate <id>
211
-
212
- # Archive old versions
213
- aui version archive <id>
354
+ # Import a specific version for editing
355
+ aui import-agent --version <version-id>
214
356
  ```
215
357
 
216
- ## Agent Project Structure
358
+ ---
359
+
360
+ ## Project Structure
217
361
 
218
362
  After `aui import-agent`, your project folder contains:
219
363
 
220
364
  ```
221
365
  my-agent/
222
- ├── agent.aui.json Agent name, objective, tone, guardrails
223
- ├── parameters.aui.json Data the agent collects and outputs
224
- ├── entities.aui.json Groups of related parameters
225
- ├── integrations.aui.json API, RAG, and MCP connections
226
- ├── rules.aui.json Global behavioral rules
227
- ├── widgets.aui.json Card templates for rich responses
228
- ├── tools/ One file per agent capability
366
+
367
+ ├── agent.aui.json # Agent identity and behavior
368
+ ├── parameters.aui.json # Parameters (input/output data)
369
+ ├── entities.aui.json # Entity groups
370
+ ├── integrations.aui.json # API / RAG / MCP connections
371
+ ├── rules.aui.json # Global behavioral rules
372
+ ├── widgets.aui.json # Card templates (JSX + field mappings)
373
+
374
+ ├── tools/ # One file per agent tool/capability
229
375
  │ ├── product_search.aui.json
230
- └── generative_ai.aui.json
231
- ├── knowledge-hubs/ Knowledge base resources and files
232
- ├── schemas/ Domain schemas for validation
233
- ├── .auirc Project config (agent ID, version, environment)
234
- ├── .vscode/settings.json Schema autocomplete config
235
- ├── GUIDE.md Step-by-step building guide
236
- ├── AGENTS.md Agent documentation
237
- └── BEST_PRACTICES.md Configuration best practices
376
+ ├── generative_ai.aui.json
377
+ │ └── ...
378
+
379
+ ├── knowledge-hubs/ # Knowledge base data
380
+ ├── policies/
381
+ │ │ ├── kb.json # KB metadata
382
+ │ │ └── company-policies.pdf # Downloaded files
383
+ └── ...
384
+
385
+ ├── schemas/ # Domain schemas (auto-fetched)
386
+ │ ├── agent.dschema.json
387
+ │ ├── tools.dschema.json
388
+ │ ├── parameters.dschema.json
389
+ │ ├── entities.dschema.json
390
+ │ ├── integrations.dschema.json
391
+ │ ├── rules.dschema.json
392
+ │ ├── widgets.dschema.json
393
+ │ └── knowledge-bases.dschema.json
394
+
395
+ ├── memory/ # Push logs (auto-generated)
396
+ ├── .auirc # Project config (agent ID, version, env)
397
+ ├── .vscode/settings.json # Schema autocomplete for VS Code / Cursor
398
+ ├── .gitignore
399
+
400
+ ├── GUIDE.md # Getting started guide
401
+ ├── AGENTS.md # Agent documentation
402
+ ├── BEST_PRACTICES.md # Configuration best practices
403
+
404
+ ├── .cursor/rules/ # Cursor AI rules per config type
405
+ ├── .claude/skills/ # Claude Code skills per config type
406
+ └── .opencode/skills/ # OpenCode skills per config type
407
+ ```
408
+
409
+ ---
410
+
411
+ ## Configuration File Reference
412
+
413
+ ### agent.aui.json
414
+
415
+ The agent's identity and top-level behavior:
416
+
417
+ ```json
418
+ {
419
+ "general_settings": {
420
+ "name": "Support Agent",
421
+ "objective": "Help customers find products and resolve issues",
422
+ "persona_guidelines": "You are a friendly and knowledgeable support agent...",
423
+ "tone_of_voice": "Professional but approachable",
424
+ "guardrails": "Never share internal pricing. Always verify identity...",
425
+ "brevity": "concise",
426
+ "context": "This agent serves an e-commerce platform..."
427
+ }
428
+ }
238
429
  ```
239
430
 
240
- ## Version Lifecycle
431
+ ### parameters.aui.json
432
+
433
+ Parameters the agent collects from users or outputs:
434
+
435
+ ```json
436
+ {
437
+ "parameters": [
438
+ {
439
+ "code": "product-type",
440
+ "description": "The type of product the customer is looking for",
441
+ "type": "string",
442
+ "usage": "ALL"
443
+ },
444
+ {
445
+ "code": "budget-range",
446
+ "description": "Customer's budget",
447
+ "type": "enum",
448
+ "usage": "INPUT",
449
+ "values": ["under-50", "50-100", "100-200", "200-plus"]
450
+ }
451
+ ]
452
+ }
453
+ ```
241
454
 
455
+ ### tools/*.aui.json
456
+
457
+ Each tool defines a capability with triggers, parameters, integrations, and rules:
458
+
459
+ ```json
460
+ {
461
+ "tool": {
462
+ "name": "Product Search",
463
+ "code": "PRODUCT_SEARCH",
464
+ "goal": "Help the user find products that match their preferences",
465
+ "when_to_use": "When the user asks to browse, search, or find products",
466
+ "status": true,
467
+ "response_type": "TEXT_CARDS",
468
+ "config": {
469
+ "params": {
470
+ "required": [["product-type"]],
471
+ "optional": ["budget-range", "color", "size"]
472
+ }
473
+ },
474
+ "integrations": [
475
+ { "code": "product-api", "is_main": true }
476
+ ],
477
+ "card_template_code": "product-card"
478
+ }
479
+ }
242
480
  ```
243
- draft → published → active
244
- archived
481
+
482
+ ### widgets.aui.json
483
+
484
+ Card templates with JSX and field mappings:
485
+
486
+ ```json
487
+ {
488
+ "widgets": [
489
+ {
490
+ "name": "product-card",
491
+ "jsx_template": "<Card><Image src={image} /><Text value={title} /></Card>",
492
+ "fields": [
493
+ { "name": "image", "param": "product-image" },
494
+ { "name": "title", "param": "product-name" }
495
+ ],
496
+ "tool_name": "PRODUCT_SEARCH"
497
+ }
498
+ ]
499
+ }
245
500
  ```
246
501
 
247
- - **Draft** — editable, receives pushes via `agent_version_id`
248
- - **Published** — locked permanently, ready to activate
249
- - **Active** — the live production configuration (one per agent)
250
- - **Archived** — retired, can be viewed and cloned but not activated
502
+ ---
503
+
504
+ ## Version Management
251
505
 
252
- ## Backwards Compatibility
506
+ ### How Versioning Works
253
507
 
254
- The CLI handles both new (versioned) and legacy agents:
508
+ 1. **Import** downloads the active version's configuration as local files
509
+ 2. **Push** auto-creates a draft version and pushes changes into it
510
+ 3. **Publish** locks the draft permanently
511
+ 4. **Activate** makes the published version the live configuration
512
+
513
+ ```bash
514
+ aui import-agent # Get active version (e.g. v1.0)
515
+ # Edit files...
516
+ aui push # Creates draft v1.1, pushes changes
517
+ aui version publish # Locks v1.1
518
+ aui version activate # v1.1 is now live
519
+ ```
255
520
 
256
- - **New agents** with versions: import uses `version_id` to fetch version-specific data, push creates drafts with `agent_version_id`
257
- - **Legacy agents** without versions: import falls back to network scope, push goes to live scope directly
258
- - The transition is automatic — no user action needed
521
+ ### Version Numbering
259
522
 
260
- ## Environments
523
+ - **Revisions** increment the minor number: v1.0 → v1.1 → v1.2
524
+ - **Major versions** increment the major number: v1.x → v2.0
525
+ - Use `--source version --from <id>` for revisions
526
+ - Use `--source agent-scope` for new major versions
527
+
528
+ ---
529
+
530
+ ## Scope Levels
531
+
532
+ Scope levels control which hierarchy level you're reading from or writing to:
533
+
534
+ | Level | IDs Sent | Use Case |
535
+ |-------|----------|----------|
536
+ | `network` | `network_id` + `account_id` + `org_id` + `category_id` | Agent-specific configuration (default) |
537
+ | `account` | `account_id` + `org_id` + `category_id` | Shared across all agents in an account |
538
+ | `organization` | `org_id` + `category_id` | Shared across all accounts in an org |
539
+ | `category` | `category_id` only | Shared across all agents in a category (e.g. Amazon) |
261
540
 
262
541
  ```bash
263
- aui env # Show current environment
264
- aui env staging # Switch to staging
265
- aui env custom # Switch to custom (v3 endpoints)
266
- aui env production # Switch to production
542
+ aui import-agent --scope-level category <agent-id>
543
+ aui push --scope-level category
267
544
  ```
268
545
 
269
- ## Configuration Files
546
+ > **Note:** Scope-level operations skip versioning. Changes are applied directly to the live scope.
270
547
 
271
- | File | Purpose |
272
- |------|---------|
273
- | `~/.aui/session.json` | Auth token, org, account, agent, environment |
274
- | `~/.aui/environment` | Selected environment |
275
- | `~/.aui/kbm-key` | RAG API key |
276
- | `~/.aui/agent-settings-key` | Agent Settings API key (fallback auth) |
277
- | `~/.aui/api-workflow-key` | API Workflow key |
278
- | `.auirc` | Project config — agent ID, version, environment |
548
+ ---
549
+
550
+ ## Knowledge Bases
551
+
552
+ ### Upload Documents
553
+
554
+ ```bash
555
+ # Upload files
556
+ aui document report.pdf handbook.docx --kb "Company Policies"
557
+
558
+ # Scrape web pages
559
+ aui document --url "https://docs.example.com/faq" --kb "FAQ"
560
+ ```
279
561
 
280
- ## Environment Variables
562
+ ### Check Upload Status
563
+
564
+ ```bash
565
+ aui document status # Last 6 hours
566
+ aui document status --hours 24 # Last 24 hours
567
+ aui document status --kb "Company Policies" # Filter by KB
568
+ ```
569
+
570
+ ### Export & Import
571
+
572
+ ```bash
573
+ aui rag --export # Save all KB metadata and files to knowledge-hubs/
574
+ aui rag --import # Restore KBs from knowledge-hubs/
575
+ ```
576
+
577
+ ---
578
+
579
+ ## CI/CD & Automation
580
+
581
+ Every command supports non-interactive flags for pipeline integration.
582
+
583
+ ### Environment Variables for CI
584
+
585
+ ```bash
586
+ export AUI_AUTH_TOKEN="<jwt-token>"
587
+ export AUI_ENVIRONMENT="production"
588
+ export AUI_ACCOUNT_ID="<account-id>"
589
+ export AUI_ORGANIZATION_ID="<org-id>"
590
+ ```
591
+
592
+ ### Example Pipeline
593
+
594
+ ```bash
595
+ # Login with token
596
+ aui login --token "$AUI_AUTH_TOKEN" --environment production
597
+
598
+ # Import, validate, push
599
+ aui import-agent <agent-id> --dir ./agent-config
600
+ cd ./agent-config
601
+ aui validate --strict
602
+ aui push
603
+
604
+ # Publish and activate
605
+ aui version publish
606
+ aui version activate
607
+ ```
608
+
609
+ ### All Environment Variables
281
610
 
282
611
  | Variable | Description |
283
612
  |----------|-------------|
284
- | `AUI_AUTH_TOKEN` | Auth token (skip login) |
613
+ | `AUI_AUTH_TOKEN` | Auth token (skip interactive login) |
285
614
  | `AUI_API_URL` | Override API base URL |
286
615
  | `AUI_ENVIRONMENT` | `staging`, `custom`, or `production` |
287
616
  | `AUI_ACCOUNT_ID` | Account ID |
@@ -289,26 +618,124 @@ aui env production # Switch to production
289
618
  | `AUI_KBM_API_KEY` | RAG API key |
290
619
  | `AUI_AGENT_TOOLS_API_KEY` | Agent Settings API key |
291
620
  | `AUI_API_WORKFLOW_KEY` | API Workflow key |
292
- | `AUI_DEBUG` | Enable debug logging (`AUI_DEBUG=1`) |
621
+ | `AUI_DEBUG` | Enable verbose debug logging (`AUI_DEBUG=1`) |
622
+
623
+ ---
624
+
625
+ ## Configuration
626
+
627
+ ### Global Config Files
628
+
629
+ | File | Purpose |
630
+ |------|---------|
631
+ | `~/.aui/session.json` | Auth token, org, account, agent, environment |
632
+ | `~/.aui/environment` | Selected environment |
633
+ | `~/.aui/kbm-key` | RAG API key |
634
+ | `~/.aui/agent-settings-key` | Agent Settings API key (fallback) |
635
+ | `~/.aui/api-workflow-key` | API Workflow key |
636
+
637
+ ### Project Config (.auirc)
638
+
639
+ Created during import, stored in the project root:
640
+
641
+ ```json
642
+ {
643
+ "agent_code": "support-agent",
644
+ "agent_id": "69cd0a61b6924d36aafaf3f6",
645
+ "environment": "custom",
646
+ "account_id": "69c919bcb506d3e323e0397e",
647
+ "organization_id": "68c004560ed54fdf78c551d1",
648
+ "network_category_id": "69b2e9385d33a2096c543294",
649
+ "version_id": "69cd0ca8168d739104520c60",
650
+ "version_label": "v1.2"
651
+ }
652
+ ```
653
+
654
+ ### Environments
655
+
656
+ ```bash
657
+ aui env # Show current
658
+ aui env staging # Switch to staging
659
+ aui env custom # Switch to custom (v3 endpoints)
660
+ aui env production # Switch to production
661
+ aui login --environment staging # Set during login
662
+ ```
663
+
664
+ ---
665
+
666
+ ## Troubleshooting
667
+
668
+ ### Enable Debug Logging
669
+
670
+ ```bash
671
+ AUI_DEBUG=1 aui push
672
+ AUI_DEBUG=1 aui import-agent <id>
673
+ ```
674
+
675
+ Debug mode logs every API request URL, response status, and body.
676
+
677
+ ### Common Issues
678
+
679
+ | Issue | Solution |
680
+ |-------|---------|
681
+ | `Not logged in` | Run `aui login` |
682
+ | `Missing network_category_id` | Re-import the agent: `aui import-agent` |
683
+ | `Version not found` | Run `aui version list` to see available versions |
684
+ | `422 on push` | Check `aui validate --strict` for schema errors. Review `.aui/push-logs/` for API details |
685
+ | `No changes detected` | The push baseline matches your files. Make an edit and try again |
686
+ | Agent settings 401/403 | Provide an API key: `aui push --api-key <key>` |
687
+ | README not showing on npm | Ensure `README.md` is at the package root before `npm publish` |
688
+
689
+ ### Push Logs
690
+
691
+ Every push saves detailed API call logs:
692
+
693
+ ```
694
+ .aui/push-logs/
695
+ ├── POST-tool-product_search.txt
696
+ ├── PATCH-param-budget-range.txt
697
+ └── ...
698
+ ```
699
+
700
+ ### Push Memory
701
+
702
+ Push results are saved as markdown for reference:
703
+
704
+ ```
705
+ memory/
706
+ └── push-2026-04-01T12-16-41-772Z.md
707
+ ```
708
+
709
+ ---
293
710
 
294
711
  ## Local Development
295
712
 
296
713
  ```bash
714
+ git clone <repo-url>
297
715
  cd aui-agent-builder
298
716
  npm install
299
717
  npm run build
300
- npm link
718
+ npm link # Makes `aui` available globally from source
301
719
  ```
302
720
 
721
+ ```bash
722
+ npm run watch # Recompile on file changes
723
+ npm test # Run tests
724
+ ```
725
+
726
+ ---
727
+
303
728
  ## Updating
304
729
 
305
730
  ```bash
306
- aui upgrade # Auto-detect npm or Homebrew
307
- npm install -g aui-agent-builder # Manual npm
308
- brew upgrade aui # Manual Homebrew
731
+ aui upgrade # Auto-detect npm or Homebrew
732
+ npm install -g aui-agent-builder # Manual npm
733
+ brew upgrade aui # Manual Homebrew
309
734
  ```
310
735
 
311
- The CLI checks for updates every 24 hours and shows a banner when one is available.
736
+ The CLI checks for updates every 24 hours and shows a notification banner when a new version is available.
737
+
738
+ ---
312
739
 
313
740
  ## License
314
741