@andreprado/agentkit 0.1.0-alpha.2 → 0.1.0-alpha.20
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 +67 -6
- package/docs/guides/add-channel.md +118 -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 +97 -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-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 +303 -55
- package/docs/llms.txt +57 -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 +1315 -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 +479 -7
- 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 +8 -1
- package/src/runtime/channels/discord.ts +896 -0
- package/src/runtime/channels/slack.ts +646 -0
- package/src/runtime/channels/telegram.ts +466 -23
- package/src/runtime/channels/whatsapp-meta.ts +9 -0
- package/src/runtime/channels/whatsapp-zapster.ts +677 -40
- package/src/runtime/channels.ts +86 -3
- package/src/runtime/chat.ts +130 -38
- package/src/runtime/config.ts +483 -18
- 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 +759 -41
- 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 +1430 -185
- 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 +104 -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-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
|
@@ -0,0 +1,72 @@
|
|
|
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.
|
package/docs/guides/run-evals.md
CHANGED
|
@@ -22,6 +22,30 @@ Run evals:
|
|
|
22
22
|
agentkit eval run
|
|
23
23
|
```
|
|
24
24
|
|
|
25
|
+
If the capsule uses npm scripts and Windows PowerShell blocks `npm.ps1`, use:
|
|
26
|
+
|
|
27
|
+
```sh
|
|
28
|
+
npm.cmd run eval
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Create an eval from a stored conversation:
|
|
32
|
+
|
|
33
|
+
```sh
|
|
34
|
+
agentkit conversations list
|
|
35
|
+
agentkit conversations trace <conversation-id>
|
|
36
|
+
agentkit eval from-conversation <conversation-id>
|
|
37
|
+
agentkit eval run
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Create evals from hosted or local production evidence:
|
|
41
|
+
|
|
42
|
+
```sh
|
|
43
|
+
agentkit improve collect --deploy --since 24h
|
|
44
|
+
agentkit improve evals .agentkit/improve/<run>
|
|
45
|
+
agentkit replay .agentkit/improve/<run> --against local
|
|
46
|
+
agentkit eval run
|
|
47
|
+
```
|
|
48
|
+
|
|
25
49
|
## Files Created Or Edited
|
|
26
50
|
|
|
27
51
|
Create or edit:
|
|
@@ -34,63 +58,166 @@ Use conversations as source material:
|
|
|
34
58
|
|
|
35
59
|
```txt
|
|
36
60
|
.agentkit/agentkit.db
|
|
61
|
+
.agentkit/improve/<run>/
|
|
37
62
|
```
|
|
38
63
|
|
|
39
64
|
Do not edit `.agentkit/agentkit.db` by hand.
|
|
65
|
+
Do not edit `.agentkit/improve/<run>/bundle.json` by hand.
|
|
40
66
|
|
|
41
67
|
## Minimal Working Example
|
|
42
68
|
|
|
43
69
|
Generated smoke eval:
|
|
44
70
|
|
|
45
71
|
```ts
|
|
46
|
-
|
|
72
|
+
import { defineEval } from "@andreprado/agentkit";
|
|
73
|
+
|
|
74
|
+
export default defineEval({
|
|
47
75
|
name: "smoke",
|
|
48
76
|
input: "Say hello in one short sentence.",
|
|
49
77
|
expect: {
|
|
50
|
-
|
|
78
|
+
response: {
|
|
79
|
+
caseInsensitiveContains: "hello",
|
|
80
|
+
maxLength: 160,
|
|
81
|
+
},
|
|
51
82
|
},
|
|
52
|
-
};
|
|
83
|
+
});
|
|
53
84
|
```
|
|
54
85
|
|
|
55
86
|
Supported assertion types:
|
|
56
87
|
|
|
57
88
|
```txt
|
|
58
|
-
contains
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
89
|
+
response.contains
|
|
90
|
+
response.containsAll
|
|
91
|
+
response.containsAny
|
|
92
|
+
response.caseInsensitiveContains
|
|
93
|
+
response.notContains
|
|
94
|
+
response.regex
|
|
95
|
+
response.matchesRegex
|
|
96
|
+
response.notRegex
|
|
97
|
+
response.maxLength
|
|
98
|
+
tools.called
|
|
99
|
+
tools.calledOnce
|
|
100
|
+
tools.count
|
|
101
|
+
tools.order
|
|
102
|
+
tools.persisted
|
|
63
103
|
```
|
|
64
104
|
|
|
65
|
-
|
|
105
|
+
Older flat aliases still work, including `contains`, `not_contains`, `regex`, `matches_regex`, and `persisted_tool_call`.
|
|
106
|
+
|
|
107
|
+
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:
|
|
108
|
+
|
|
109
|
+
```ts
|
|
110
|
+
export default defineEval({
|
|
111
|
+
name: "appointment relative date",
|
|
112
|
+
now: "2026-02-04T02:30:00.000Z",
|
|
113
|
+
input: "What is today's date?",
|
|
114
|
+
expect: {
|
|
115
|
+
response: {
|
|
116
|
+
containsAll: ["2026-02-03", "Tuesday"],
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
|
+
});
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Multi-turn conversation evals use `turns`:
|
|
123
|
+
|
|
124
|
+
```ts
|
|
125
|
+
import { defineEval } from "@andreprado/agentkit";
|
|
126
|
+
|
|
127
|
+
export default defineEval({
|
|
128
|
+
name: "buyer under budget",
|
|
129
|
+
turns: [
|
|
130
|
+
{
|
|
131
|
+
input: "I want a house up to 600k near Pinheiros.",
|
|
132
|
+
expect: {
|
|
133
|
+
tools: {
|
|
134
|
+
calledOnce: "buscar_imoveis",
|
|
135
|
+
persisted: {
|
|
136
|
+
name: "buscar_imoveis",
|
|
137
|
+
status: "completed",
|
|
138
|
+
input: { maxPrice: 600000 },
|
|
139
|
+
},
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
input: "Show me the best two.",
|
|
145
|
+
expect: {
|
|
146
|
+
response: {
|
|
147
|
+
containsAll: ["Pinheiros", "R$"],
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
},
|
|
151
|
+
],
|
|
152
|
+
});
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
`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`.
|
|
156
|
+
|
|
157
|
+
Use `tools.count` for the exact number of persisted calls in that turn, `tools.calledOnce` for exactly one call by name, and `tools.order` for required relative order. `tools.order` allows extra calls before, between, or after the named calls; pair it with `tools.count` when the exact call set matters.
|
|
66
158
|
|
|
67
159
|
Use response assertions and persisted tool assertions together when internal operational output must not leak:
|
|
68
160
|
|
|
69
161
|
```ts
|
|
70
|
-
|
|
162
|
+
import { defineEval } from "@andreprado/agentkit";
|
|
163
|
+
|
|
164
|
+
export default defineEval({
|
|
71
165
|
name: "triage lead",
|
|
72
166
|
input: '{"tool":"triage_real_estate_lead","input":{"email":"ada@example.com"}}',
|
|
73
167
|
expect: {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
168
|
+
response: {
|
|
169
|
+
notContains: ["hot", "score"],
|
|
170
|
+
notRegex: ["API_KEY|secret|token"],
|
|
171
|
+
},
|
|
172
|
+
tools: {
|
|
173
|
+
calledOnce: "triage_real_estate_lead",
|
|
174
|
+
persisted: {
|
|
175
|
+
name: "triage_real_estate_lead",
|
|
176
|
+
status: "completed",
|
|
177
|
+
visibility: "internal",
|
|
178
|
+
output: { status: "hot" },
|
|
179
|
+
},
|
|
80
180
|
},
|
|
81
181
|
},
|
|
82
|
-
};
|
|
182
|
+
});
|
|
83
183
|
```
|
|
84
184
|
|
|
85
|
-
`tool_call`
|
|
185
|
+
`tool_call` and `persisted_tool_call` remain accepted as backwards-compatible aliases, but new evals should use `tools.persisted`.
|
|
186
|
+
|
|
187
|
+
Safe external-tool pattern:
|
|
188
|
+
|
|
189
|
+
```ts
|
|
190
|
+
export const sendFollowupEmail = defineTool({
|
|
191
|
+
name: "send_followup_email",
|
|
192
|
+
description: "Sends a follow-up email.",
|
|
193
|
+
inputSchema: {
|
|
194
|
+
type: "object",
|
|
195
|
+
properties: {
|
|
196
|
+
email: { type: "string" },
|
|
197
|
+
},
|
|
198
|
+
required: ["email"],
|
|
199
|
+
additionalProperties: false,
|
|
200
|
+
},
|
|
201
|
+
async execute(input: { email: string }, ctx) {
|
|
202
|
+
if (ctx.runtime.environment === "eval") {
|
|
203
|
+
return { sent: false, evalFixture: true, email: input.email };
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
// Real provider call here.
|
|
207
|
+
return { sent: true, evalFixture: false, email: input.email };
|
|
208
|
+
},
|
|
209
|
+
});
|
|
210
|
+
```
|
|
86
211
|
|
|
87
212
|
## Safety Rules
|
|
88
213
|
|
|
89
214
|
- Do not put provider keys in eval files.
|
|
90
215
|
- Do not put real client PII in eval files.
|
|
91
216
|
- Prefer small deterministic assertions.
|
|
92
|
-
-
|
|
217
|
+
- Keep eval tool calls deterministic and non-destructive.
|
|
218
|
+
- For tools that would write, delete, charge money, send email, or call a real customer system, branch inside the registered tool on `ctx.runtime.environment === "eval"` and return safe fixture output.
|
|
93
219
|
- Treat conversations as source material, not as automatically safe training data.
|
|
220
|
+
- Review generated regression evals from `agentkit improve evals` before committing them. AgentKit redacts common email, phone, bearer token, and key patterns in generated eval text, but you must still remove or generalize domain-specific client PII and replace brittle exact prose assertions with the important behavior when needed.
|
|
94
221
|
|
|
95
222
|
## Verification
|
|
96
223
|
|
|
@@ -111,7 +238,7 @@ Use `test/fake` for deterministic smoke tests, then add provider-specific evals
|
|
|
111
238
|
|
|
112
239
|
Tool eval hits a real API:
|
|
113
240
|
|
|
114
|
-
|
|
241
|
+
Make the registered tool return deterministic fixture output when `ctx.runtime.environment === "eval"`, then rerun the eval suite. AgentKit does not expose a separate eval-only mock registry yet.
|
|
115
242
|
|
|
116
243
|
## Backend Contracts Used
|
|
117
244
|
|
|
@@ -29,7 +29,7 @@ Hosted alpha secret commands:
|
|
|
29
29
|
|
|
30
30
|
```sh
|
|
31
31
|
agentkit login --token agk_user_...
|
|
32
|
-
agentkit secret set OPENAI_API_KEY
|
|
32
|
+
agentkit secret set OPENAI_API_KEY --from-local-env
|
|
33
33
|
agentkit secret list
|
|
34
34
|
agentkit secret unset OPENAI_API_KEY
|
|
35
35
|
```
|
|
@@ -93,15 +93,16 @@ defineTool({
|
|
|
93
93
|
- `.env.schema` is the committed contract for local secret names.
|
|
94
94
|
- AgentKit local commands load `.env` directly so inspect, chat, tools, and evals share the same secret loader.
|
|
95
95
|
- Production uses managed secrets.
|
|
96
|
-
- Hosted
|
|
96
|
+
- Hosted deploys require `cloudflare_deploy_alpha` or purchased/manual deploy slots; local commands do not require login.
|
|
97
97
|
- Secret values must not appear in config, docs, prompts, evals, logs, exports, or SQLite.
|
|
98
98
|
- A tool receives only secrets listed in that tool.
|
|
99
99
|
- Avoid direct `process.env` reads inside tools.
|
|
100
100
|
- Use `permissions` to describe external capabilities.
|
|
101
101
|
- Add timeouts to network tools.
|
|
102
|
-
- Treat
|
|
103
|
-
- Use access tokens and
|
|
102
|
+
- Treat hosted deploy URLs as addresses, not access control.
|
|
103
|
+
- Use deploy access tokens for hosted chat, hosted conversation reads, hosted trace reads, and any client app that talks to AgentKit Cloud.
|
|
104
104
|
- Remove client PII before writing evals.
|
|
105
|
+
- Review `.agentkit/feedback/` drafts before sending AgentKit product feedback. Do not paste `.env` values, provider keys, cookies, client PII, or full private transcripts into feedback messages.
|
|
105
106
|
|
|
106
107
|
## Verification
|
|
107
108
|
|
|
@@ -132,9 +133,9 @@ Add the secret name to the tool `secrets` field and set it locally:
|
|
|
132
133
|
npm run agentkit -- inspect
|
|
133
134
|
```
|
|
134
135
|
|
|
135
|
-
|
|
136
|
+
Hosted URL is reachable without a token:
|
|
136
137
|
|
|
137
|
-
|
|
138
|
+
Treat this as a security bug. Hosted AgentKit Cloud routes should reject missing deploy tokens except authenticated channel webhook ingress.
|
|
138
139
|
|
|
139
140
|
## Backend Contracts Used
|
|
140
141
|
|
|
@@ -0,0 +1,135 @@
|
|
|
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.
|
|
@@ -6,7 +6,9 @@ Switch a capsule from the offline `test/fake` provider to a Pi-backed provider.
|
|
|
6
6
|
|
|
7
7
|
## When To Use This
|
|
8
8
|
|
|
9
|
-
Use this when local fake responses are no longer enough and the agent needs model behavior from OpenAI, Anthropic, or
|
|
9
|
+
Use this when local fake responses are no longer enough and the agent needs model behavior from OpenRouter, OpenAI, Anthropic, or another supported provider.
|
|
10
|
+
|
|
11
|
+
The coding agent should not choose a real provider automatically. Ask the owner which provider to use, then update the capsule.
|
|
10
12
|
|
|
11
13
|
## Commands
|
|
12
14
|
|
|
@@ -19,6 +21,14 @@ npm run chat -- --message "hello"
|
|
|
19
21
|
npm run agentkit -- inspect
|
|
20
22
|
```
|
|
21
23
|
|
|
24
|
+
On Windows PowerShell, if `npm.ps1` is blocked by `PSSecurityException`, use the Windows command shim:
|
|
25
|
+
|
|
26
|
+
```sh
|
|
27
|
+
npm.cmd run typecheck
|
|
28
|
+
npm.cmd run chat -- --message "hello"
|
|
29
|
+
npm.cmd run agentkit -- inspect
|
|
30
|
+
```
|
|
31
|
+
|
|
22
32
|
## Files Created Or Edited
|
|
23
33
|
|
|
24
34
|
Edit:
|
|
@@ -75,6 +85,19 @@ provider: {
|
|
|
75
85
|
secrets: ["OPENROUTER_API_KEY"],
|
|
76
86
|
```
|
|
77
87
|
|
|
88
|
+
Prefer model ids or aliases listed by the installed Pi SDK when available, such as `~google/gemini-flash-latest`. If an OpenRouter model id is newer than the Pi model registry, AgentKit passes the id through to OpenRouter using Pi's OpenAI-compatible transport with conservative unknown-model metadata. The provider may still reject the request if the id is invalid, inaccessible, or does not support the tools/features the agent uses.
|
|
89
|
+
|
|
90
|
+
## UI Verification
|
|
91
|
+
|
|
92
|
+
After the provider is configured and the local secret is set, test through chat and UI:
|
|
93
|
+
|
|
94
|
+
```sh
|
|
95
|
+
npm run chat -- --message "hello"
|
|
96
|
+
npm run dev
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Open the printed `Chat:` URL and tell the owner the exact URL. If the provider is still `test/fake`, say the UI was tested only with the deterministic fake provider.
|
|
100
|
+
|
|
78
101
|
## Safety Rules
|
|
79
102
|
|
|
80
103
|
- Keep `.env` local.
|
|
@@ -84,6 +107,7 @@ secrets: ["OPENROUTER_API_KEY"],
|
|
|
84
107
|
- Do not import provider SDKs in the Agent Capsule.
|
|
85
108
|
- AgentKit uses Pi SDK internally.
|
|
86
109
|
- Run `agentkit inspect` to confirm secret status without printing values.
|
|
110
|
+
- Do not claim real conversation behavior was tested until a real provider selected by the owner is configured.
|
|
87
111
|
|
|
88
112
|
## Verification
|
|
89
113
|
|
|
@@ -111,7 +135,7 @@ npm run agentkit -- inspect
|
|
|
111
135
|
|
|
112
136
|
`provider_model_unsupported`:
|
|
113
137
|
|
|
114
|
-
|
|
138
|
+
For OpenAI or Anthropic, use a model id known to the installed Pi SDK for that provider. For OpenRouter, prefer a known Pi alias when possible; otherwise a raw OpenRouter model id is passed through and any remaining model error comes from OpenRouter.
|
|
115
139
|
|
|
116
140
|
Provider returns auth failure:
|
|
117
141
|
|
|
@@ -123,4 +147,4 @@ Check the key value, provider account status, and model access.
|
|
|
123
147
|
|
|
124
148
|
## Backend Contracts Used
|
|
125
149
|
|
|
126
|
-
Local provider keys come from ignored `.env`, loaded directly by AgentKit. Hosted production
|
|
150
|
+
Local provider keys come from ignored `.env`, loaded directly by AgentKit. Hosted production uses `agentkit secret set <NAME> --from-local-env`, `--from-env`, or `--stdin` and the secret API. Secret values have no readback in hosted responses.
|