@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,96 +1,17 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: agentkit-improve
|
|
3
|
-
description:
|
|
3
|
+
description: Improve a capsule using local conversation traces, regression evals, and isolated replay.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
|
-
#
|
|
6
|
+
# Improve Locally
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
## Boundary
|
|
11
|
-
|
|
12
|
-
AgentKit Cloud exports evidence. The local coding agent edits the capsule, writes evals, runs replay, and deploys. Do not expect hosted AgentKit Cloud to change source files.
|
|
13
|
-
|
|
14
|
-
## Workflow
|
|
15
|
-
|
|
16
|
-
1. Collect evidence:
|
|
17
|
-
|
|
18
|
-
```sh
|
|
19
|
-
npm run agentkit -- improve collect --deploy --since 24h
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
Hosted conversation reads require a deploy access token even when a deploy manifest says `access.mode: "public"`. If collection fails with auth, refresh the local token:
|
|
23
|
-
|
|
24
|
-
```sh
|
|
25
|
-
npm run agentkit -- access token create agentkit-chat-ui --out .agentkit/chat-access-token.json
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
For one known conversation:
|
|
29
|
-
|
|
30
|
-
```sh
|
|
31
|
-
npm run agentkit -- improve collect --deploy --conversation-id <conversation-id>
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
2. Read the generated report:
|
|
35
|
-
|
|
36
|
-
```txt
|
|
37
|
-
.agentkit/improve/<run>/report.json
|
|
38
|
-
.agentkit/improve/<run>/traces/
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
3. Before patching, identify the smallest testable lesson from each relevant trace:
|
|
42
|
-
|
|
43
|
-
- Did the agent miss a required field?
|
|
44
|
-
- Did it expose raw tool output, a full schedule, an internal id, or a technical error?
|
|
45
|
-
- Did it write externally without confirmation?
|
|
46
|
-
- Did it use the wrong timezone, duration, business hour, or availability assumption?
|
|
47
|
-
- Did a tool error or provider limit produce a bad client response?
|
|
48
|
-
|
|
49
|
-
4. Generate regression evals:
|
|
8
|
+
Read `docs/guides/improve-local.md` and `docs/guides/replay-local-traces.md` from the installed docs root.
|
|
50
9
|
|
|
51
10
|
```sh
|
|
11
|
+
npm run agentkit -- improve collect --since 24h
|
|
52
12
|
npm run agentkit -- improve evals .agentkit/improve/<run>
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
5. Review or rewrite generated evals so they assert the behavior, not brittle transcript wording. If the bug involved a tool call, assert the persisted tool call input or absence of the unsafe call.
|
|
56
|
-
|
|
57
|
-
6. Patch the capsule. Likely files:
|
|
58
|
-
|
|
59
|
-
```txt
|
|
60
|
-
prompts/instructions.md
|
|
61
|
-
agentkit.config.ts
|
|
62
|
-
tools/
|
|
63
|
-
knowledge/
|
|
64
|
-
evals/
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
7. Verify:
|
|
68
|
-
|
|
69
|
-
```sh
|
|
70
|
-
npm run typecheck
|
|
71
|
-
npm run agentkit -- inspect
|
|
72
|
-
npm run eval
|
|
73
13
|
npm run agentkit -- replay .agentkit/improve/<run> --against local
|
|
14
|
+
npm run eval
|
|
74
15
|
```
|
|
75
16
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
```sh
|
|
79
|
-
npm run agentkit -- deploy --smoke "hello"
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
## Rules
|
|
83
|
-
|
|
84
|
-
- Keep `.agentkit/improve/` out of commits.
|
|
85
|
-
- Review generated evals before committing them.
|
|
86
|
-
- 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.
|
|
87
|
-
- If a tool writes externally, deletes, charges money, sends email, or touches real customer systems, make the tool branch on `ctx.runtime.environment === "eval"`.
|
|
88
|
-
- Do not paste secret values into reports, prompts, evals, or Knowledge files.
|
|
89
|
-
- Do not try to read the hosted database directly. Use authenticated AgentKit CLI/API routes only.
|
|
90
|
-
- If replay uses a real provider instead of `test/fake`, say that in the final response.
|
|
91
|
-
|
|
92
|
-
## References
|
|
93
|
-
|
|
94
|
-
- `references/trace-packets.md`
|
|
95
|
-
- `references/replay-side-effects.md`
|
|
96
|
-
- `templates/regression.eval.md`
|
|
17
|
+
Use the failing trace to make a focused change to prompts, tools, schema, or config. Keep regression checks and fixture external writes in eval mode. Review bundles for secrets and customer data before sharing; files remain local.
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
|
|
12
12
|
Use `report.json` for a quick index and `traces/<trace_id>.json` for the full conversation trace.
|
|
13
13
|
|
|
14
|
-
The bundle can contain
|
|
14
|
+
The bundle can contain local traces. Treat both as sensitive source material. Do not commit `.agentkit/improve/`.
|
|
15
15
|
|
|
16
16
|
Generated evals belong in:
|
|
17
17
|
|
|
@@ -13,7 +13,6 @@ Do not choose a real provider automatically. Ask the owner which provider to use
|
|
|
13
13
|
|
|
14
14
|
## ChatGPT / Codex
|
|
15
15
|
|
|
16
|
-
When the owner chooses their Codex subscription, follow `docs/guides/use-provider.md` (resolve it from `agentkit docs path`). Run `agentkit provider login openai-codex` in an interactive terminal and configure `provider: { name: "openai-codex", model: "gpt-5.4" }`. Use `agentkit provider status openai-codex` to check local login status. No provider API key is needed; preserve unrelated tool/service secrets. This creates an AgentKit OAuth session outside the capsule, without reading the Codex app's cache. Chat, dev, and eval renew the session through Pi. This login is local-only: choose an API-key provider with managed secrets for deploys.
|
|
17
16
|
|
|
18
17
|
## Workflow (API-Key Providers)
|
|
19
18
|
|
|
@@ -35,7 +34,7 @@ secrets: ["OPENAI_API_KEY"],
|
|
|
35
34
|
Anthropic:
|
|
36
35
|
|
|
37
36
|
```ts
|
|
38
|
-
provider: { name: "anthropic", model: "claude-
|
|
37
|
+
provider: { name: "anthropic", model: "claude-haiku-4-5" },
|
|
39
38
|
secrets: ["ANTHROPIC_API_KEY"],
|
|
40
39
|
```
|
|
41
40
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: agentkit-security
|
|
3
|
-
description: Use before or during AgentKit work involving secrets, external APIs, tools, evals from real data, public access,
|
|
3
|
+
description: Use before or during AgentKit work involving secrets, external APIs, tools, evals from real data, public access, or messaging channels.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# AgentKit Security
|
|
@@ -34,7 +34,6 @@ skills/
|
|
|
34
34
|
|
|
35
35
|
- `.env.schema` stores secret names only.
|
|
36
36
|
- Ignored `.env` stores local development values only.
|
|
37
|
-
- Hosted production uses managed secrets.
|
|
38
37
|
- Tools receive only secrets listed in that tool's `secrets` field.
|
|
39
38
|
- Prefer `ctx.secrets` over direct `process.env` reads in tools.
|
|
40
39
|
- Add `permissions` for external capabilities.
|
|
@@ -44,7 +43,6 @@ skills/
|
|
|
44
43
|
- Remove client PII before writing evals.
|
|
45
44
|
- Keep `.agentkit/improve/` bundles out of commits and review generated regression evals before committing.
|
|
46
45
|
- Guard replay/eval mode inside external write tools with `ctx.runtime.environment === "eval"`.
|
|
47
|
-
- Treat hosted deploy URLs as addresses, not access control. Hosted chat, conversation reads, and trace reads require a deploy access token even if a config says `access.mode: "public"`.
|
|
48
46
|
|
|
49
47
|
## Checks
|
|
50
48
|
|
|
@@ -17,7 +17,7 @@ When the owner asks to use TypeSafe/Jev for a capsule capability, follow `docs/g
|
|
|
17
17
|
- End read-only permissions with `:read`.
|
|
18
18
|
- Non-read permissions are operator-only: chat, channels, and evals cannot execute them automatically.
|
|
19
19
|
4. Register the tool in `agentkit.config.ts`.
|
|
20
|
-
5. Keep secret names in `.env.schema`; values stay in ignored `.env
|
|
20
|
+
5. Keep secret names in `.env.schema`; values stay in ignored `.env`.
|
|
21
21
|
6. Use `ctx.clock` for date-sensitive tool logic instead of calling `new Date()` directly.
|
|
22
22
|
7. Verify destructive or external side effects through a reviewed direct `agentkit tool` invocation; evals should assert that automatic execution is blocked.
|
|
23
23
|
8. Add deterministic fixtures, fake branches, or direct tool inputs for important success and failure paths.
|
|
@@ -7,7 +7,7 @@ import { defineTool } from "@andreprado/agentkit";
|
|
|
7
7
|
|
|
8
8
|
export const saveNote = defineTool({
|
|
9
9
|
name: "save_note",
|
|
10
|
-
description: "Saves a note in the AgentKit-
|
|
10
|
+
description: "Saves a note in the AgentKit-local database.",
|
|
11
11
|
inputSchema: {
|
|
12
12
|
type: "object",
|
|
13
13
|
properties: {
|
|
@@ -32,4 +32,3 @@ export const saveNote = defineTool({
|
|
|
32
32
|
},
|
|
33
33
|
});
|
|
34
34
|
```
|
|
35
|
-
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: agentkit-troubleshooting
|
|
3
|
-
description: Use when an AgentKit command, local chat, tool, eval, Knowledge sync, channel,
|
|
3
|
+
description: Use when an AgentKit command, local chat, tool, eval, Knowledge sync, channel, fails and the coding agent needs to diagnose from CLI output and route to the right narrow skill or docs guide.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# AgentKit Troubleshooting
|
|
@@ -11,7 +11,7 @@ Use this when something fails.
|
|
|
11
11
|
|
|
12
12
|
1. Read the exact error code and message.
|
|
13
13
|
2. Run the narrow inspect command before guessing.
|
|
14
|
-
3. Route to a task skill when the failure points to config, tools, database, provider, evals,
|
|
14
|
+
3. Route to a task skill when the failure points to config, tools, database, provider, evals, Knowledge, or channels.
|
|
15
15
|
4. Load `llms-full.txt` only when the narrow skill and guide do not explain the behavior.
|
|
16
16
|
5. If the failure appears to be an AgentKit bug, missing docs, or unclear recovery path, create a local feedback draft after diagnosis.
|
|
17
17
|
|
|
@@ -37,11 +37,6 @@ For tool issues:
|
|
|
37
37
|
npm run agentkit -- tool <tool_name> --input '<json>'
|
|
38
38
|
```
|
|
39
39
|
|
|
40
|
-
For deploy issues:
|
|
41
|
-
|
|
42
|
-
```sh
|
|
43
|
-
npm run agentkit -- deploy doctor
|
|
44
|
-
```
|
|
45
40
|
|
|
46
41
|
For AgentKit product feedback:
|
|
47
42
|
|
|
@@ -52,7 +47,7 @@ npm run agentkit -- feedback create --about last-run --kind bug --summary "short
|
|
|
52
47
|
For production behavior issues:
|
|
53
48
|
|
|
54
49
|
```sh
|
|
55
|
-
npm run agentkit -- improve collect --
|
|
50
|
+
npm run agentkit -- improve collect --since 24h
|
|
56
51
|
npm run agentkit -- improve evals .agentkit/improve/<run>
|
|
57
52
|
npm run agentkit -- replay .agentkit/improve/<run> --against local
|
|
58
53
|
```
|
|
@@ -64,13 +59,12 @@ npm run agentkit -- replay .agentkit/improve/<run> --against local
|
|
|
64
59
|
- provider not chosen: stay on `test/fake` or ask the owner;
|
|
65
60
|
- schema missing: run `db migrate` and check `schema.sql`;
|
|
66
61
|
- tool validation failed: check `inputSchema` and `outputSchema`;
|
|
67
|
-
- channel secret missing: set
|
|
62
|
+
- channel secret missing: set local secret, not source files;
|
|
68
63
|
- production behavior drift: collect an improve bundle and convert it to regression evals before patching;
|
|
69
64
|
- local AgentKit skills are stale: run `npm run agentkit -- skills sync`.
|
|
70
65
|
|
|
71
66
|
## Feedback Rules
|
|
72
67
|
|
|
73
68
|
- `feedback create` writes a local draft only; it does not send anything.
|
|
74
|
-
- Review the draft before
|
|
75
|
-
- Sending requires `agentkit login --token agk_user_...`.
|
|
69
|
+
- Review the draft before sharing it manually.
|
|
76
70
|
- Do not paste `.env` values, provider keys, cookies, client PII, or full private transcripts into feedback.
|
package/src/templates/support.ts
CHANGED
|
@@ -1,63 +1,11 @@
|
|
|
1
1
|
import type { AgentTemplate } from ".";
|
|
2
|
+
import { commonTemplateFiles } from "./common";
|
|
2
3
|
|
|
3
4
|
export const supportTemplate: AgentTemplate = {
|
|
4
5
|
name: "support",
|
|
5
6
|
files(projectName: string, context = {}) {
|
|
6
7
|
return [
|
|
7
|
-
|
|
8
|
-
path: "package.json",
|
|
9
|
-
contents: `${JSON.stringify(
|
|
10
|
-
{
|
|
11
|
-
name: projectName,
|
|
12
|
-
private: true,
|
|
13
|
-
type: "module",
|
|
14
|
-
scripts: {
|
|
15
|
-
agentkit: "agentkit",
|
|
16
|
-
dev: "agentkit dev",
|
|
17
|
-
chat: "agentkit chat",
|
|
18
|
-
eval: "agentkit eval run",
|
|
19
|
-
typecheck: "tsc --noEmit",
|
|
20
|
-
},
|
|
21
|
-
dependencies: {
|
|
22
|
-
"@andreprado/agentkit": context.agentkitDependency ?? "workspace:*",
|
|
23
|
-
},
|
|
24
|
-
devDependencies: {
|
|
25
|
-
"@types/node": "^24.12.4",
|
|
26
|
-
typescript: "^5.9.3",
|
|
27
|
-
},
|
|
28
|
-
},
|
|
29
|
-
null,
|
|
30
|
-
2,
|
|
31
|
-
)}
|
|
32
|
-
`,
|
|
33
|
-
},
|
|
34
|
-
{
|
|
35
|
-
path: "tsconfig.json",
|
|
36
|
-
contents: `${JSON.stringify(
|
|
37
|
-
{
|
|
38
|
-
compilerOptions: {
|
|
39
|
-
target: "ES2022",
|
|
40
|
-
module: "ESNext",
|
|
41
|
-
moduleResolution: "Bundler",
|
|
42
|
-
strict: true,
|
|
43
|
-
skipLibCheck: true,
|
|
44
|
-
noEmit: true,
|
|
45
|
-
types: ["node"],
|
|
46
|
-
},
|
|
47
|
-
include: ["**/*.ts"],
|
|
48
|
-
},
|
|
49
|
-
null,
|
|
50
|
-
2,
|
|
51
|
-
)}
|
|
52
|
-
`,
|
|
53
|
-
},
|
|
54
|
-
{
|
|
55
|
-
path: ".gitignore",
|
|
56
|
-
contents: `.env
|
|
57
|
-
.agentkit/
|
|
58
|
-
node_modules/
|
|
59
|
-
`,
|
|
60
|
-
},
|
|
8
|
+
...commonTemplateFiles(projectName, context),
|
|
61
9
|
{
|
|
62
10
|
path: ".env.schema",
|
|
63
11
|
contents: `# Optional: add real provider keys after switching away from test/fake.
|
|
@@ -74,7 +22,7 @@ import { lookupOrder } from "./tools/lookup-order";
|
|
|
74
22
|
|
|
75
23
|
export default defineAgent({
|
|
76
24
|
name: "${projectName}",
|
|
77
|
-
runtime: "
|
|
25
|
+
runtime: "local",
|
|
78
26
|
provider: {
|
|
79
27
|
name: "test",
|
|
80
28
|
model: "fake",
|
|
@@ -89,7 +37,7 @@ export default defineAgent({
|
|
|
89
37
|
driver: "agentkit",
|
|
90
38
|
path: ".agentkit/agentkit.db",
|
|
91
39
|
database: {
|
|
92
|
-
driver: "
|
|
40
|
+
driver: "sqlite",
|
|
93
41
|
schema: "./schema.sql",
|
|
94
42
|
},
|
|
95
43
|
},
|
|
@@ -220,7 +168,7 @@ Do not only edit prompts. For every meaningful requirement in the owner's reques
|
|
|
220
168
|
- schema/migration plus tool for durable records;
|
|
221
169
|
- eval for privacy, confirmation, required fields, date/time behavior, business rules, and regressions;
|
|
222
170
|
- fixture, seed data, fake branch, or direct tool check for integrations and failure paths;
|
|
223
|
-
-
|
|
171
|
+
- local config and secret checks for channels and external tools.
|
|
224
172
|
|
|
225
173
|
If a rule protects privacy, money, bookings, external writes, customer data, business hours, or safety, it must have an eval or deterministic check before you call the capsule done. If a real conversation exposes a bug, convert it into the smallest regression eval before or alongside the fix.
|
|
226
174
|
|
|
@@ -243,20 +191,9 @@ If a rule protects privacy, money, bookings, external writes, customer data, bus
|
|
|
243
191
|
## Testing With A UI
|
|
244
192
|
|
|
245
193
|
- Local UI: run \`npm run dev\`, open the printed \`Chat:\` URL, and tell the owner the exact URL.
|
|
246
|
-
- Hosted UI: after \`npm run agentkit -- deploy\`, run \`npm run agentkit -- chat-ui --deploy\`, open the printed \`Chat:\` URL, and tell the owner it is connected to the hosted deploy.
|
|
247
194
|
- \`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.
|
|
248
195
|
- Before claiming real conversation behavior is tested, ask the owner which provider to use: OpenRouter, OpenAI, Anthropic, OpenCode Zen, OpenCode Go, or another supported provider. Do not choose for them.
|
|
249
196
|
|
|
250
|
-
## Hosted Deploy
|
|
251
|
-
|
|
252
|
-
- Local scaffold, chat, eval, dev, inspect, tool, and build commands are token-free.
|
|
253
|
-
- Hosted deploy requires an invited AgentKit Cloud alpha token. If no token is stored yet, ask the owner for one and run \`npm run agentkit -- login --token <token>\`.
|
|
254
|
-
- Put production secret values into managed secrets with \`npm run agentkit -- secret set <NAME> --from-local-env\`, \`--from-env\`, or \`--stdin\`, not into committed files or shell history.
|
|
255
|
-
- Deploy with \`npm run agentkit -- deploy\`, then check \`npm run agentkit -- deploy status\`.
|
|
256
|
-
- Hosted deploy writes the local chat/UI deploy access token to \`.agentkit/chat-access-token.json\`. Create extra client-facing tokens with \`npm run agentkit -- access token create <name> --out <path>\` when a separate website or app needs its own credential.
|
|
257
|
-
- Use \`npm run agentkit -- deploy --smoke "hello"\` or \`npm run agentkit -- deploy smoke --message "hello"\` for an official hosted chat smoke check.
|
|
258
|
-
- Do not run operator/admin commands from a user capsule.
|
|
259
|
-
|
|
260
197
|
## Files
|
|
261
198
|
|
|
262
199
|
- \`agentkit.config.ts\`: agent contract and tool registry.
|
|
@@ -334,16 +271,9 @@ npm run dev
|
|
|
334
271
|
|
|
335
272
|
Open the printed \`Chat:\` URL and tell the owner the exact URL.
|
|
336
273
|
|
|
337
|
-
Hosted deploy UI:
|
|
338
|
-
|
|
339
|
-
\`\`\`sh
|
|
340
|
-
npm run agentkit -- deploy
|
|
341
|
-
npm run agentkit -- chat-ui --deploy
|
|
342
|
-
\`\`\`
|
|
343
274
|
|
|
344
|
-
Open the printed \`Chat:\` URL and tell the owner this local UI is connected to the hosted deploy.
|
|
345
275
|
|
|
346
|
-
Before claiming real conversation behavior has been tested, ask the owner which provider to use: OpenRouter, OpenAI, Anthropic, OpenCode Zen, OpenCode Go, or another supported provider. Do not choose for them. After they choose, update \`agentkit.config.ts\`, \`.env.schema\`, local secrets,
|
|
276
|
+
Before claiming real conversation behavior has been tested, ask the owner which provider to use: OpenRouter, OpenAI, Anthropic, OpenCode Zen, OpenCode Go, or another supported provider. Do not choose for them. After they choose, update \`agentkit.config.ts\`, \`.env.schema\`, local secrets, then rerun chat/UI checks.
|
|
347
277
|
|
|
348
278
|
If you add a tool, also run a fake-provider tool smoke test:
|
|
349
279
|
|
|
@@ -366,26 +296,12 @@ Tools that need agent-owned tables should use canonical \`ctx.db\` from the tool
|
|
|
366
296
|
The recommended dual-storage pattern is:
|
|
367
297
|
|
|
368
298
|
1. Add tables to \`schema.sql\`.
|
|
369
|
-
2. Keep \`storage.driver: "agentkit"\` for
|
|
299
|
+
2. Keep \`storage.driver: "agentkit"\` for local capsules.
|
|
370
300
|
3. Run \`npm run agentkit -- tool ...\` or \`npm run chat ...\` locally. AgentKit applies \`schema.sql\` to local development storage.
|
|
371
301
|
4. Use \`npm run agentkit -- db migrate\`, \`db reset --yes\`, \`db seed\`, and \`db shell\` for local database setup and inspection.
|
|
372
|
-
5. Run \`npm run agentkit -- deploy\`. AgentKit migrates/provisions hosted storage internally.
|
|
373
302
|
|
|
374
303
|
\`schema.sql\` is an idempotent bootstrap file. Use \`CREATE TABLE IF NOT EXISTS\`, \`CREATE INDEX IF NOT EXISTS\`, and safe additive changes. Use ordered \`migrations/*.sql\` for production-shaped schema evolution; \`npm run agentkit -- db migrate\` applies unapplied local migrations before \`schema.sql\`.
|
|
375
304
|
|
|
376
|
-
## Hosted Deploy
|
|
377
|
-
|
|
378
|
-
This capsule is deploy-ready by default.
|
|
379
|
-
|
|
380
|
-
1. Keep tools edge-safe and use \`ctx.db\` instead of importing database drivers.
|
|
381
|
-
2. Run \`npm run agentkit -- build\` only when you want to validate the artifact locally.
|
|
382
|
-
3. If the owner has not logged in yet, ask for an invited AgentKit Cloud alpha token and run \`npm run agentkit -- login --token <token>\`.
|
|
383
|
-
4. Put production secrets into managed secrets with \`npm run agentkit -- secret set <NAME> --from-local-env\`, \`--from-env\`, or \`--stdin\`.
|
|
384
|
-
5. Run \`npm run agentkit -- deploy\`.
|
|
385
|
-
6. Run \`npm run agentkit -- chat-ui --deploy\` to test the hosted agent through a local UI using the auto-created \`.agentkit/chat-access-token.json\`. Create extra client-facing deploy access tokens with \`npm run agentkit -- access token create <name> --out <path>\` when a separate website or app needs its own credential.
|
|
386
|
-
7. Use \`npm run agentkit -- deploy --smoke "hello"\` during deploy or \`npm run agentkit -- deploy smoke --message "hello"\` afterward for an official hosted smoke check.
|
|
387
|
-
|
|
388
|
-
AgentKit owns hosted infrastructure and production secrets. Do not put production secret values in this capsule. Do not run operator/admin commands from a user capsule.
|
|
389
305
|
`,
|
|
390
306
|
},
|
|
391
307
|
{
|
|
@@ -423,7 +339,7 @@ npm run dev
|
|
|
423
339
|
The support template includes a local \`lookup_order\` TypeScript tool and uses \`test/fake\` by default.
|
|
424
340
|
\`test/fake\` does not validate real conversation quality. The owner must choose OpenRouter, OpenAI, Anthropic, OpenCode Zen, OpenCode Go, or another supported provider before real model behavior is tested.
|
|
425
341
|
|
|
426
|
-
For UI testing, run \`npm run dev\` and open the printed \`Chat:\` URL.
|
|
342
|
+
For UI testing, run \`npm run dev\` and open the printed \`Chat:\` URL.
|
|
427
343
|
`,
|
|
428
344
|
},
|
|
429
345
|
];
|
|
@@ -1,165 +0,0 @@
|
|
|
1
|
-
# Add Managed Composio
|
|
2
|
-
|
|
3
|
-
## Goal
|
|
4
|
-
|
|
5
|
-
Enable AgentKit-managed Composio for one deployed agent so the agent can use explicitly allowed external app actions without the user owning Composio credentials.
|
|
6
|
-
|
|
7
|
-
Use BYO `defineTool` wrappers instead when the user wants to use their own Composio account/API key for free.
|
|
8
|
-
|
|
9
|
-
## Contract
|
|
10
|
-
|
|
11
|
-
Managed Composio is paid hosted AgentKit infrastructure:
|
|
12
|
-
|
|
13
|
-
- It works per agent/project, not per client.
|
|
14
|
-
- It requires an AgentKit Cloud account with `managed_composio`.
|
|
15
|
-
- AgentKit Cloud injects `COMPOSIO_API_KEY`; do not put it in `.env`, `.env.schema`, or `agentkit.config.ts`.
|
|
16
|
-
- AgentKit Cloud resolves toolkit auth configs from its managed registry. The capsule owner only declares allowed toolkits/actions.
|
|
17
|
-
- AgentKit Cloud assigns the deployed Composio `user_id` from the account, project, agent, and integration name. The local inspect/build id is only a preview.
|
|
18
|
-
- The agent gets one generated tool, `agentkit_composio_execute`, only when explicit Composio action slugs are configured.
|
|
19
|
-
- Anonymous deploys cannot use managed Composio.
|
|
20
|
-
|
|
21
|
-
## Minimal Config
|
|
22
|
-
|
|
23
|
-
Edit `agentkit.config.ts`:
|
|
24
|
-
|
|
25
|
-
```ts
|
|
26
|
-
import { composioManaged, defineAgent } from "@andreprado/agentkit";
|
|
27
|
-
|
|
28
|
-
export default defineAgent({
|
|
29
|
-
name: "acme-receptionist",
|
|
30
|
-
runtime: "edge",
|
|
31
|
-
provider: {
|
|
32
|
-
name: "test",
|
|
33
|
-
model: "fake",
|
|
34
|
-
},
|
|
35
|
-
instructions: "./prompts/instructions.md",
|
|
36
|
-
secrets: [],
|
|
37
|
-
tools: [],
|
|
38
|
-
integrations: [
|
|
39
|
-
composioManaged({
|
|
40
|
-
toolkits: ["gmail", "googlecalendar"],
|
|
41
|
-
tools: {
|
|
42
|
-
gmail: ["GMAIL_FETCH_EMAILS", "GMAIL_SEND_EMAIL"],
|
|
43
|
-
googlecalendar: [
|
|
44
|
-
"GOOGLECALENDAR_EVENTS_LIST",
|
|
45
|
-
"GOOGLECALENDAR_CREATE_EVENT",
|
|
46
|
-
"GOOGLECALENDAR_UPDATE_EVENT",
|
|
47
|
-
],
|
|
48
|
-
},
|
|
49
|
-
confirmExternalWrites: true,
|
|
50
|
-
}),
|
|
51
|
-
],
|
|
52
|
-
access: {
|
|
53
|
-
mode: "private",
|
|
54
|
-
},
|
|
55
|
-
storage: {
|
|
56
|
-
driver: "agentkit",
|
|
57
|
-
database: {
|
|
58
|
-
driver: "turso",
|
|
59
|
-
},
|
|
60
|
-
},
|
|
61
|
-
});
|
|
62
|
-
```
|
|
63
|
-
|
|
64
|
-
## Deploy
|
|
65
|
-
|
|
66
|
-
```sh
|
|
67
|
-
agentkit login --token agk_user_...
|
|
68
|
-
agentkit deploy doctor
|
|
69
|
-
agentkit deploy
|
|
70
|
-
agentkit integrations status --toolkit googlecalendar
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
Expected readiness:
|
|
74
|
-
|
|
75
|
-
- Hosted deploy access is active through `cloudflare_deploy_alpha` or purchased/manual deploy slots.
|
|
76
|
-
- `managed_composio` is active.
|
|
77
|
-
- `COMPOSIO_API_KEY` appears as an AgentKit-managed secret, not a user-managed hosted secret.
|
|
78
|
-
- Each configured toolkit auth config is available in AgentKit Cloud.
|
|
79
|
-
|
|
80
|
-
## Connect Apps
|
|
81
|
-
|
|
82
|
-
The Composio connect link is deploy-scoped, so declare `composioManaged(...)` first, deploy, then connect. After deploy, create a hosted Composio Connect Link:
|
|
83
|
-
|
|
84
|
-
```sh
|
|
85
|
-
agentkit integrations connect composio --toolkit gmail
|
|
86
|
-
agentkit integrations connect composio --toolkit googlecalendar
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
AgentKit prints a URL. Send that URL to the person who owns the app account.
|
|
90
|
-
|
|
91
|
-
If the deploy has only one toolkit, `--toolkit` can be omitted.
|
|
92
|
-
|
|
93
|
-
`agentkit deploy` prints the recommended `integrations connect composio --toolkit <slug>` command for each configured toolkit in its production handoff.
|
|
94
|
-
|
|
95
|
-
## Calendar Defaults
|
|
96
|
-
|
|
97
|
-
For Google Calendar agents, include read and write actions together. Do not expose only `GOOGLECALENDAR_CREATE_EVENT`; users naturally ask to see availability before booking.
|
|
98
|
-
|
|
99
|
-
Use these starter actions:
|
|
100
|
-
|
|
101
|
-
```ts
|
|
102
|
-
googlecalendar: [
|
|
103
|
-
"GOOGLECALENDAR_EVENTS_LIST",
|
|
104
|
-
"GOOGLECALENDAR_CREATE_EVENT",
|
|
105
|
-
"GOOGLECALENDAR_UPDATE_EVENT",
|
|
106
|
-
]
|
|
107
|
-
```
|
|
108
|
-
|
|
109
|
-
`GOOGLECALENDAR_CREATE_EVENT` requires extra care:
|
|
110
|
-
|
|
111
|
-
- `start_datetime` must be explicit UTC RFC3339, such as `2026-06-03T15:00:00Z` for 12:00 in `America/Sao_Paulo`.
|
|
112
|
-
- `event_duration_minutes` or `event_duration_hour` must be explicit. AgentKit blocks the implicit Composio default because `event_duration_minutes` defaults to 30.
|
|
113
|
-
- Confirm the final title, date, local time, duration, timezone, and attendees/location when relevant before creating or updating an event.
|
|
114
|
-
|
|
115
|
-
## Write Confirmation
|
|
116
|
-
|
|
117
|
-
Managed Composio requires operator invocation for external write actions. If an integration allows create, update, delete, send, patch, move, insert, clear, remove, import, or quick-add actions, AgentKit blocks that generated tool during model-driven chat, channel, and eval runs. Review the exact action and invoke `agentkit_composio_execute` directly with `agentkit tool`; write actions also require `confirmed: true` by default.
|
|
118
|
-
|
|
119
|
-
`confirmExternalWrites: false` disables only Composio's secondary `confirmed` input check. It does not bypass AgentKit's operator-only permission boundary:
|
|
120
|
-
|
|
121
|
-
```ts
|
|
122
|
-
composioManaged({
|
|
123
|
-
toolkits: ["googlecalendar"],
|
|
124
|
-
tools: {
|
|
125
|
-
googlecalendar: ["GOOGLECALENDAR_EVENTS_LIST", "GOOGLECALENDAR_CREATE_EVENT"],
|
|
126
|
-
},
|
|
127
|
-
confirmExternalWrites: false,
|
|
128
|
-
})
|
|
129
|
-
```
|
|
130
|
-
|
|
131
|
-
## Verification
|
|
132
|
-
|
|
133
|
-
```sh
|
|
134
|
-
agentkit inspect
|
|
135
|
-
agentkit build --target cloudflare
|
|
136
|
-
agentkit deploy doctor
|
|
137
|
-
agentkit integrations status --toolkit googlecalendar
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
Expected:
|
|
141
|
-
|
|
142
|
-
- `inspect.integrations[0].provider` is `composio`.
|
|
143
|
-
- `inspect.tools` includes `agentkit_composio_execute` when allowed actions are configured.
|
|
144
|
-
- Build manifest includes `integrations`.
|
|
145
|
-
- Build manifest includes `COMPOSIO_API_KEY`.
|
|
146
|
-
- `deploy doctor` does not ask the user to set `COMPOSIO_API_KEY`.
|
|
147
|
-
- `deploy doctor` reports each configured toolkit auth config as present before the connect link flow.
|
|
148
|
-
|
|
149
|
-
## Troubleshooting
|
|
150
|
-
|
|
151
|
-
`managed_composio_entitlement_required`:
|
|
152
|
-
|
|
153
|
-
Log in with a paid AgentKit Cloud account that has `managed_composio`.
|
|
154
|
-
|
|
155
|
-
`managed_composio_auth_config_missing`:
|
|
156
|
-
|
|
157
|
-
The AgentKit Cloud account is entitled, but the requested toolkit is not configured in AgentKit Cloud yet. Report the exact error code and toolkit slug to the AgentKit owner.
|
|
158
|
-
|
|
159
|
-
`managed_composio_not_configured`:
|
|
160
|
-
|
|
161
|
-
Managed Composio is not available for this AgentKit Cloud environment. Use BYO `defineTool` wrappers for now or ask the owner to enable managed Composio for the account.
|
|
162
|
-
|
|
163
|
-
`integration_toolkit_required`:
|
|
164
|
-
|
|
165
|
-
The deploy has multiple configured toolkits. Re-run connect with `--toolkit <slug>`.
|