@andreprado/agentkit 0.1.1 → 0.3.0
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 +8 -77
- package/docs/guides/add-channel.md +14 -92
- package/docs/guides/add-knowledge.md +0 -21
- package/docs/guides/add-tool.md +5 -11
- package/docs/guides/channel-security.md +3 -207
- package/docs/guides/connect-discord.md +7 -172
- package/docs/guides/connect-slack.md +6 -121
- package/docs/guides/connect-telegram.md +6 -165
- package/docs/guides/connect-whatsapp-evolution.md +6 -116
- package/docs/guides/connect-whatsapp-uazapi.md +6 -134
- package/docs/guides/connect-whatsapp-zapster.md +6 -202
- package/docs/guides/create-agent.md +5 -14
- package/docs/guides/debug-channel.md +4 -156
- package/docs/guides/improve-local.md +13 -0
- package/docs/guides/local-only-migration.md +35 -0
- package/docs/guides/replay-local-traces.md +11 -0
- package/docs/guides/run-evals.md +2 -4
- package/docs/guides/security-rules.md +5 -154
- package/docs/guides/use-jev.md +3 -6
- package/docs/guides/use-provider.md +5 -6
- package/docs/guides/write-feedback.md +10 -0
- package/docs/llms-full.txt +27 -448
- package/docs/llms.txt +8 -44
- package/package.json +3 -5
- package/src/cli/commands/channels.ts +8 -1613
- package/src/cli/commands/feedback.ts +8 -86
- package/src/cli/commands/provider.ts +29 -11
- package/src/cli/constants.ts +0 -3
- package/src/cli/flags.ts +0 -28
- package/src/cli/help.ts +16 -92
- package/src/cli/index.ts +15 -1091
- package/src/index.ts +6 -158
- package/src/providers/codex-auth.ts +16 -2
- package/src/providers/pi.ts +36 -19
- package/src/runtime/channels/discord.ts +2 -2
- package/src/runtime/chat.ts +5 -3
- package/src/runtime/config.ts +14 -148
- package/src/runtime/database.ts +2 -2
- package/src/runtime/dev-server.ts +8 -8
- package/src/runtime/env.ts +11 -0
- package/src/runtime/improve.ts +2 -262
- package/src/runtime/inspect.ts +13 -73
- package/src/runtime/knowledge/ingest.ts +1 -1
- package/src/runtime/knowledge/tool.ts +16 -2
- package/src/runtime/knowledge/vector.ts +1 -1
- package/src/runtime/tool-runner.ts +5 -3
- package/src/runtime/tools.ts +10 -14
- package/src/storage/sqlite.ts +11 -32
- package/src/templates/blank.ts +15 -102
- package/src/templates/common.ts +60 -0
- package/src/templates/dentista.ts +7 -74
- package/src/templates/skills/agentkit-capsule/SKILL.md +5 -7
- package/src/templates/skills/agentkit-capsule/references/docs-router.md +2 -3
- package/src/templates/skills/agentkit-channels/SKILL.md +6 -119
- package/src/templates/skills/agentkit-channels/references/channel-buffering.md +0 -9
- package/src/templates/skills/agentkit-channels/references/channel-debugging.md +1 -64
- package/src/templates/skills/agentkit-channels/references/discord.md +2 -92
- package/src/templates/skills/agentkit-channels/references/slack.md +2 -55
- package/src/templates/skills/agentkit-channels/references/telegram.md +2 -71
- package/src/templates/skills/agentkit-channels/references/whatsapp-evolution.md +2 -56
- package/src/templates/skills/agentkit-channels/references/whatsapp-uazapi.md +2 -53
- package/src/templates/skills/agentkit-channels/references/whatsapp-zapster.md +2 -70
- package/src/templates/skills/agentkit-database/SKILL.md +2 -4
- package/src/templates/skills/agentkit-evals/SKILL.md +1 -1
- package/src/templates/skills/agentkit-improve/SKILL.md +6 -85
- package/src/templates/skills/agentkit-improve/references/trace-packets.md +1 -1
- package/src/templates/skills/agentkit-provider/SKILL.md +1 -2
- package/src/templates/skills/agentkit-security/SKILL.md +1 -3
- package/src/templates/skills/agentkit-tools/SKILL.md +1 -1
- package/src/templates/skills/agentkit-tools/examples/database-write.tool.md +1 -2
- package/src/templates/skills/agentkit-troubleshooting/SKILL.md +5 -11
- package/src/templates/support.ts +8 -92
- package/docs/guides/add-managed-composio.md +0 -165
- package/docs/guides/improve-from-production.md +0 -151
- package/docs/guides/prepare-deploy.md +0 -227
- package/docs/guides/replay-production-traces.md +0 -72
- package/docs/guides/send-feedback.md +0 -135
- package/src/cli/cloud-client.ts +0 -377
- package/src/cli/deploy-chat-ui.ts +0 -606
- package/src/cli/deploy-readiness.ts +0 -561
- package/src/cloud/artifact.ts +0 -139
- package/src/cloud/client.ts +0 -80
- package/src/cloud/contracts.ts +0 -63
- package/src/cloud/index.ts +0 -3
- package/src/runtime/build.ts +0 -43
- package/src/runtime/core/deploy-state.ts +0 -54
- package/src/runtime/core/manifest.ts +0 -283
- package/src/runtime/core/targets.ts +0 -133
- package/src/runtime/deploy-readiness.ts +0 -135
- package/src/runtime/deploy.ts +0 -1
- package/src/runtime/integrations/composio.ts +0 -425
- package/src/runtime/targets/cloudflare/build.ts +0 -3319
- package/src/runtime/targets/container/build.ts +0 -146
- package/src/runtime/targets/container/server.ts +0 -33
- package/src/runtime/targets/vps/deploy.ts +0 -223
- package/src/templates/skills/agentkit-deploy/SKILL.md +0 -52
- package/src/templates/skills/agentkit-integrations/SKILL.md +0 -98
|
@@ -1,151 +0,0 @@
|
|
|
1
|
-
# Improve From Production
|
|
2
|
-
|
|
3
|
-
## Goal
|
|
4
|
-
|
|
5
|
-
Pull hosted or local conversation evidence into the Agent Capsule, turn it into regression evals, let the local coding agent patch the capsule, and replay before deploying again.
|
|
6
|
-
|
|
7
|
-
## When To Use This
|
|
8
|
-
|
|
9
|
-
Use this when a deployed agent gave a wrong answer, failed a tool call, mishandled a channel message, or needs production behavior converted into eval coverage.
|
|
10
|
-
|
|
11
|
-
AgentKit Cloud only exports redacted evidence. The local coding agent owns source edits, evals, replay, and deploy.
|
|
12
|
-
|
|
13
|
-
## Commands
|
|
14
|
-
|
|
15
|
-
Collect evidence from the last hosted deploy:
|
|
16
|
-
|
|
17
|
-
```sh
|
|
18
|
-
agentkit improve collect --deploy --since 24h
|
|
19
|
-
```
|
|
20
|
-
|
|
21
|
-
When the CLI is logged in to AgentKit Cloud, this command first asks the control plane for deploy evidence such as failed channel deliveries, deploy errors, and conversation IDs that need review. It then reads replayable hosted conversation traces from the deployed runtime with the deploy access token. If Cloud auth is not available, it still collects hosted conversations directly from the deploy URL.
|
|
22
|
-
|
|
23
|
-
Hosted conversation reads require a deploy access token even when the chat endpoint is public. `agentkit deploy` normally writes `.agentkit/chat-access-token.json`; refresh it with:
|
|
24
|
-
|
|
25
|
-
```sh
|
|
26
|
-
agentkit access token create agentkit-chat-ui --out .agentkit/chat-access-token.json
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
Collect one hosted conversation:
|
|
30
|
-
|
|
31
|
-
```sh
|
|
32
|
-
agentkit improve collect --deploy --conversation-id <conversation-id>
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
Collect local conversations instead:
|
|
36
|
-
|
|
37
|
-
```sh
|
|
38
|
-
agentkit improve collect --since 7d
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
Generate regression evals from the collected bundle:
|
|
42
|
-
|
|
43
|
-
```sh
|
|
44
|
-
agentkit improve evals .agentkit/improve/<run>
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
Replay the bundle against the local capsule:
|
|
48
|
-
|
|
49
|
-
```sh
|
|
50
|
-
agentkit replay .agentkit/improve/<run> --against local
|
|
51
|
-
```
|
|
52
|
-
|
|
53
|
-
## Files Created Or Edited
|
|
54
|
-
|
|
55
|
-
Evidence bundle, ignored local state:
|
|
56
|
-
|
|
57
|
-
```txt
|
|
58
|
-
.agentkit/improve/<run>/
|
|
59
|
-
bundle.json
|
|
60
|
-
report.json
|
|
61
|
-
traces/
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
Generated regression evals, committed source:
|
|
65
|
-
|
|
66
|
-
```txt
|
|
67
|
-
evals/regressions/
|
|
68
|
-
improve-<conversation>.eval.ts
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
The local coding agent may then edit:
|
|
72
|
-
|
|
73
|
-
```txt
|
|
74
|
-
prompts/instructions.md
|
|
75
|
-
agentkit.config.ts
|
|
76
|
-
tools/
|
|
77
|
-
knowledge/
|
|
78
|
-
evals/
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
Do not edit `.agentkit/improve/<run>/bundle.json` by hand.
|
|
82
|
-
|
|
83
|
-
## Workflow
|
|
84
|
-
|
|
85
|
-
```sh
|
|
86
|
-
agentkit improve collect --deploy --since 24h
|
|
87
|
-
agentkit improve evals .agentkit/improve/<run>
|
|
88
|
-
agentkit replay .agentkit/improve/<run> --against local
|
|
89
|
-
```
|
|
90
|
-
|
|
91
|
-
Then let the local coding agent inspect `report.json`, the generated eval files, prompts, tools, and Knowledge sources. After edits:
|
|
92
|
-
|
|
93
|
-
```sh
|
|
94
|
-
npm run typecheck
|
|
95
|
-
npm run agentkit -- inspect
|
|
96
|
-
npm run eval
|
|
97
|
-
agentkit replay .agentkit/improve/<run> --against local
|
|
98
|
-
agentkit deploy --smoke "hello"
|
|
99
|
-
```
|
|
100
|
-
|
|
101
|
-
## Safety Rules
|
|
102
|
-
|
|
103
|
-
- Do not paste secrets into evals, prompts, Knowledge files, or reports.
|
|
104
|
-
- Keep `.agentkit/improve/` out of commits.
|
|
105
|
-
- Review generated eval assertions before committing them. AgentKit redacts common email, phone, bearer token, and key patterns in generated eval text, but the local coding agent must still remove or generalize domain-specific client PII.
|
|
106
|
-
- For write, delete, payment, email, or customer-system tools, branch inside the tool on `ctx.runtime.environment === "eval"` and return deterministic non-destructive output.
|
|
107
|
-
- Treat hosted traces as customer evidence.
|
|
108
|
-
- If replay uses a real provider instead of `test/fake`, tell the owner because it may cost money and may be nondeterministic.
|
|
109
|
-
|
|
110
|
-
## Verification
|
|
111
|
-
|
|
112
|
-
```sh
|
|
113
|
-
npm run typecheck
|
|
114
|
-
npm run agentkit -- inspect
|
|
115
|
-
npm run eval
|
|
116
|
-
agentkit replay .agentkit/improve/<run> --against local
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
Expected:
|
|
120
|
-
|
|
121
|
-
- `improve collect` writes a bundle and report under `.agentkit/improve/`.
|
|
122
|
-
- Hosted collection includes a redacted `evidence` summary in `bundle.json` and `report.json` when AgentKit Cloud evidence export is available.
|
|
123
|
-
- `improve evals` writes eval files under `evals/regressions/`.
|
|
124
|
-
- `replay` reports passed, failed, and skipped traces.
|
|
125
|
-
- No production secret values appear in generated files.
|
|
126
|
-
|
|
127
|
-
## Troubleshooting
|
|
128
|
-
|
|
129
|
-
`No .agentkit/deploy.json found`:
|
|
130
|
-
|
|
131
|
-
Run `agentkit deploy` first, or collect local evidence without `--deploy`.
|
|
132
|
-
|
|
133
|
-
`deploy_conversation_request_failed`:
|
|
134
|
-
|
|
135
|
-
Refresh the deploy chat token with `agentkit access token create agentkit-chat-ui --out .agentkit/chat-access-token.json`, then retry.
|
|
136
|
-
|
|
137
|
-
`improve_evidence_store_not_configured`:
|
|
138
|
-
|
|
139
|
-
The Cloud API does not expose deploy evidence export yet. The CLI falls back to hosted conversation trace collection when possible.
|
|
140
|
-
|
|
141
|
-
`conversation_access_not_configured`:
|
|
142
|
-
|
|
143
|
-
The hosted runtime is not configured with a deploy access-token gate for conversation reads. Redeploy through AgentKit Cloud so the runtime gate is injected, or configure an explicit deploy/private token for local hosted testing.
|
|
144
|
-
|
|
145
|
-
`trace has no user turns`:
|
|
146
|
-
|
|
147
|
-
The trace cannot become a useful conversation eval. Keep the report for diagnosis, but do not commit an empty eval.
|
|
148
|
-
|
|
149
|
-
Generated eval is too strict:
|
|
150
|
-
|
|
151
|
-
Edit the eval to assert the important behavior, such as tool input, safety wording, or knowledge source usage, instead of exact prose.
|
|
@@ -1,227 +0,0 @@
|
|
|
1
|
-
# Prepare Deploy
|
|
2
|
-
|
|
3
|
-
## Goal
|
|
4
|
-
|
|
5
|
-
Prepare an Agent Capsule so a coding agent can run the same workflow a user will run:
|
|
6
|
-
|
|
7
|
-
```sh
|
|
8
|
-
agentkit deploy
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
The agent should not choose hosting targets or infrastructure providers. AgentKit owns that routing.
|
|
12
|
-
|
|
13
|
-
## When To Use This
|
|
14
|
-
|
|
15
|
-
Use this before asking a coding agent to make a capsule deployable, or before testing the end-to-end user flow from a clean scaffold.
|
|
16
|
-
|
|
17
|
-
## User Workflow
|
|
18
|
-
|
|
19
|
-
From the capsule root:
|
|
20
|
-
|
|
21
|
-
```sh
|
|
22
|
-
npm run typecheck
|
|
23
|
-
npm run agentkit -- inspect
|
|
24
|
-
npm run agentkit -- db migrate
|
|
25
|
-
npm run chat -- --message "hello"
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
All scaffold, local dev, chat, eval, inspect, database, and build commands are token-free. Hosted production deploy and hosted AgentKit Cloud changes require an AgentKit Cloud account token with hosted deploy access.
|
|
29
|
-
|
|
30
|
-
If the user does not have a token yet, start checkout from the CLI, finish Stripe Checkout in the browser, then claim the one-time checkout intent:
|
|
31
|
-
|
|
32
|
-
```sh
|
|
33
|
-
npm run agentkit -- billing checkout --slots 1 --email user@example.com
|
|
34
|
-
npm run agentkit -- billing claim billint_... --secret bsec_...
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
The claim command stores the returned `agk_user_...` token in the local AgentKit Cloud auth file. Treat the `bsec_...` checkout secret like a password; it exists only to claim the first token after checkout.
|
|
38
|
-
|
|
39
|
-
If the user already has a token:
|
|
40
|
-
|
|
41
|
-
```sh
|
|
42
|
-
npm run agentkit -- login --token agk_user_...
|
|
43
|
-
npm run agentkit -- deploy doctor
|
|
44
|
-
npm run agentkit -- secret set OPENAI_API_KEY --from-local-env
|
|
45
|
-
npm run agentkit -- deploy --smoke "hello"
|
|
46
|
-
npm run agentkit -- chat-ui --deploy
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
If the capsule uses OpenAI locally, put the user’s local key in `.env`:
|
|
50
|
-
|
|
51
|
-
```sh
|
|
52
|
-
OPENAI_API_KEY=sk-...
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
`.env` is local-only. Hosted deploy secrets are handled by AgentKit outside the capsule.
|
|
56
|
-
Hosted deploys require an account with either `cloudflare_deploy_alpha` or purchased/manual deploy slots. Deploy slots belong to the account, not to a specific token string.
|
|
57
|
-
|
|
58
|
-
To generate or switch account tokens after login:
|
|
59
|
-
|
|
60
|
-
```sh
|
|
61
|
-
npm run agentkit -- account token create new-laptop --use
|
|
62
|
-
npm run agentkit -- account token list
|
|
63
|
-
npm run agentkit -- account token revoke apitok_...
|
|
64
|
-
```
|
|
65
|
-
|
|
66
|
-
## What The Agent Should Edit
|
|
67
|
-
|
|
68
|
-
Review and edit:
|
|
69
|
-
|
|
70
|
-
```txt
|
|
71
|
-
agentkit.config.ts
|
|
72
|
-
prompts/instructions.md
|
|
73
|
-
tools/
|
|
74
|
-
evals/
|
|
75
|
-
.env.schema
|
|
76
|
-
AGENTS.md
|
|
77
|
-
CLAUDE.md
|
|
78
|
-
README.md
|
|
79
|
-
schema.sql
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
Never commit or deploy:
|
|
83
|
-
|
|
84
|
-
```txt
|
|
85
|
-
.env
|
|
86
|
-
.agentkit/
|
|
87
|
-
node_modules/
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
## Deploy-Ready Config Shape
|
|
91
|
-
|
|
92
|
-
Use the AgentKit-managed storage contract. Do not make the user or the coding agent choose a backend target or infrastructure provider.
|
|
93
|
-
|
|
94
|
-
```ts
|
|
95
|
-
export default defineAgent({
|
|
96
|
-
name: "support-agent",
|
|
97
|
-
runtime: "edge",
|
|
98
|
-
provider: {
|
|
99
|
-
name: "openai",
|
|
100
|
-
model: "gpt-4o-mini",
|
|
101
|
-
},
|
|
102
|
-
instructions: "./prompts/instructions.md",
|
|
103
|
-
secrets: ["OPENAI_API_KEY"],
|
|
104
|
-
tools: [],
|
|
105
|
-
access: {
|
|
106
|
-
mode: "private",
|
|
107
|
-
},
|
|
108
|
-
storage: {
|
|
109
|
-
driver: "agentkit",
|
|
110
|
-
},
|
|
111
|
-
});
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
This config is user-facing because it describes the agent contract: provider, prompts, tools, access, secrets, and managed storage. The concrete deploy target, database vendor, file bucket, and runtime host are not user-facing.
|
|
115
|
-
|
|
116
|
-
If the generated capsule already includes a managed database block, keep the `schema` path correct and put tables in `schema.sql`. The concrete database vendor is an AgentKit implementation detail.
|
|
117
|
-
|
|
118
|
-
## Database Rules
|
|
119
|
-
|
|
120
|
-
For agent-owned tables:
|
|
121
|
-
|
|
122
|
-
- Put tables and indexes in `schema.sql`.
|
|
123
|
-
- Keep `schema.sql` idempotent.
|
|
124
|
-
- Prefer `CREATE TABLE IF NOT EXISTS` and `CREATE INDEX IF NOT EXISTS`.
|
|
125
|
-
- Use `agentkit db migrate` before local tool/chat testing.
|
|
126
|
-
- Use `ctx.db` inside tools. `ctx.database` and `ctx.storage.sql` are aliases.
|
|
127
|
-
- Do not import local database drivers from tools.
|
|
128
|
-
|
|
129
|
-
Local commands use `.agentkit/agentkit.db`. Hosted deploy uses AgentKit-managed infrastructure.
|
|
130
|
-
|
|
131
|
-
## Verification
|
|
132
|
-
|
|
133
|
-
Run this before saying the capsule is deploy-ready:
|
|
134
|
-
|
|
135
|
-
```sh
|
|
136
|
-
npm run typecheck
|
|
137
|
-
npm run agentkit -- inspect
|
|
138
|
-
npm run agentkit -- db migrate
|
|
139
|
-
npm run chat -- --message "hello"
|
|
140
|
-
npm run agentkit -- deploy --dry-run
|
|
141
|
-
npm run agentkit -- deploy doctor
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
For a final end-to-end test, run:
|
|
145
|
-
|
|
146
|
-
```sh
|
|
147
|
-
npm run agentkit -- login --token agk_user_...
|
|
148
|
-
npm run agentkit -- account token list
|
|
149
|
-
npm run agentkit -- secret sync --from-local
|
|
150
|
-
npm run agentkit -- secret list
|
|
151
|
-
npm run agentkit -- deploy --smoke "hello"
|
|
152
|
-
npm run agentkit -- deploy status
|
|
153
|
-
npm run agentkit -- chat-ui --deploy
|
|
154
|
-
npm run agentkit -- access token list
|
|
155
|
-
```
|
|
156
|
-
|
|
157
|
-
For hosted deploys, `npm run agentkit -- deploy` writes the local chat/UI access token to `.agentkit/chat-access-token.json` and prints a production handoff with the deploy URL, UI command, secret status, database/schema artifact, integration connect commands, smoke status, and next recommended command. Use `npm run agentkit -- deploy --smoke "hello"` for the official hosted chat smoke, and use `npm run agentkit -- chat-ui --deploy` for hosted UI testing. The hosted Chat UI shows the conversation id, tool calls, tool errors, and a new-conversation control; use `npm run agentkit -- conversations trace <conversation-id> --deploy` to pull the hosted trace from the last deploy. Use `npm run agentkit -- access token create <name> --out <path>` only for additional clients.
|
|
158
|
-
|
|
159
|
-
When the UI is running, open the printed `Chat:` URL and tell the owner the exact URL. If the capsule is still on `test/fake`, say the UI was tested only with the deterministic fake provider.
|
|
160
|
-
|
|
161
|
-
## Readiness Checklist
|
|
162
|
-
|
|
163
|
-
```txt
|
|
164
|
-
No .env committed
|
|
165
|
-
No .agentkit committed
|
|
166
|
-
All required secret names are declared
|
|
167
|
-
Prompt path exists
|
|
168
|
-
Tools have input schemas
|
|
169
|
-
Read-only tools use `:read` permissions; dangerous tools use operator-only non-read permissions
|
|
170
|
-
Managed Composio toolkit auth configs are available in AgentKit Cloud when configured
|
|
171
|
-
Provider model is supported by AgentKit
|
|
172
|
-
schema.sql is idempotent
|
|
173
|
-
README/AGENTS/CLAUDE match the capsule
|
|
174
|
-
```
|
|
175
|
-
|
|
176
|
-
## Troubleshooting
|
|
177
|
-
|
|
178
|
-
`agentkit deploy` fails before publishing:
|
|
179
|
-
|
|
180
|
-
Read the AgentKit error code first. Common fixes are:
|
|
181
|
-
|
|
182
|
-
- run `npm run typecheck`;
|
|
183
|
-
- run `npm run agentkit -- inspect`;
|
|
184
|
-
- make tools edge-safe;
|
|
185
|
-
- declare missing secret names in `agentkit.config.ts`;
|
|
186
|
-
- keep production secret values out of source files.
|
|
187
|
-
|
|
188
|
-
Missing local OpenAI key:
|
|
189
|
-
|
|
190
|
-
```sh
|
|
191
|
-
echo 'OPENAI_API_KEY=sk-...' >> .env
|
|
192
|
-
```
|
|
193
|
-
|
|
194
|
-
Missing hosted secret:
|
|
195
|
-
|
|
196
|
-
Set the secret in AgentKit Cloud:
|
|
197
|
-
|
|
198
|
-
```sh
|
|
199
|
-
npm run agentkit -- secret set OPENAI_API_KEY --from-local-env
|
|
200
|
-
```
|
|
201
|
-
|
|
202
|
-
To sync all declared user-managed secrets present in local `.env`:
|
|
203
|
-
|
|
204
|
-
```sh
|
|
205
|
-
npm run agentkit -- secret sync --from-local
|
|
206
|
-
```
|
|
207
|
-
|
|
208
|
-
Do not write hosted secret values into the capsule.
|
|
209
|
-
|
|
210
|
-
Before a hosted production deploy, run:
|
|
211
|
-
|
|
212
|
-
```sh
|
|
213
|
-
npm run agentkit -- deploy doctor
|
|
214
|
-
```
|
|
215
|
-
|
|
216
|
-
The doctor checks AgentKit Cloud login, Node version, hosted deploy entitlement, online deploy capacity, declared hosted secrets, local `.env` names that have not been uploaded with `npm run agentkit -- secret set`, and private-access runtime token handling. `agentkit deploy` runs the same readiness check automatically before building and uploading the artifact.
|
|
217
|
-
|
|
218
|
-
If the capsule configures `composioManaged({...})`, the doctor also checks the paid `managed_composio` entitlement and AgentKit Cloud toolkit readiness. `COMPOSIO_API_KEY` and toolkit auth config resolution are AgentKit-managed in this path; the user must not set them with `agentkit secret set`.
|
|
219
|
-
|
|
220
|
-
`alpha_access_required`:
|
|
221
|
-
|
|
222
|
-
Log in with an account that has hosted deploy access. If the user needs to buy slots first:
|
|
223
|
-
|
|
224
|
-
```sh
|
|
225
|
-
npm run agentkit -- billing checkout --slots 1 --email user@example.com
|
|
226
|
-
npm run agentkit -- billing claim billint_... --secret bsec_...
|
|
227
|
-
```
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
# Replay Production Traces
|
|
2
|
-
|
|
3
|
-
## Goal
|
|
4
|
-
|
|
5
|
-
Run collected production or local traces against the local Agent Capsule before redeploying a fix.
|
|
6
|
-
|
|
7
|
-
## When To Use This
|
|
8
|
-
|
|
9
|
-
Use this after `agentkit improve collect` and before `agentkit deploy` whenever prompts, tools, Knowledge, provider config, or channel behavior changed because of production evidence.
|
|
10
|
-
|
|
11
|
-
## Commands
|
|
12
|
-
|
|
13
|
-
```sh
|
|
14
|
-
agentkit replay .agentkit/improve/<run> --against local
|
|
15
|
-
```
|
|
16
|
-
|
|
17
|
-
Run the full local eval suite too:
|
|
18
|
-
|
|
19
|
-
```sh
|
|
20
|
-
npm run eval
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
## What Replay Checks
|
|
24
|
-
|
|
25
|
-
Replay sends each collected user turn through the local capsule in eval mode:
|
|
26
|
-
|
|
27
|
-
```txt
|
|
28
|
-
ctx.runtime.environment === "eval"
|
|
29
|
-
ctx.runtime.invocation === "eval"
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
This proves the current capsule can process the production turns without runtime errors. Generated eval files under `evals/regressions/` add committed behavior assertions.
|
|
33
|
-
|
|
34
|
-
## Write Tool Safety
|
|
35
|
-
|
|
36
|
-
Replay still runs the registered capsule tools. Any tool that can write externally must guard eval mode:
|
|
37
|
-
|
|
38
|
-
```ts
|
|
39
|
-
if (ctx.runtime.environment === "eval") {
|
|
40
|
-
return { sent: false, evalFixture: true };
|
|
41
|
-
}
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
Do not depend on prompt wording alone to prevent side effects.
|
|
45
|
-
|
|
46
|
-
## Deploy Gate
|
|
47
|
-
|
|
48
|
-
Before redeploying a production fix:
|
|
49
|
-
|
|
50
|
-
```sh
|
|
51
|
-
npm run typecheck
|
|
52
|
-
npm run agentkit -- inspect
|
|
53
|
-
npm run eval
|
|
54
|
-
agentkit replay .agentkit/improve/<run> --against local
|
|
55
|
-
agentkit deploy --smoke "hello"
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
If replay fails, inspect the failed trace id in `.agentkit/improve/<run>/traces/`, patch the capsule, and rerun replay.
|
|
59
|
-
|
|
60
|
-
## Troubleshooting
|
|
61
|
-
|
|
62
|
-
`Replay failed`:
|
|
63
|
-
|
|
64
|
-
Read the printed error and the matching trace file. Common causes are missing local secrets, unsafe tools that do not branch on eval mode, stale Knowledge sources, or provider differences.
|
|
65
|
-
|
|
66
|
-
`Replay skipped`:
|
|
67
|
-
|
|
68
|
-
The trace had no user message. It may still help diagnose delivery or deploy state, but it cannot be replayed as a conversation.
|
|
69
|
-
|
|
70
|
-
`provider_model_unsupported`:
|
|
71
|
-
|
|
72
|
-
The local provider config does not match the replay environment. Keep deterministic regression replay on `test/fake` unless the owner intentionally selected a real provider.
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
# Send Feedback To AgentKit
|
|
2
|
-
|
|
3
|
-
## Goal
|
|
4
|
-
|
|
5
|
-
Create a redacted local feedback draft when AgentKit itself is confusing, missing docs, or failing, then send it to AgentKit Cloud only after the user has authenticated.
|
|
6
|
-
|
|
7
|
-
## When To Use This
|
|
8
|
-
|
|
9
|
-
Use this for AgentKit product feedback, not for the user's agent's client conversations.
|
|
10
|
-
|
|
11
|
-
Good cases:
|
|
12
|
-
|
|
13
|
-
- an AgentKit CLI command failed and the error did not explain recovery;
|
|
14
|
-
- a docs guide or generated skill is missing a step;
|
|
15
|
-
- deploy, channel, provider, eval, or runtime behavior looks like an AgentKit bug;
|
|
16
|
-
- the user's coding agent found a feature gap in AgentKit itself.
|
|
17
|
-
|
|
18
|
-
Do not use this to upload private client data, provider keys, `.env` values, or full conversation transcripts.
|
|
19
|
-
|
|
20
|
-
## Commands
|
|
21
|
-
|
|
22
|
-
Create a local draft only:
|
|
23
|
-
|
|
24
|
-
```sh
|
|
25
|
-
agentkit feedback create --about last-run --kind bug --summary "Deploy failed after secrets sync"
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
Preview a draft:
|
|
29
|
-
|
|
30
|
-
```sh
|
|
31
|
-
agentkit feedback preview .agentkit/feedback/<draft>.json
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
Send a saved draft:
|
|
35
|
-
|
|
36
|
-
```sh
|
|
37
|
-
agentkit login --token agk_user_...
|
|
38
|
-
agentkit feedback send .agentkit/feedback/<draft>.json
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
Create and send in one command:
|
|
42
|
-
|
|
43
|
-
```sh
|
|
44
|
-
agentkit feedback send --about deploy --kind deploy_issue --summary "Deploy doctor passed but deploy failed" --message "The recovery step was unclear."
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
## Files Created Or Edited
|
|
48
|
-
|
|
49
|
-
`feedback create` writes ignored local files:
|
|
50
|
-
|
|
51
|
-
```txt
|
|
52
|
-
.agentkit/feedback/<timestamp>-<summary>.json
|
|
53
|
-
.agentkit/feedback/<timestamp>-<summary>.md
|
|
54
|
-
```
|
|
55
|
-
|
|
56
|
-
These files are local diagnostic drafts. Keep `.agentkit/` out of commits.
|
|
57
|
-
|
|
58
|
-
## Minimal Working Example
|
|
59
|
-
|
|
60
|
-
```sh
|
|
61
|
-
agentkit feedback create \
|
|
62
|
-
--about last-run \
|
|
63
|
-
--kind missing_docs \
|
|
64
|
-
--summary "The channel debug guide did not explain Discord bot mode recovery" \
|
|
65
|
-
--message "The command failed after setup, and I could not tell whether to rerun connect or setup."
|
|
66
|
-
```
|
|
67
|
-
|
|
68
|
-
Review the printed JSON path, then send it:
|
|
69
|
-
|
|
70
|
-
```sh
|
|
71
|
-
agentkit feedback send .agentkit/feedback/<draft>.json
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
## Safety Rules
|
|
75
|
-
|
|
76
|
-
- Creating a draft never sends network feedback.
|
|
77
|
-
- Sending requires AgentKit Cloud login.
|
|
78
|
-
- The CLI redacts common bearer tokens, AgentKit tokens, provider key patterns, and Authorization headers before saving or sending.
|
|
79
|
-
- AgentKit Cloud validates the payload again and stores the redacted report under the authenticated account.
|
|
80
|
-
- Do not paste `.env` contents, provider key values, OAuth tokens, cookies, client PII, or full private transcripts into `--message`.
|
|
81
|
-
- The feedback command does not upload arbitrary files and does not ask AgentKit Cloud to fetch URLs.
|
|
82
|
-
- The deployed agent runtime does not send feedback to the AgentKit team.
|
|
83
|
-
|
|
84
|
-
## Verification
|
|
85
|
-
|
|
86
|
-
After creating a draft:
|
|
87
|
-
|
|
88
|
-
```sh
|
|
89
|
-
agentkit feedback preview .agentkit/feedback/<draft>.json
|
|
90
|
-
```
|
|
91
|
-
|
|
92
|
-
Expected:
|
|
93
|
-
|
|
94
|
-
- `schema_version` is `agentkit.feedback.v1`;
|
|
95
|
-
- `source.channel` is `cli`;
|
|
96
|
-
- `context` describes the current capsule and deploy shape;
|
|
97
|
-
- no secret values are present.
|
|
98
|
-
|
|
99
|
-
After sending:
|
|
100
|
-
|
|
101
|
-
```txt
|
|
102
|
-
Feedback sent
|
|
103
|
-
ID: fb_...
|
|
104
|
-
Status: new
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
## Troubleshooting
|
|
108
|
-
|
|
109
|
-
`auth_required`:
|
|
110
|
-
|
|
111
|
-
Log in before sending:
|
|
112
|
-
|
|
113
|
-
```sh
|
|
114
|
-
agentkit login --token agk_user_...
|
|
115
|
-
```
|
|
116
|
-
|
|
117
|
-
`feedback_draft_invalid`:
|
|
118
|
-
|
|
119
|
-
Recreate the draft with `agentkit feedback create`. Do not hand-edit the JSON schema unless you keep `schema_version: "agentkit.feedback.v1"`.
|
|
120
|
-
|
|
121
|
-
`payload_too_large`:
|
|
122
|
-
|
|
123
|
-
Shorten `--message`. Do not paste full logs; include the command, exact error code, and the smallest useful excerpt.
|
|
124
|
-
|
|
125
|
-
## Backend Contracts Used
|
|
126
|
-
|
|
127
|
-
Feedback submit uses authenticated AgentKit Cloud account auth:
|
|
128
|
-
|
|
129
|
-
```txt
|
|
130
|
-
POST /v1/feedback
|
|
131
|
-
Authorization: Bearer agk_user_...
|
|
132
|
-
Idempotency-Key: fbdraft_...
|
|
133
|
-
```
|
|
134
|
-
|
|
135
|
-
The endpoint accepts only structured JSON feedback and stores it in the AgentKit Cloud feedback inbox.
|