@andreprado/agentkit 0.1.0-alpha.2 → 0.1.0-alpha.21
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 +68 -6
- package/docs/guides/add-channel.md +189 -7
- package/docs/guides/add-knowledge.md +144 -0
- package/docs/guides/add-managed-composio.md +163 -0
- package/docs/guides/add-tool.md +1 -1
- package/docs/guides/channel-security.md +128 -32
- package/docs/guides/connect-discord.md +178 -0
- package/docs/guides/connect-slack.md +126 -0
- package/docs/guides/connect-telegram.md +78 -1
- package/docs/guides/connect-whatsapp-evolution.md +121 -0
- package/docs/guides/connect-whatsapp-uazapi.md +126 -0
- package/docs/guides/connect-whatsapp-zapster.md +112 -8
- package/docs/guides/create-agent.md +45 -4
- package/docs/guides/debug-channel.md +147 -0
- package/docs/guides/improve-from-production.md +151 -0
- package/docs/guides/prepare-deploy.md +47 -17
- package/docs/guides/replay-production-traces.md +72 -0
- package/docs/guides/run-evals.md +147 -20
- package/docs/guides/security-rules.md +7 -6
- package/docs/guides/send-feedback.md +135 -0
- package/docs/guides/use-provider.md +27 -3
- package/docs/llms-full.txt +348 -55
- package/docs/llms.txt +62 -7
- package/package.json +2 -5
- package/src/cli/args.ts +57 -0
- package/src/cli/cloud-client.ts +377 -0
- package/src/cli/commands/channels.ts +1586 -0
- package/src/cli/commands/feedback.ts +438 -0
- package/src/cli/commands/knowledge.ts +136 -0
- package/src/cli/commands/transcribe.ts +171 -0
- package/src/cli/constants.ts +4 -0
- package/src/cli/deploy-chat-ui.ts +535 -0
- package/src/cli/deploy-readiness.ts +481 -0
- package/src/cli/flags.ts +162 -0
- package/src/cli/help.ts +236 -0
- package/src/cli/index.ts +1167 -1005
- package/src/cli/process.ts +31 -0
- package/src/cloud/artifact.ts +139 -0
- package/src/cloud/client.ts +80 -0
- package/src/cloud/contracts.ts +63 -0
- package/src/cloud/index.ts +3 -0
- package/src/create-project.ts +21 -6
- package/src/index.ts +517 -8
- package/src/providers/pi.ts +70 -16
- package/src/providers/test.ts +88 -1
- package/src/providers/types.ts +7 -0
- package/src/runtime/channel-buffer.ts +30 -0
- package/src/runtime/channel-test-harness.ts +21 -1
- package/src/runtime/channels/discord.ts +896 -0
- package/src/runtime/channels/generic-webhook.ts +225 -0
- package/src/runtime/channels/slack.ts +646 -0
- package/src/runtime/channels/telegram.ts +466 -23
- package/src/runtime/channels/whatsapp-evolution.ts +1357 -0
- package/src/runtime/channels/whatsapp-meta.ts +9 -0
- package/src/runtime/channels/whatsapp-uazapi.ts +1327 -0
- package/src/runtime/channels/whatsapp-zapster.ts +677 -40
- package/src/runtime/channels.ts +87 -4
- package/src/runtime/chat.ts +130 -38
- package/src/runtime/config.ts +519 -19
- package/src/runtime/core/manifest.ts +103 -5
- package/src/runtime/core/targets.ts +5 -5
- package/src/runtime/database.ts +93 -2
- package/src/runtime/db-commands.ts +9 -0
- package/src/runtime/deploy-readiness.ts +46 -4
- package/src/runtime/deploy.ts +1 -1
- package/src/runtime/dev-server.ts +779 -45
- package/src/runtime/env.ts +8 -3
- package/src/runtime/evals.ts +589 -43
- package/src/runtime/improve.ts +868 -0
- package/src/runtime/inspect.ts +194 -4
- package/src/runtime/integrations/composio.ts +423 -0
- package/src/runtime/knowledge/chunk.ts +333 -0
- package/src/runtime/knowledge/config.ts +135 -0
- package/src/runtime/knowledge/embeddings.ts +133 -0
- package/src/runtime/knowledge/ingest.ts +521 -0
- package/src/runtime/knowledge/prompt-policy.ts +30 -0
- package/src/runtime/knowledge/retrieve.ts +303 -0
- package/src/runtime/knowledge/schema.ts +100 -0
- package/src/runtime/knowledge/tool.ts +64 -0
- package/src/runtime/knowledge/vector.ts +258 -0
- package/src/runtime/prompt-context.ts +141 -0
- package/src/runtime/runtime-contract.ts +86 -8
- package/src/runtime/skills.ts +95 -0
- package/src/runtime/spec.ts +152 -0
- package/src/runtime/sync.ts +144 -0
- package/src/runtime/targets/cloudflare/build.ts +1468 -203
- package/src/runtime/targets/container/server.ts +1 -1
- package/src/runtime/targets/vps/deploy.ts +26 -9
- package/src/runtime/tool-runner.ts +9 -1
- package/src/runtime/tools.ts +128 -2
- package/src/runtime/traces.ts +41 -0
- package/src/runtime/transcription.ts +483 -0
- package/src/storage/sqlite.ts +149 -3
- package/src/templates/blank.ts +76 -17
- package/src/templates/dentista.ts +1011 -0
- package/src/templates/index.ts +2 -0
- package/src/templates/skills/agentkit-build-agent/SKILL.md +52 -0
- package/src/templates/skills/agentkit-build-agent/templates/appointment-intake.instructions.md +21 -0
- package/src/templates/skills/agentkit-build-agent/templates/sales-qualifier.instructions.md +17 -0
- package/src/templates/skills/agentkit-build-agent/templates/support-agent.instructions.md +16 -0
- package/src/templates/skills/agentkit-capsule/SKILL.md +70 -0
- package/src/templates/skills/agentkit-capsule/references/docs-router.md +15 -0
- package/src/templates/skills/agentkit-channels/SKILL.md +127 -0
- package/src/templates/skills/agentkit-channels/references/channel-buffering.md +65 -0
- package/src/templates/skills/agentkit-channels/references/channel-debugging.md +66 -0
- package/src/templates/skills/agentkit-channels/references/discord.md +93 -0
- package/src/templates/skills/agentkit-channels/references/slack.md +56 -0
- package/src/templates/skills/agentkit-channels/references/telegram.md +72 -0
- package/src/templates/skills/agentkit-channels/references/whatsapp-evolution.md +57 -0
- package/src/templates/skills/agentkit-channels/references/whatsapp-uazapi.md +61 -0
- package/src/templates/skills/agentkit-channels/references/whatsapp-zapster.md +77 -0
- package/src/templates/skills/agentkit-database/SKILL.md +45 -0
- package/src/templates/skills/agentkit-database/templates/appointments.schema.sql +15 -0
- package/src/templates/skills/agentkit-database/templates/leads.schema.sql +17 -0
- package/src/templates/skills/agentkit-deploy/SKILL.md +50 -0
- package/src/templates/skills/agentkit-evals/SKILL.md +109 -0
- package/src/templates/skills/agentkit-evals/templates/multi-turn.eval.md +29 -0
- package/src/templates/skills/agentkit-evals/templates/no-leak.eval.md +18 -0
- package/src/templates/skills/agentkit-evals/templates/smoke.eval.md +18 -0
- package/src/templates/skills/agentkit-evals/templates/tool-call.eval.md +27 -0
- package/src/templates/skills/agentkit-improve/SKILL.md +86 -0
- package/src/templates/skills/agentkit-improve/references/replay-side-effects.md +18 -0
- package/src/templates/skills/agentkit-improve/references/trace-packets.md +22 -0
- package/src/templates/skills/agentkit-improve/templates/regression.eval.md +18 -0
- package/src/templates/skills/agentkit-integrations/SKILL.md +76 -0
- package/src/templates/skills/agentkit-knowledge/SKILL.md +43 -0
- package/src/templates/skills/agentkit-knowledge/templates/faq.md +14 -0
- package/src/templates/skills/agentkit-knowledge/templates/policies.md +14 -0
- package/src/templates/skills/agentkit-knowledge/templates/prices.csv +3 -0
- package/src/templates/skills/agentkit-prompts/SKILL.md +47 -0
- package/src/templates/skills/agentkit-prompts/templates/knowledge-grounded-faq.instructions.md +11 -0
- package/src/templates/skills/agentkit-provider/SKILL.md +60 -0
- package/src/templates/skills/agentkit-security/SKILL.md +56 -0
- package/src/templates/skills/agentkit-tools/SKILL.md +37 -0
- package/src/templates/skills/agentkit-tools/examples/database-write.tool.md +35 -0
- package/src/templates/skills/agentkit-tools/examples/eval-safe-external-action.tool.md +37 -0
- package/src/templates/skills/agentkit-tools/examples/lookup-order.tool.md +46 -0
- package/src/templates/skills/agentkit-troubleshooting/SKILL.md +76 -0
- package/src/templates/support.ts +77 -18
- package/docs/guides/channels-production-handoff.md +0 -99
- package/docs/portable-deploy-release-checklist.md +0 -41
- package/src/runtime/targets/cloudflare/deploy.ts +0 -5475
package/docs/llms-full.txt
CHANGED
|
@@ -30,59 +30,96 @@ The capsule root is the runtime boundary. Run AgentKit commands from the directo
|
|
|
30
30
|
|
|
31
31
|
## Current Command Surface
|
|
32
32
|
|
|
33
|
-
|
|
33
|
+
Current commands:
|
|
34
34
|
|
|
35
35
|
```sh
|
|
36
|
-
agentkit new <name> --template blank
|
|
37
|
-
agentkit
|
|
38
|
-
agentkit
|
|
39
|
-
agentkit
|
|
36
|
+
agentkit new <name> [--template blank|support|dentista] [--no-install]
|
|
37
|
+
agentkit dev [--port <number>]
|
|
38
|
+
agentkit open
|
|
39
|
+
agentkit chat-ui --deploy
|
|
40
|
+
agentkit chat-ui --deploy [--port <number>] [--token-file <path>]
|
|
41
|
+
agentkit chat --message <text> [--conversation-id <id>]
|
|
42
|
+
agentkit tool <name> [--input <path-or-json>]
|
|
43
|
+
agentkit knowledge add <path-or-url>
|
|
44
|
+
agentkit knowledge sync
|
|
45
|
+
agentkit knowledge inspect
|
|
46
|
+
agentkit knowledge search <query> [--top-k <number>]
|
|
47
|
+
agentkit db migrate
|
|
48
|
+
agentkit db reset --yes
|
|
49
|
+
agentkit db shell
|
|
50
|
+
agentkit db seed [--file <path>]
|
|
40
51
|
agentkit eval run
|
|
52
|
+
agentkit eval from-conversation <conversation-id> [--out <path>] [--force]
|
|
53
|
+
agentkit improve collect [--deploy] [--since <duration|iso>] [--conversation-id <id>] [--out <directory>]
|
|
54
|
+
agentkit improve evals <bundle-dir-or-json> [--force]
|
|
55
|
+
agentkit replay <bundle-dir-or-json> --against local
|
|
56
|
+
agentkit feedback create [--about last-run|deploy|manual] [--kind bug|confusion|missing_docs|feature_request|deploy_issue|runtime_issue|other] --summary <text> [--message <text>] [--out <path>]
|
|
57
|
+
agentkit feedback preview [draft.json]
|
|
58
|
+
agentkit feedback send [draft.json] [--about last-run|deploy|manual] [--kind <kind>] --summary <text> [--message <text>] [--api <url>] [--save]
|
|
41
59
|
agentkit conversations list
|
|
42
60
|
agentkit conversations show <conversation-id>
|
|
61
|
+
agentkit conversations trace <conversation-id> [--deploy]
|
|
43
62
|
agentkit channels list
|
|
44
|
-
agentkit channels add website
|
|
45
|
-
agentkit channels
|
|
46
|
-
agentkit channels
|
|
47
|
-
agentkit channels
|
|
48
|
-
agentkit channels
|
|
49
|
-
agentkit channels
|
|
50
|
-
agentkit channels
|
|
51
|
-
agentkit channels
|
|
52
|
-
agentkit
|
|
53
|
-
agentkit
|
|
63
|
+
agentkit channels add <website|telegram|whatsapp|discord|slack|webhook> <name> [--provider zapster|meta|uazapi|evolution] [--mode interactions|bot] [--api <url>]
|
|
64
|
+
agentkit channels connect <website|telegram|whatsapp|discord|slack|webhook> <name> [--provider zapster|meta|uazapi|evolution] [--mode interactions|bot] [--api <url>]
|
|
65
|
+
agentkit channels setup <name> [--apply] [--api <url>]
|
|
66
|
+
agentkit channels status <name> [--api <url>]
|
|
67
|
+
agentkit channels test <name> [--message <text>] [--fixture <path>] [--api <url>]
|
|
68
|
+
agentkit channels test-audio <name> [--fixture voice-note|audio-file|<path>] [--api <url>]
|
|
69
|
+
agentkit channels deliveries list <name> [--api <url>]
|
|
70
|
+
agentkit channels deliveries show <delivery-id> [--api <url>]
|
|
71
|
+
agentkit integrations status [--toolkit <slug>] [--api <url>]
|
|
72
|
+
agentkit integrations connect composio [--toolkit <slug>] [--callback-url <url>] [--api <url>]
|
|
73
|
+
agentkit skills status
|
|
74
|
+
agentkit skills sync
|
|
54
75
|
agentkit inspect
|
|
55
|
-
agentkit
|
|
56
|
-
agentkit
|
|
57
|
-
agentkit
|
|
58
|
-
agentkit
|
|
59
|
-
agentkit
|
|
60
|
-
agentkit docs full
|
|
61
|
-
agentkit handoff codex [goal]
|
|
62
|
-
agentkit handoff claude [goal]
|
|
63
|
-
agentkit dev
|
|
64
|
-
agentkit dev --port 4124
|
|
65
|
-
agentkit build
|
|
66
|
-
agentkit deploy
|
|
67
|
-
agentkit deploy --dry-run
|
|
76
|
+
agentkit build [--target cloudflare|container]
|
|
77
|
+
agentkit billing checkout --slots <count> [--email <email>] [--api <url>]
|
|
78
|
+
agentkit billing status <billing-intent-id> --secret <secret> [--api <url>]
|
|
79
|
+
agentkit billing claim <billing-intent-id> --secret <secret> [--token-name <name>] [--api <url>]
|
|
80
|
+
agentkit billing portal [--api <url>]
|
|
68
81
|
agentkit login --token <token>
|
|
69
82
|
agentkit logout
|
|
83
|
+
agentkit account token create <name> [--api <url>] [--use] [--out <path>]
|
|
84
|
+
agentkit account token list [--api <url>]
|
|
85
|
+
agentkit account token revoke <token-id> [--api <url>]
|
|
86
|
+
agentkit deploy [--target cloudflare|vps] [--host <host>] [--api <url>] [--dry-run] [--anonymous] [--local-wrangler] [--smoke <message>]
|
|
87
|
+
agentkit deploy doctor [--api <url>] [--anonymous]
|
|
88
|
+
agentkit deploy smoke [--message <text>] [--api <url>]
|
|
70
89
|
agentkit deploy status
|
|
71
90
|
agentkit deploy pause
|
|
72
91
|
agentkit deploy resume
|
|
92
|
+
agentkit transcribe smoke [--provider test|openai|groq] [--model <model>] [--fixture <audio-file>]
|
|
73
93
|
agentkit secret set <NAME> <VALUE>
|
|
94
|
+
agentkit secret set <NAME> --stdin
|
|
95
|
+
agentkit secret set <NAME> --from-env [ENV_NAME]
|
|
96
|
+
agentkit secret set <NAME> --from-local-env
|
|
97
|
+
agentkit secret sync --from-local
|
|
74
98
|
agentkit secret list
|
|
75
99
|
agentkit secret unset <NAME>
|
|
76
|
-
agentkit access token create <name>
|
|
100
|
+
agentkit access token create <name> [--api <url>] [--out <path>]
|
|
77
101
|
agentkit access token list
|
|
78
102
|
agentkit access token revoke <token-id>
|
|
103
|
+
agentkit env set <NAME> <VALUE>
|
|
104
|
+
agentkit env set <NAME> --stdin
|
|
105
|
+
agentkit env set <NAME> --from-env [ENV_NAME]
|
|
106
|
+
agentkit env list
|
|
107
|
+
agentkit env unset <NAME>
|
|
108
|
+
agentkit docs path
|
|
109
|
+
agentkit docs llms
|
|
110
|
+
agentkit docs full
|
|
111
|
+
agentkit handoff codex [goal]
|
|
112
|
+
agentkit handoff claude [goal]
|
|
113
|
+
agentkit help commands
|
|
79
114
|
```
|
|
80
115
|
|
|
81
|
-
|
|
116
|
+
Prefer `env set --stdin` or `--from-env` for local secret values, and prefer `secret set --stdin`, `--from-env`, or `--from-local-env` for hosted secrets. Inline `<VALUE>` forms exist for simple non-sensitive values, but agents should avoid putting secrets in shell history.
|
|
82
117
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
118
|
+
Use `agentkit feedback create` when AgentKit itself fails, confuses the coding agent, or lacks docs. Drafts are local files under `.agentkit/feedback/` and are not sent automatically. Use `agentkit feedback send` only after reviewing the draft and logging in with `agentkit login --token agk_user_...`. Feedback upload uses authenticated AgentKit Cloud account auth, redacts common token/key patterns, does not upload arbitrary files, and does not cause the deployed agent runtime to phone home.
|
|
119
|
+
|
|
120
|
+
On Windows PowerShell, if `npm.ps1` or `npx.ps1` is blocked with `PSSecurityException`, run capsule scripts through the `.cmd` shims instead of changing the workflow. Examples: `npx.cmd @andreprado/agentkit@alpha new demo --template blank`, `npm.cmd run agentkit -- inspect`, `npm.cmd run agentkit -- knowledge sync`, and `npm.cmd run eval`.
|
|
121
|
+
|
|
122
|
+
Managed Composio is configured with `composioManaged({...})` in `agentkit.config.ts` and is paid hosted AgentKit infrastructure. It requires a non-anonymous AgentKit Cloud deploy with `managed_composio`, uses one Composio settings profile per agent, injects `COMPOSIO_API_KEY` as an AgentKit-managed secret, resolves toolkit auth configs from AgentKit Cloud, validates toolkit readiness during `agentkit deploy doctor`, and exposes the generated `agentkit_composio_execute` tool only for explicit configured action slugs. Calendar starters should include `GOOGLECALENDAR_EVENTS_LIST`, `GOOGLECALENDAR_CREATE_EVENT`, and `GOOGLECALENDAR_UPDATE_EVENT`; create-event calls must pass UTC `start_datetime` plus explicit duration. Managed external write actions require tool input `confirmed: true` by default unless the integration sets `confirmExternalWrites: false`. See `docs/guides/add-managed-composio.md`.
|
|
86
123
|
|
|
87
124
|
## Create And Test A Capsule
|
|
88
125
|
|
|
@@ -95,7 +132,6 @@ cd /tmp/agentkit-demo
|
|
|
95
132
|
|
|
96
133
|
npx @andreprado/agentkit@alpha new demo --template blank
|
|
97
134
|
cd demo
|
|
98
|
-
npm install
|
|
99
135
|
npm run chat -- --message "hello"
|
|
100
136
|
npm run chat -- --message "second message"
|
|
101
137
|
npm run eval
|
|
@@ -117,7 +153,6 @@ The primary flow is:
|
|
|
117
153
|
```sh
|
|
118
154
|
agentkit new eye-office-agent --template blank
|
|
119
155
|
cd eye-office-agent
|
|
120
|
-
npm install
|
|
121
156
|
```
|
|
122
157
|
|
|
123
158
|
Then open the folder in Codex, Claude Code, or another coding agent and ask directly:
|
|
@@ -126,7 +161,7 @@ Then open the folder in Codex, Claude Code, or another coding agent and ask dire
|
|
|
126
161
|
Develop an appointment and intake agent for an ophthalmology office.
|
|
127
162
|
```
|
|
128
163
|
|
|
129
|
-
The coding agent should infer the first useful version, edit `prompts/instructions.md`, `agentkit.config.ts`,
|
|
164
|
+
The coding agent should infer the first useful version, edit `prompts/instructions.md`, `agentkit.config.ts`, `schema.sql`, `tools/`, and `evals/`, then run the verification commands before finishing. Do not wait for a wizard or recipe. AgentKit provides the scaffold and contract; the coding agent implements directly in the capsule.
|
|
130
165
|
|
|
131
166
|
Optional handoff shortcut:
|
|
132
167
|
|
|
@@ -135,7 +170,9 @@ npm run agentkit -- handoff codex "Develop an appointment and intake agent for a
|
|
|
135
170
|
npm run agentkit -- handoff claude "Develop an appointment and intake agent for an ophthalmology office."
|
|
136
171
|
```
|
|
137
172
|
|
|
138
|
-
The command prints a ready-to-paste prompt that points the coding agent at `AGENTKIT.md` and the packaged `llms-full.txt` contract.
|
|
173
|
+
The command prints a ready-to-paste prompt that points the coding agent at `AGENTKIT.md`, the repo-local `skills/agentkit-capsule/SKILL.md` router when present, and the packaged `llms.txt` docs router. Load `llms-full.txt` only when a skill or ambiguous framework behavior requires the complete contract.
|
|
174
|
+
|
|
175
|
+
The generated docs and handoff prompt must make UI testing explicit. For local UI testing, run `npm run dev`, open the printed `Chat:` URL, and tell the owner the exact URL. For hosted UI testing after deploy, run `npm run agentkit -- chat-ui --deploy`, open the printed `Chat:` URL, and tell the owner it is connected to the hosted deploy.
|
|
139
176
|
|
|
140
177
|
## Agent Config
|
|
141
178
|
|
|
@@ -151,6 +188,7 @@ export default defineAgent({
|
|
|
151
188
|
name: "test",
|
|
152
189
|
model: "fake",
|
|
153
190
|
},
|
|
191
|
+
timeZone: "America/New_York",
|
|
154
192
|
instructions: "./prompts/instructions.md",
|
|
155
193
|
secrets: [],
|
|
156
194
|
tools: [],
|
|
@@ -163,6 +201,8 @@ export default defineAgent({
|
|
|
163
201
|
});
|
|
164
202
|
```
|
|
165
203
|
|
|
204
|
+
`timeZone` is optional and must be an IANA time zone when set. AgentKit injects dynamic runtime context into every chat run: current ISO timestamp, local date, local weekday, local date/time, and timezone. Use `timeZone` for scheduling, appointments, reminders, deadlines, and any prompt behavior that interprets "today", "tomorrow", weekdays, or relative dates. Do not hardcode today's date in `prompts/instructions.md`. If `timeZone` is omitted, AgentKit falls back to `AGENTKIT_TIME_ZONE`, then valid `TZ`, then the runtime default timezone.
|
|
205
|
+
|
|
166
206
|
Valid runtime values:
|
|
167
207
|
|
|
168
208
|
```txt
|
|
@@ -203,7 +243,11 @@ provider: {
|
|
|
203
243
|
secrets: [],
|
|
204
244
|
```
|
|
205
245
|
|
|
206
|
-
|
|
246
|
+
`test/fake` is deterministic. It is useful for scaffold checks, direct tool checks, and fake-provider evals, but it does not validate natural conversation quality.
|
|
247
|
+
|
|
248
|
+
Before claiming real conversation behavior has been tested, ask the owner which provider to use: OpenRouter, OpenAI, Anthropic, or another supported provider. Do not choose for them. After the owner chooses, update `agentkit.config.ts`, `.env.schema`, local secrets, hosted secrets if deploying, then rerun chat/UI checks.
|
|
249
|
+
|
|
250
|
+
OpenAI example:
|
|
207
251
|
|
|
208
252
|
```ts
|
|
209
253
|
provider: {
|
|
@@ -224,6 +268,75 @@ npm run chat -- --message "hello"
|
|
|
224
268
|
|
|
225
269
|
If a provider key is missing, the runtime returns `secret_not_found`.
|
|
226
270
|
|
|
271
|
+
For OpenRouter, prefer model ids or aliases known to the installed Pi SDK, such as `~google/gemini-flash-latest`. If an OpenRouter id is newer than Pi's registry, AgentKit passes the raw id through to OpenRouter with conservative unknown-model metadata. OpenRouter can still reject invalid, inaccessible, or unsupported models, and unknown-model cost/capability metadata is not authoritative.
|
|
272
|
+
|
|
273
|
+
## Knowledge Contract
|
|
274
|
+
|
|
275
|
+
Knowledge is AgentKit's native retrieval layer for facts the agent should ground in source files. Use it for FAQs, prices, policies, service descriptions, procedures, CSV tables, and reference docs. Do not put secrets, credentials, `.env` contents, or live customer/payment records in Knowledge. Use tools for live or authorization-sensitive data.
|
|
276
|
+
|
|
277
|
+
Configure Knowledge in `agentkit.config.ts`:
|
|
278
|
+
|
|
279
|
+
```ts
|
|
280
|
+
knowledge: {
|
|
281
|
+
sources: [
|
|
282
|
+
"knowledge/faq.md",
|
|
283
|
+
{ path: "knowledge/prices.csv", title: "Prices" },
|
|
284
|
+
],
|
|
285
|
+
retrieval: {
|
|
286
|
+
topK: 8,
|
|
287
|
+
hybrid: false,
|
|
288
|
+
},
|
|
289
|
+
},
|
|
290
|
+
```
|
|
291
|
+
|
|
292
|
+
Local Knowledge supports `.md`, `.markdown`, `.txt`, and `.csv` sources inside the Agent Capsule. Markdown chunks follow headings, text chunks follow paragraphs, and CSV chunks preserve row data with headers.
|
|
293
|
+
|
|
294
|
+
Embeddings are configured separately from the chat provider. The default provider is `none`, which gives local lexical search without an API key. For OpenAI embeddings:
|
|
295
|
+
|
|
296
|
+
```ts
|
|
297
|
+
knowledge: {
|
|
298
|
+
sources: ["knowledge/faq.md"],
|
|
299
|
+
embedding: {
|
|
300
|
+
provider: "openai",
|
|
301
|
+
model: "text-embedding-3-small",
|
|
302
|
+
secret: "KNOWLEDGE_OPENAI_API_KEY",
|
|
303
|
+
},
|
|
304
|
+
retrieval: {
|
|
305
|
+
topK: 8,
|
|
306
|
+
hybrid: true,
|
|
307
|
+
},
|
|
308
|
+
},
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
Set the local embedding secret with `agentkit env set KNOWLEDGE_OPENAI_API_KEY --stdin`. Do not commit the value.
|
|
312
|
+
|
|
313
|
+
Knowledge commands:
|
|
314
|
+
|
|
315
|
+
```sh
|
|
316
|
+
agentkit knowledge add knowledge/faq.md
|
|
317
|
+
agentkit knowledge sync
|
|
318
|
+
agentkit knowledge inspect
|
|
319
|
+
agentkit knowledge search "refund policy" --top-k 3
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
`knowledge add` indexes one local path. `knowledge sync` indexes all configured `knowledge.sources` and skips unchanged files by content hash. `agentkit dev` and `agentkit chat` also sync configured Knowledge automatically before local runs. `knowledge inspect` lists indexed sources and chunk counts. `knowledge search` validates retrieval before relying on the agent. Local lexical search uses SQLite FTS5 when the local SQLite build provides it; when it does not, AgentKit automatically keeps indexing and searching with a normal SQLite table and simpler text matching. When embeddings are configured locally, AgentKit stores canonical chunks in `.agentkit/agentkit.db`, rebuilds a local libSQL vector sidecar at `.agentkit/agentkit.vectors.db`, uses native `libsql_vector_idx` semantic search, and falls back to stored JSON embeddings if the native vector path is unavailable.
|
|
323
|
+
|
|
324
|
+
When `knowledge` is configured, AgentKit automatically registers the internal chat tool `agentkit_search_knowledge` and appends a prompt policy. The policy tells the agent to search before answering business-specific factual questions and not to expose raw retrieval JSON, scores, chunk IDs, or tool output objects. With `test/fake`, verify the internal tool directly:
|
|
325
|
+
|
|
326
|
+
```sh
|
|
327
|
+
agentkit chat --message '{"tool":"agentkit_search_knowledge","input":{"query":"refund policy","topK":1}}'
|
|
328
|
+
```
|
|
329
|
+
|
|
330
|
+
Expected output:
|
|
331
|
+
|
|
332
|
+
```txt
|
|
333
|
+
Tool agentkit_search_knowledge: completed
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
Cloudflare Knowledge deploys require `storage.driver: "agentkit"` and `storage.database.driver: "turso"`. `agentkit deploy doctor` and `agentkit build --target cloudflare` fail clearly when Knowledge is configured without Turso. Cloudflare artifacts include the Knowledge manifest, required embedding secret names, internal Knowledge schema, packaged local source contents, prompt policy, and hosted `agentkit_search_knowledge` runtime. During `agentkit deploy`, AgentKit Cloud applies the Knowledge schema, chunks packaged local sources, creates embeddings when configured, deletes stale hosted sources, and syncs sources, chunks, embedding metadata, FTS rows, and a native Turso `libsql_vector_idx` index into the project Turso database before publishing the Worker. Local `agentkit knowledge add/sync`, `agentkit dev`, and `agentkit chat` index configured Knowledge into local SQLite and the local libSQL vector sidecar; hosted deploy syncs configured local Knowledge sources automatically from the deploy artifact so private source material and embedding secrets do not move into client code. Hosted semantic search uses Turso native vector search when embeddings are configured and falls back to stored JSON embeddings if the native vector path is unavailable.
|
|
337
|
+
|
|
338
|
+
Full guide: `docs/guides/add-knowledge.md`.
|
|
339
|
+
|
|
227
340
|
## Channel Contract
|
|
228
341
|
|
|
229
342
|
Channels are hosted inbound/outbound conversation transports. They are separate from tools: channels receive user messages, while tools let the agent call external systems.
|
|
@@ -231,7 +344,7 @@ Channels are hosted inbound/outbound conversation transports. They are separate
|
|
|
231
344
|
Use these helpers in `agentkit.config.ts`:
|
|
232
345
|
|
|
233
346
|
```ts
|
|
234
|
-
import { defineAgent, telegramChannel, whatsappChannel, websiteChannel } from "@andreprado/agentkit";
|
|
347
|
+
import { defineAgent, discordChannel, slackChannel, telegramChannel, webhookChannel, whatsappChannel, websiteChannel } from "@andreprado/agentkit";
|
|
235
348
|
|
|
236
349
|
export default defineAgent({
|
|
237
350
|
name: "support-agent",
|
|
@@ -244,6 +357,11 @@ export default defineAgent({
|
|
|
244
357
|
websiteChannel({ name: "website-chat" }),
|
|
245
358
|
telegramChannel({ name: "support-telegram" }),
|
|
246
359
|
whatsappChannel({ name: "support-whatsapp", provider: "zapster" }),
|
|
360
|
+
whatsappChannel({ name: "support-uazapi", provider: "uazapi" }),
|
|
361
|
+
discordChannel({ name: "support-discord" }),
|
|
362
|
+
discordChannel({ name: "server-discord", mode: "bot" }),
|
|
363
|
+
slackChannel({ name: "support-slack" }),
|
|
364
|
+
webhookChannel({ name: "n8n-webhook" }),
|
|
247
365
|
],
|
|
248
366
|
access: { mode: "public" },
|
|
249
367
|
storage: { driver: "agentkit" },
|
|
@@ -257,15 +375,36 @@ Rules:
|
|
|
257
375
|
- Config stores secret names only, never secret values.
|
|
258
376
|
- AgentKit owns channel webhook URLs, dedupe, identities, queue state, and delivery logs.
|
|
259
377
|
- Do not store channel plumbing in the user's Turso database.
|
|
378
|
+
- Use `buffer.mode: "debounce"` when a channel should coalesce rapid client messages into one agent run.
|
|
379
|
+
- Buffered deliveries show `buffered`, then flush to one `queued` run after `quietWindowMs`, `maxWaitMs`, `maxMessages`, or `maxChars`.
|
|
380
|
+
|
|
381
|
+
Channel buffer example:
|
|
382
|
+
|
|
383
|
+
```ts
|
|
384
|
+
whatsappChannel({
|
|
385
|
+
name: "support-whatsapp",
|
|
386
|
+
provider: "zapster",
|
|
387
|
+
buffer: {
|
|
388
|
+
mode: "debounce",
|
|
389
|
+
quietWindowMs: 2500,
|
|
390
|
+
maxWaitMs: 12000,
|
|
391
|
+
maxMessages: 20,
|
|
392
|
+
maxChars: 8000,
|
|
393
|
+
},
|
|
394
|
+
})
|
|
395
|
+
```
|
|
260
396
|
|
|
261
397
|
Useful guides:
|
|
262
398
|
|
|
263
399
|
- Add a channel: `docs/guides/add-channel.md`
|
|
400
|
+
- Connect Discord: `docs/guides/connect-discord.md`
|
|
401
|
+
- Connect Slack: `docs/guides/connect-slack.md`
|
|
264
402
|
- Connect Telegram: `docs/guides/connect-telegram.md`
|
|
403
|
+
- Connect WhatsApp through Evolution API: `docs/guides/connect-whatsapp-evolution.md`
|
|
404
|
+
- Connect WhatsApp through UAZAPI: `docs/guides/connect-whatsapp-uazapi.md`
|
|
265
405
|
- Connect WhatsApp through Zapster: `docs/guides/connect-whatsapp-zapster.md`
|
|
266
406
|
- Debug a channel: `docs/guides/debug-channel.md`
|
|
267
407
|
- Channel security: `docs/guides/channel-security.md`
|
|
268
|
-
- Production handoff: `docs/guides/channels-production-handoff.md`
|
|
269
408
|
|
|
270
409
|
Telegram required secrets:
|
|
271
410
|
|
|
@@ -278,9 +417,56 @@ Zapster WhatsApp required secrets:
|
|
|
278
417
|
|
|
279
418
|
```txt
|
|
280
419
|
ZAPSTER_API_KEY
|
|
281
|
-
|
|
420
|
+
ZAPSTER_INSTANCE_ID
|
|
421
|
+
ZAPSTER_WEBHOOK_ID
|
|
282
422
|
```
|
|
283
423
|
|
|
424
|
+
UAZAPI WhatsApp required secrets:
|
|
425
|
+
|
|
426
|
+
```txt
|
|
427
|
+
UAZAPI_BASE_URL
|
|
428
|
+
UAZAPI_TOKEN
|
|
429
|
+
```
|
|
430
|
+
|
|
431
|
+
Evolution API WhatsApp required secrets:
|
|
432
|
+
|
|
433
|
+
```txt
|
|
434
|
+
EVOLUTION_API_BASE_URL
|
|
435
|
+
EVOLUTION_API_KEY
|
|
436
|
+
EVOLUTION_INSTANCE_NAME
|
|
437
|
+
EVOLUTION_WEBHOOK_TOKEN
|
|
438
|
+
```
|
|
439
|
+
|
|
440
|
+
Discord slash-command required secret:
|
|
441
|
+
|
|
442
|
+
```txt
|
|
443
|
+
DISCORD_PUBLIC_KEY
|
|
444
|
+
```
|
|
445
|
+
|
|
446
|
+
Discord bot-mode required secret:
|
|
447
|
+
|
|
448
|
+
```txt
|
|
449
|
+
DISCORD_BOT_TOKEN
|
|
450
|
+
```
|
|
451
|
+
|
|
452
|
+
Generic webhook required secret:
|
|
453
|
+
|
|
454
|
+
```txt
|
|
455
|
+
AGENTKIT_WEBHOOK_SECRET
|
|
456
|
+
```
|
|
457
|
+
|
|
458
|
+
Generic webhook payloads should be canonical JSON:
|
|
459
|
+
|
|
460
|
+
```json
|
|
461
|
+
{
|
|
462
|
+
"event_id": "evt_123",
|
|
463
|
+
"external_id": "customer_123",
|
|
464
|
+
"message": "hello from n8n"
|
|
465
|
+
}
|
|
466
|
+
```
|
|
467
|
+
|
|
468
|
+
Use `Authorization: Bearer <AGENTKIT_WEBHOOK_SECRET>`, `X-AgentKit-Webhook-Secret`, or `X-AgentKit-Webhook-Signature: sha256=<hmac>` where the HMAC is SHA-256 over the exact raw JSON body. The hosted URL is `/channels/<name>/webhook`.
|
|
469
|
+
|
|
284
470
|
Common channel verification:
|
|
285
471
|
|
|
286
472
|
```sh
|
|
@@ -288,23 +474,37 @@ agentkit inspect
|
|
|
288
474
|
agentkit deploy
|
|
289
475
|
agentkit channels list
|
|
290
476
|
agentkit channels add telegram support-telegram
|
|
477
|
+
agentkit channels connect whatsapp main-whatsapp --provider evolution
|
|
478
|
+
agentkit channels connect whatsapp support-whatsapp --provider uazapi
|
|
479
|
+
agentkit channels connect discord support-discord
|
|
480
|
+
agentkit channels connect discord server-discord --mode bot
|
|
481
|
+
agentkit channels connect slack support-slack
|
|
482
|
+
agentkit channels connect webhook n8n-webhook
|
|
291
483
|
agentkit channels setup support-telegram
|
|
292
484
|
agentkit channels test support-telegram --message "hello"
|
|
485
|
+
agentkit channels test-audio support-telegram --fixture voice-note
|
|
486
|
+
agentkit transcribe smoke --provider groq
|
|
293
487
|
agentkit channels deliveries list support-telegram
|
|
294
488
|
agentkit channels deliveries show <delivery-id>
|
|
295
489
|
```
|
|
296
490
|
|
|
297
|
-
`channels setup` is read-only by default. `channels setup <telegram-name> --apply` calls Telegram `setWebhook` and requires `TELEGRAM_BOT_TOKEN` plus `TELEGRAM_WEBHOOK_SECRET`.
|
|
491
|
+
`channels connect` creates or refreshes the channel resource, validates secrets, runs provider setup when supported, then runs the official synthetic smoke. `channels setup` is read-only by default. `channels setup <telegram-name> --apply` calls Telegram `setWebhook` and requires `TELEGRAM_BOT_TOKEN` plus `TELEGRAM_WEBHOOK_SECRET`. `channels setup <uazapi-whatsapp-name> --apply` calls UAZAPI `/webhook` and requires `UAZAPI_BASE_URL` plus `UAZAPI_TOKEN`. `channels setup <evolution-whatsapp-name> --apply` calls Evolution API `/webhook/set/{instance}` and requires `EVOLUTION_API_BASE_URL`, `EVOLUTION_API_KEY`, `EVOLUTION_INSTANCE_NAME`, and `EVOLUTION_WEBHOOK_TOKEN`.
|
|
492
|
+
|
|
493
|
+
Discord slash-command mode validates `X-Signature-Ed25519` and `X-Signature-Timestamp` against `DISCORD_PUBLIC_KEY`, answers signed `PING` requests with `type: 1`, acknowledges slash commands with a deferred response, then sends the final answer as an interaction follow-up. Discord bot mode uses `DISCORD_BOT_TOKEN`, Discord Gateway `MESSAGE_CREATE`, Message Content Intent, and `/channels/<channel_id>/messages` bot replies. Discord channels support buffering but do not support `audio` in V1.
|
|
298
494
|
|
|
299
495
|
Default tests are offline. Real provider smoke tests are opt-in:
|
|
300
496
|
|
|
301
497
|
```sh
|
|
302
498
|
AGENTKIT_RUN_TELEGRAM_CHANNEL_TESTS=1 bun test
|
|
303
499
|
AGENTKIT_RUN_ZAPSTER_CHANNEL_TESTS=1 bun test
|
|
500
|
+
AGENTKIT_RUN_UAZAPI_CHANNEL_TESTS=1 bun test
|
|
501
|
+
AGENTKIT_RUN_EVOLUTION_CHANNEL_TESTS=1 bun test
|
|
304
502
|
```
|
|
305
503
|
|
|
306
504
|
Telegram smoke also requires `TELEGRAM_BOT_TOKEN`, `TELEGRAM_WEBHOOK_SECRET`, and `AGENTKIT_TELEGRAM_WEBHOOK_URL`.
|
|
307
505
|
Zapster smoke also requires `ZAPSTER_API_KEY`, `AGENTKIT_ZAPSTER_SEND_URL`, and `AGENTKIT_ZAPSTER_TO`.
|
|
506
|
+
UAZAPI smoke also requires `UAZAPI_BASE_URL`, `UAZAPI_TOKEN`, and `AGENTKIT_UAZAPI_TO`.
|
|
507
|
+
Evolution smoke also requires `EVOLUTION_API_BASE_URL`, `EVOLUTION_API_KEY`, `EVOLUTION_INSTANCE_NAME`, and `AGENTKIT_EVOLUTION_TO`.
|
|
308
508
|
|
|
309
509
|
## Tool Contract
|
|
310
510
|
|
|
@@ -368,6 +568,7 @@ Tool runtime rules:
|
|
|
368
568
|
- tools that need SQL use canonical `ctx.db`; `ctx.database` and `ctx.storage.sql` are supported aliases;
|
|
369
569
|
- tools can use `ctx.db.batch([...])` for atomic writes; local tools can also use `ctx.db.transaction(async (tx) => ...)`;
|
|
370
570
|
- tools can inspect `ctx.runtime` with `{ environment, invocation, target, database }`;
|
|
571
|
+
- tools can use `ctx.clock` for the same runtime clock injected into the agent prompt, including `now`, `isoTimestamp`, `timeZone`, `localDate`, `localWeekday`, and `localDateTime`;
|
|
371
572
|
- tools must not import local database drivers or Node-only APIs. Use AgentKit runtime services instead.
|
|
372
573
|
|
|
373
574
|
## Database Tools And Dual Storage
|
|
@@ -540,6 +741,8 @@ Run:
|
|
|
540
741
|
agentkit dev
|
|
541
742
|
```
|
|
542
743
|
|
|
744
|
+
If the default local port is occupied, `agentkit dev` chooses the next available port and prints the actual URLs. If the occupied port is another AgentKit server, the output names the agent using it.
|
|
745
|
+
|
|
543
746
|
Expected output:
|
|
544
747
|
|
|
545
748
|
```txt
|
|
@@ -551,6 +754,12 @@ Inspect: http://localhost:4123/_agentkit
|
|
|
551
754
|
Storage: .agentkit/agentkit.db
|
|
552
755
|
```
|
|
553
756
|
|
|
757
|
+
To reopen the local UI for the current capsule after the server is already running:
|
|
758
|
+
|
|
759
|
+
```sh
|
|
760
|
+
agentkit open
|
|
761
|
+
```
|
|
762
|
+
|
|
554
763
|
Endpoints:
|
|
555
764
|
|
|
556
765
|
```txt
|
|
@@ -558,6 +767,7 @@ GET /_agentkit
|
|
|
558
767
|
POST /v1/chat
|
|
559
768
|
GET /v1/conversations
|
|
560
769
|
GET /v1/conversations/:id
|
|
770
|
+
GET /v1/conversations/:id/trace
|
|
561
771
|
```
|
|
562
772
|
|
|
563
773
|
Chat request:
|
|
@@ -568,6 +778,8 @@ curl -X POST http://localhost:4123/v1/chat \
|
|
|
568
778
|
-d '{"message":{"role":"user","content":"hello"}}'
|
|
569
779
|
```
|
|
570
780
|
|
|
781
|
+
The chat response includes `conversationId`. Send the same `conversationId` on the next `POST /v1/chat` request, or pass it to `agentkit chat --conversation-id <id>`, to continue with the persisted message history.
|
|
782
|
+
|
|
571
783
|
## Conversations
|
|
572
784
|
|
|
573
785
|
After chat:
|
|
@@ -575,6 +787,7 @@ After chat:
|
|
|
575
787
|
```sh
|
|
576
788
|
agentkit conversations list
|
|
577
789
|
agentkit conversations show <conversation-id>
|
|
790
|
+
agentkit conversations trace <conversation-id>
|
|
578
791
|
```
|
|
579
792
|
|
|
580
793
|
List output columns:
|
|
@@ -583,7 +796,7 @@ List output columns:
|
|
|
583
796
|
id title updated_at messages
|
|
584
797
|
```
|
|
585
798
|
|
|
586
|
-
Show output includes the conversation id, title, updated timestamp, and each message as `role: content`.
|
|
799
|
+
Show output includes the conversation id, title, updated timestamp, and each message as `role: content`. Trace output includes stored messages and tool calls for the conversation.
|
|
587
800
|
|
|
588
801
|
## Evals
|
|
589
802
|
|
|
@@ -602,14 +815,83 @@ npm run eval
|
|
|
602
815
|
Supported assertion types:
|
|
603
816
|
|
|
604
817
|
```txt
|
|
605
|
-
contains
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
818
|
+
response.contains
|
|
819
|
+
response.containsAll
|
|
820
|
+
response.containsAny
|
|
821
|
+
response.caseInsensitiveContains
|
|
822
|
+
response.notContains
|
|
823
|
+
response.regex
|
|
824
|
+
response.matchesRegex
|
|
825
|
+
response.notRegex
|
|
826
|
+
response.maxLength
|
|
827
|
+
tools.called
|
|
828
|
+
tools.calledOnce
|
|
829
|
+
tools.count
|
|
830
|
+
tools.order
|
|
831
|
+
tools.persisted
|
|
832
|
+
```
|
|
833
|
+
|
|
834
|
+
Import `defineEval` from `@andreprado/agentkit` when writing new evals. `tools.persisted` validates the tool call saved in local SQLite `tool_calls`, not a provider-specific raw response shape. It can be a tool name string or an object with `name`, `input`, `output`, `rendered`, `status`, and/or `visibility`. `tool_call` and `persisted_tool_call` remain accepted as backwards-compatible aliases, but new evals should use `tools.persisted`.
|
|
835
|
+
|
|
836
|
+
For date-sensitive evals, set top-level `now` to an ISO timestamp with an explicit timezone designator such as `Z` or `-05:00`. AgentKit uses that fixed clock for every turn and tool call in the eval so "today", "tomorrow", and weekdays remain deterministic while normal chat continues to use the real current date.
|
|
837
|
+
|
|
838
|
+
Evals run the normal capsule tools. If a tool would write externally, delete, charge money, send email, or call a real customer system, make its `execute` implementation branch on `ctx.runtime.environment === "eval"` and return deterministic non-destructive output for eval runs. Do not invent an eval-only mock API; keep the behavior inside the registered tool contract unless AgentKit adds a first-class mock facility later.
|
|
839
|
+
|
|
840
|
+
## Improve From Production
|
|
841
|
+
|
|
842
|
+
Use AgentKit Improve when a hosted or local conversation should become a reproducible local fix loop. Hosted AgentKit Cloud exports evidence; the local coding agent edits the Agent Capsule, writes evals, replays, and deploys.
|
|
843
|
+
|
|
844
|
+
Collect hosted evidence from the last deploy:
|
|
845
|
+
|
|
846
|
+
```sh
|
|
847
|
+
agentkit improve collect --deploy --since 24h
|
|
848
|
+
```
|
|
849
|
+
|
|
850
|
+
When the CLI is logged in to AgentKit Cloud, hosted collection first exports deploy evidence such as failed channel deliveries, deploy errors, and conversation IDs from the control plane, then reads replayable conversation traces from the deployed runtime. Without Cloud auth, it falls back to deploy-token conversation trace reads.
|
|
851
|
+
|
|
852
|
+
Hosted conversation reads require a deploy access token even when the chat endpoint is public. `agentkit deploy` normally writes `.agentkit/chat-access-token.json`; use `agentkit access token create agentkit-chat-ui --out .agentkit/chat-access-token.json` to refresh it.
|
|
853
|
+
|
|
854
|
+
Collect one hosted conversation:
|
|
855
|
+
|
|
856
|
+
```sh
|
|
857
|
+
agentkit improve collect --deploy --conversation-id <conversation-id>
|
|
858
|
+
```
|
|
859
|
+
|
|
860
|
+
Collect local evidence:
|
|
861
|
+
|
|
862
|
+
```sh
|
|
863
|
+
agentkit improve collect --since 7d
|
|
864
|
+
```
|
|
865
|
+
|
|
866
|
+
The command writes ignored local state:
|
|
867
|
+
|
|
868
|
+
```txt
|
|
869
|
+
.agentkit/improve/<run>/
|
|
870
|
+
bundle.json
|
|
871
|
+
report.json
|
|
872
|
+
traces/
|
|
610
873
|
```
|
|
611
874
|
|
|
612
|
-
|
|
875
|
+
Generate committed regression evals:
|
|
876
|
+
|
|
877
|
+
```sh
|
|
878
|
+
agentkit improve evals .agentkit/improve/<run>
|
|
879
|
+
```
|
|
880
|
+
|
|
881
|
+
Then replay before deploying:
|
|
882
|
+
|
|
883
|
+
```sh
|
|
884
|
+
agentkit replay .agentkit/improve/<run> --against local
|
|
885
|
+
npm run eval
|
|
886
|
+
agentkit deploy --smoke "hello"
|
|
887
|
+
```
|
|
888
|
+
|
|
889
|
+
Replay runs collected user turns through the local capsule with `ctx.runtime.environment === "eval"` and `ctx.runtime.invocation === "eval"`. Generated evals live under `evals/regressions/`; review them before committing, especially when traces contain real client details or overly strict prose assertions.
|
|
890
|
+
|
|
891
|
+
Full guides:
|
|
892
|
+
|
|
893
|
+
- `docs/guides/improve-from-production.md`
|
|
894
|
+
- `docs/guides/replay-production-traces.md`
|
|
613
895
|
|
|
614
896
|
## Security Rules
|
|
615
897
|
|
|
@@ -634,7 +916,7 @@ prompts/
|
|
|
634
916
|
docs/
|
|
635
917
|
```
|
|
636
918
|
|
|
637
|
-
Local `.env` is development only. Use `.env.schema` as the committed secret-name contract; local AgentKit commands load `.env` directly. Hosted
|
|
919
|
+
Local `.env` is development only. Use `.env.schema` as the committed secret-name contract; local AgentKit commands load `.env` directly. Hosted deploys require an AgentKit Cloud account with `cloudflare_deploy_alpha` or purchased/manual deploy slots. First-time paid access uses `agentkit billing checkout --slots <count>` and `agentkit billing claim billint_... --secret bsec_...`; existing accounts use `agentkit login --token ...`. Hosted secrets use `agentkit secret set/list/unset` or `agentkit secret sync --from-local`. Prefer `--stdin`, `--from-env`, `--from-local-env`, or sync from local `.env` so secret values do not appear in shell history. Inline `<VALUE>` forms exist only for compatibility and simple non-sensitive values.
|
|
638
920
|
|
|
639
921
|
Tools are a security boundary. A tool must declare every secret it needs. The runtime injects only tool-declared secrets.
|
|
640
922
|
|
|
@@ -646,22 +928,31 @@ Current flow:
|
|
|
646
928
|
|
|
647
929
|
```sh
|
|
648
930
|
agentkit deploy --dry-run
|
|
931
|
+
agentkit billing checkout --slots 1 --email user@example.com
|
|
932
|
+
agentkit billing claim billint_... --secret bsec_...
|
|
649
933
|
agentkit login --token agk_user_...
|
|
934
|
+
agentkit account token create new-laptop --use
|
|
650
935
|
agentkit deploy doctor
|
|
651
|
-
agentkit deploy
|
|
936
|
+
agentkit deploy --smoke "hello"
|
|
652
937
|
agentkit deploy status
|
|
938
|
+
agentkit deploy smoke --message "hello"
|
|
939
|
+
agentkit chat-ui --deploy
|
|
653
940
|
```
|
|
654
941
|
|
|
655
|
-
`agentkit deploy doctor` checks AgentKit Cloud login,
|
|
942
|
+
`agentkit deploy doctor` checks AgentKit Cloud login, hosted deploy entitlement, online deploy capacity, hosted secrets, local `.env` names that still need `agentkit secret set`, managed Composio API/auth-config readiness by toolkit, and private-access runtime token handling. `agentkit deploy` sends the capsule to AgentKit Cloud, runs the same readiness check automatically before building and uploading, updates the current project deploy slot by default, and writes the local chat/UI deploy access token to `.agentkit/chat-access-token.json` for hosted deploys. `agentkit deploy --smoke "hello"` deploys and then tests `/v1/chat` with the deploy access token. `agentkit deploy smoke --message "hello"` repeats that smoke against the last local deploy. `agentkit chat-ui --deploy` serves a local UI pointed at the hosted deploy using that token without exposing it to browser code, shows the conversation id and tool calls, and supports starting a new conversation. Use `agentkit conversations trace <conversation-id> --deploy` to pull hosted conversation messages and tool calls from the last deploy. Production deploys require an account with `cloudflare_deploy_alpha` or purchased/manual deploy slots; local commands and dry-run builds do not require login. AgentKit owns infrastructure selection, backend migration, managed secrets, and public URL creation.
|
|
656
943
|
|
|
657
|
-
The CLI defaults to the hosted AgentKit Cloud API at `https://agentkit-cloud.aibuilders.com.br`. Use `AGENTKIT_CLOUD_API_URL` or `agentkit deploy --api <url>` only
|
|
944
|
+
The CLI defaults to the hosted AgentKit Cloud API at `https://agentkit-cloud.aibuilders.com.br`. Use `AGENTKIT_CLOUD_API_URL` or `agentkit deploy --api <url>` only when the owner gives you a non-default AgentKit Cloud API URL.
|
|
658
945
|
|
|
659
946
|
Account/access flow:
|
|
660
947
|
|
|
661
948
|
```sh
|
|
662
|
-
agentkit secret set OPENAI_API_KEY
|
|
949
|
+
agentkit secret set OPENAI_API_KEY --from-local-env
|
|
950
|
+
agentkit secret sync --from-local
|
|
663
951
|
agentkit secret list
|
|
664
|
-
agentkit
|
|
952
|
+
agentkit account token list
|
|
953
|
+
agentkit skills status
|
|
954
|
+
agentkit skills sync
|
|
955
|
+
agentkit access token create website-chat --out .agentkit/website-chat-access-token.json
|
|
665
956
|
agentkit access token list
|
|
666
957
|
```
|
|
667
958
|
|
|
@@ -710,6 +1001,8 @@ npm install
|
|
|
710
1001
|
npm run typecheck
|
|
711
1002
|
```
|
|
712
1003
|
|
|
1004
|
+
`agentkit new` installs dependencies by default. Run this if the scaffold used `--no-install`, the install failed, or `node_modules` was deleted.
|
|
1005
|
+
|
|
713
1006
|
Make sure `tsconfig.json` contains:
|
|
714
1007
|
|
|
715
1008
|
```json
|