Skip to content

Commit bb3476a

Browse files
committed
feat(adk): doc context and adk apis
1 parent 296ac3b commit bb3476a

3 files changed

Lines changed: 457 additions & 2 deletions

File tree

‎adk/cli-reference.mdx‎

Lines changed: 66 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ adk add webchat --alias custom-webchat
127127

128128
### `adk chat`
129129

130-
Chat with your deployed bot directly from the CLI.
130+
Chat with your agent in development mode directly from the CLI.
131131

132132
**Usage:**
133133
```bash
@@ -140,6 +140,62 @@ Run `adk dev` first to create a development bot if you don't have a `devId` in y
140140

141141
---
142142

143+
### `adk run`
144+
145+
Run a TypeScript script with the ADK runtime fully initialized. This allows you to execute scripts that use your agent's primitives, integrations, and runtime utilities like `client`, `context`, and `adk`.
146+
147+
**Usage:**
148+
```bash
149+
adk run <script> [args...]
150+
adk run scripts/migrate-data.ts
151+
adk run scripts/seed-tables.ts --prod
152+
adk run scripts/analyze.ts arg1 arg2
153+
```
154+
155+
**Arguments:**
156+
157+
| Argument | Description |
158+
|----------|-------------|
159+
| `script` | Path to the TypeScript script file to run |
160+
| `args` | Optional arguments to pass to the script |
161+
162+
**Flags:**
163+
164+
| Flag | Description | Default |
165+
|------|-------------|---------|
166+
| `-f, --force` | Force regeneration of the bot project | `false` |
167+
| `--prod` | Use production bot instead of dev bot | `false` |
168+
169+
**Script exports:**
170+
171+
Your script can export a function that will be called automatically:
172+
173+
```typescript
174+
// Option 1: Default export
175+
export default async function(arg1: string, arg2: string) {
176+
// Script logic
177+
}
178+
179+
// Option 2: Named 'run' export
180+
export async function run(arg1: string, arg2: string) {
181+
// Script logic
182+
}
183+
184+
// Option 3: Named 'main' export
185+
export async function main(arg1: string, arg2: string) {
186+
// Script logic
187+
}
188+
189+
// Option 4: Top-level code (runs on import)
190+
console.log("Script executed!")
191+
```
192+
193+
<Tip>
194+
Use `adk run` to execute migrations, seed data, run maintenance tasks, or any script that needs access to your agent's runtime context.
195+
</Tip>
196+
197+
---
198+
143199
### `adk mcp`
144200

145201
Start an MCP (Model Context Protocol) server for AI assistant integration. This allows AI coding assistants like Claude Code and Cursor to interact with your ADK agent.
@@ -373,13 +429,21 @@ adk link --workspace <workspaceId> --bot <botId> --dev <devBotId>
373429

374430
### `adk self-upgrade`
375431

376-
Upgrade ADK CLI to the latest version.
432+
Upgrade ADK CLI to the latest version or a specific version/tag.
377433

378434
**Usage:**
379435
```bash
380436
adk self-upgrade
437+
adk self-upgrade beta
438+
adk self-upgrade 1.13.0
381439
```
382440

441+
**Arguments:**
442+
443+
| Argument | Description |
444+
|----------|-------------|
445+
| `tag-or-version` | Optional. Tag (`beta`, `next`) or specific version (`1.13.0`) to install |
446+
383447
**Aliases:** `self-update`
384448

385449
---

0 commit comments

Comments
 (0)