@andreprado/agentkit 0.1.0-alpha.10
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 +69 -0
- package/bin/agentkit.mjs +23 -0
- package/docs/guides/add-channel.md +114 -0
- package/docs/guides/add-knowledge.md +134 -0
- package/docs/guides/add-tool.md +342 -0
- package/docs/guides/agentkit-skills-architecture.md +471 -0
- package/docs/guides/channel-security.md +81 -0
- package/docs/guides/channels-implementation-map.md +243 -0
- package/docs/guides/channels-production-handoff.md +102 -0
- package/docs/guides/connect-telegram.md +110 -0
- package/docs/guides/connect-whatsapp-zapster.md +119 -0
- package/docs/guides/create-agent.md +220 -0
- package/docs/guides/prepare-deploy.md +209 -0
- package/docs/guides/run-evals.md +179 -0
- package/docs/guides/security-rules.md +156 -0
- package/docs/guides/use-provider.md +140 -0
- package/docs/llms-full.txt +876 -0
- package/docs/llms.txt +83 -0
- package/docs/portable-deploy-release-checklist.md +41 -0
- package/package.json +47 -0
- package/src/cli/args.ts +36 -0
- package/src/cli/cloud-client.ts +265 -0
- package/src/cli/commands/channels.ts +810 -0
- package/src/cli/commands/knowledge.ts +136 -0
- package/src/cli/constants.ts +4 -0
- package/src/cli/deploy-chat-ui.ts +392 -0
- package/src/cli/deploy-readiness.ts +348 -0
- package/src/cli/flags.ts +162 -0
- package/src/cli/help.ts +184 -0
- package/src/cli/index.ts +1276 -0
- package/src/cli/process.ts +31 -0
- package/src/cloud/artifact.ts +139 -0
- package/src/cloud/client.ts +79 -0
- package/src/cloud/contracts.ts +63 -0
- package/src/cloud/index.ts +3 -0
- package/src/create-project.ts +177 -0
- package/src/index.ts +408 -0
- package/src/providers/index.ts +25 -0
- package/src/providers/pi.ts +286 -0
- package/src/providers/test.ts +133 -0
- package/src/providers/types.ts +34 -0
- package/src/runtime/build.ts +43 -0
- package/src/runtime/channel-buffer.ts +30 -0
- package/src/runtime/channel-test-harness.ts +112 -0
- package/src/runtime/channels/telegram.ts +360 -0
- package/src/runtime/channels/website.ts +132 -0
- package/src/runtime/channels/whatsapp-meta.ts +71 -0
- package/src/runtime/channels/whatsapp-zapster.ts +278 -0
- package/src/runtime/channels.ts +138 -0
- package/src/runtime/chat.ts +218 -0
- package/src/runtime/config.ts +684 -0
- package/src/runtime/conversations.ts +38 -0
- package/src/runtime/core/deploy-state.ts +54 -0
- package/src/runtime/core/manifest.ts +213 -0
- package/src/runtime/core/targets.ts +133 -0
- package/src/runtime/database.ts +256 -0
- package/src/runtime/db-commands.ts +167 -0
- package/src/runtime/deploy-readiness.ts +105 -0
- package/src/runtime/deploy.ts +1 -0
- package/src/runtime/dev-server.ts +1247 -0
- package/src/runtime/docs.ts +36 -0
- package/src/runtime/env.ts +152 -0
- package/src/runtime/errors.ts +13 -0
- package/src/runtime/evals.ts +509 -0
- package/src/runtime/inspect.ts +203 -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 +283 -0
- package/src/runtime/knowledge/schema.ts +56 -0
- package/src/runtime/knowledge/tool.ts +64 -0
- package/src/runtime/knowledge/vector.ts +258 -0
- package/src/runtime/runtime-contract.ts +93 -0
- package/src/runtime/spec.ts +152 -0
- package/src/runtime/sync.ts +144 -0
- package/src/runtime/targets/cloudflare/build.ts +2517 -0
- package/src/runtime/targets/container/build.ts +146 -0
- package/src/runtime/targets/container/server.ts +33 -0
- package/src/runtime/targets/vps/deploy.ts +206 -0
- package/src/runtime/tool-runner.ts +65 -0
- package/src/runtime/tools.ts +470 -0
- package/src/runtime/traces.ts +41 -0
- package/src/storage/sqlite.ts +1118 -0
- package/src/templates/blank.ts +394 -0
- package/src/templates/dentista.ts +1003 -0
- package/src/templates/index.ts +33 -0
- package/src/templates/skills/agentkit-build-agent/SKILL.md +51 -0
- package/src/templates/skills/agentkit-build-agent/templates/appointment-intake.instructions.md +20 -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 +62 -0
- package/src/templates/skills/agentkit-capsule/references/docs-router.md +15 -0
- package/src/templates/skills/agentkit-channels/SKILL.md +62 -0
- package/src/templates/skills/agentkit-channels/references/channel-buffering.md +58 -0
- package/src/templates/skills/agentkit-channels/references/channel-debugging.md +41 -0
- package/src/templates/skills/agentkit-channels/references/telegram.md +38 -0
- package/src/templates/skills/agentkit-channels/references/whatsapp-zapster.md +44 -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 +44 -0
- package/src/templates/skills/agentkit-evals/SKILL.md +60 -0
- package/src/templates/skills/agentkit-evals/templates/multi-turn.eval.md +22 -0
- package/src/templates/skills/agentkit-evals/templates/no-leak.eval.md +14 -0
- package/src/templates/skills/agentkit-evals/templates/smoke.eval.md +14 -0
- package/src/templates/skills/agentkit-evals/templates/tool-call.eval.md +18 -0
- package/src/templates/skills/agentkit-knowledge/SKILL.md +40 -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 +45 -0
- package/src/templates/skills/agentkit-prompts/templates/knowledge-grounded-faq.instructions.md +11 -0
- package/src/templates/skills/agentkit-provider/SKILL.md +57 -0
- package/src/templates/skills/agentkit-security/SKILL.md +55 -0
- package/src/templates/skills/agentkit-tools/SKILL.md +36 -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 +52 -0
- package/src/templates/support.ts +401 -0
|
@@ -0,0 +1,401 @@
|
|
|
1
|
+
import type { AgentTemplate } from ".";
|
|
2
|
+
|
|
3
|
+
export const supportTemplate: AgentTemplate = {
|
|
4
|
+
name: "support",
|
|
5
|
+
files(projectName: string, context = {}) {
|
|
6
|
+
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
|
+
},
|
|
61
|
+
{
|
|
62
|
+
path: ".env.schema",
|
|
63
|
+
contents: `# Optional: add real provider keys after switching away from test/fake.
|
|
64
|
+
OPENAI_API_KEY=
|
|
65
|
+
ANTHROPIC_API_KEY=
|
|
66
|
+
OPENROUTER_API_KEY=
|
|
67
|
+
`,
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
path: "agentkit.config.ts",
|
|
71
|
+
contents: `import { defineAgent } from "@andreprado/agentkit";
|
|
72
|
+
import { lookupOrder } from "./tools/lookup-order";
|
|
73
|
+
|
|
74
|
+
export default defineAgent({
|
|
75
|
+
name: "${projectName}",
|
|
76
|
+
runtime: "edge",
|
|
77
|
+
provider: {
|
|
78
|
+
name: "test",
|
|
79
|
+
model: "fake",
|
|
80
|
+
},
|
|
81
|
+
instructions: "./prompts/instructions.md",
|
|
82
|
+
secrets: [],
|
|
83
|
+
tools: [lookupOrder],
|
|
84
|
+
access: {
|
|
85
|
+
mode: "private",
|
|
86
|
+
},
|
|
87
|
+
storage: {
|
|
88
|
+
driver: "agentkit",
|
|
89
|
+
path: ".agentkit/agentkit.db",
|
|
90
|
+
database: {
|
|
91
|
+
driver: "turso",
|
|
92
|
+
schema: "./schema.sql",
|
|
93
|
+
},
|
|
94
|
+
},
|
|
95
|
+
});
|
|
96
|
+
`,
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
path: "schema.sql",
|
|
100
|
+
contents: `CREATE TABLE IF NOT EXISTS support_notes (
|
|
101
|
+
id TEXT PRIMARY KEY,
|
|
102
|
+
body TEXT NOT NULL,
|
|
103
|
+
created_at TEXT NOT NULL DEFAULT CURRENT_TIMESTAMP
|
|
104
|
+
);
|
|
105
|
+
`,
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
path: "src/agent.ts",
|
|
109
|
+
contents: `export { default } from "../agentkit.config";
|
|
110
|
+
`,
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
path: "tools/lookup-order.ts",
|
|
114
|
+
contents: `const orders: Record<string, { status: string; eta: string }> = {
|
|
115
|
+
A100: { status: "preparing", eta: "today" },
|
|
116
|
+
B200: { status: "shipped", eta: "tomorrow" },
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
export const lookupOrder = {
|
|
120
|
+
name: "lookup_order",
|
|
121
|
+
description: "Looks up a demo support order by order id.",
|
|
122
|
+
visibility: "user",
|
|
123
|
+
inputSchema: {
|
|
124
|
+
type: "object",
|
|
125
|
+
properties: {
|
|
126
|
+
orderId: { type: "string" },
|
|
127
|
+
},
|
|
128
|
+
required: ["orderId"],
|
|
129
|
+
additionalProperties: false,
|
|
130
|
+
},
|
|
131
|
+
outputSchema: {
|
|
132
|
+
type: "object",
|
|
133
|
+
properties: {
|
|
134
|
+
orderId: { type: "string" },
|
|
135
|
+
found: { type: "boolean" },
|
|
136
|
+
status: { type: "string" },
|
|
137
|
+
eta: { type: "string" },
|
|
138
|
+
},
|
|
139
|
+
required: ["orderId", "found", "status", "eta"],
|
|
140
|
+
},
|
|
141
|
+
execute(input: { orderId: string }) {
|
|
142
|
+
const order = orders[input.orderId];
|
|
143
|
+
|
|
144
|
+
if (!order) {
|
|
145
|
+
return {
|
|
146
|
+
orderId: input.orderId,
|
|
147
|
+
found: false,
|
|
148
|
+
status: "unknown",
|
|
149
|
+
eta: "unknown",
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
return {
|
|
154
|
+
orderId: input.orderId,
|
|
155
|
+
found: true,
|
|
156
|
+
status: order.status,
|
|
157
|
+
eta: order.eta,
|
|
158
|
+
};
|
|
159
|
+
},
|
|
160
|
+
};
|
|
161
|
+
`,
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
path: "prompts/instructions.md",
|
|
165
|
+
contents: `You are ${projectName}, a focused support agent.
|
|
166
|
+
|
|
167
|
+
Help users with clear answers. When order status is needed, use the lookup_order tool.
|
|
168
|
+
`,
|
|
169
|
+
},
|
|
170
|
+
{
|
|
171
|
+
path: "evals/smoke.eval.ts",
|
|
172
|
+
contents: `export default {
|
|
173
|
+
name: "smoke",
|
|
174
|
+
input: "Say hello as a support agent.",
|
|
175
|
+
expect: {
|
|
176
|
+
contains: "hello",
|
|
177
|
+
},
|
|
178
|
+
};
|
|
179
|
+
`,
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
path: "AGENTS.md",
|
|
183
|
+
contents: `# ${projectName}
|
|
184
|
+
|
|
185
|
+
This is an AgentKit support Agent Capsule.
|
|
186
|
+
|
|
187
|
+
## Coding Agent Workflow
|
|
188
|
+
|
|
189
|
+
When the owner opens this folder in Codex, Claude Code, or another coding agent and asks for a specific support agent, treat that request as the product brief.
|
|
190
|
+
|
|
191
|
+
Start building immediately:
|
|
192
|
+
|
|
193
|
+
- Start with \`skills/agentkit-capsule/SKILL.md\`, then use \`npm run agentkit -- docs llms\` as the docs router.
|
|
194
|
+
- Create or update \`AGENT_SPEC.md\` from the owner's request with \`npm run agentkit -- spec init --brief "<owner request>"\`; the owner should not fill this file by hand before work starts.
|
|
195
|
+
- Infer the first useful version from the owner's request.
|
|
196
|
+
- Edit \`prompts/instructions.md\` for support behavior.
|
|
197
|
+
- Edit \`agentkit.config.ts\` for provider, tools, secrets, access, and storage.
|
|
198
|
+
- Add or replace TypeScript tools under \`tools/\` when the requested support agent needs actions or external data.
|
|
199
|
+
- Add \`sync.ts\`, \`seed.sql\`, and ordered \`migrations/*.sql\` when the support agent depends on external catalogs or production-shaped data changes.
|
|
200
|
+
- Do not wait for a wizard or recipe. AgentKit provides the scaffold and contract; you decide the implementation from the owner's brief.
|
|
201
|
+
- Ask follow-up questions only when missing information blocks a safe local implementation.
|
|
202
|
+
- State assumptions in the final response.
|
|
203
|
+
|
|
204
|
+
## Local Commands
|
|
205
|
+
|
|
206
|
+
- \`npm install\`: restore capsule dependencies if this capsule used \`--no-install\`, install failed, or \`node_modules\` was deleted.
|
|
207
|
+
- \`npm run chat -- --message "hello"\`: send one local chat message.
|
|
208
|
+
- \`npm run agentkit -- tool lookup_order --input '{"orderId":"A100"}'\`: test the example tool directly.
|
|
209
|
+
- \`npm run eval\`: run agent evals.
|
|
210
|
+
- \`npm run agentkit -- spec check\`: verify the local agent implementation contract exists.
|
|
211
|
+
- \`npm run agentkit -- eval from-conversation <conversation-id>\`: turn a real conversation into a regression eval.
|
|
212
|
+
- \`npm run agentkit -- conversations trace <conversation-id>\`: inspect messages, runs, tool calls, inputs, outputs, rendered output, and final responses.
|
|
213
|
+
- \`npm run dev\`: run the local Agent Capsule runtime.
|
|
214
|
+
- \`npm run agentkit -- inspect\`: print machine-readable capsule state.
|
|
215
|
+
- \`printf %s "$VALUE" | npm run agentkit -- env set <NAME> --stdin\`: write a local secret value to ignored \`.env\` without putting it in shell history.
|
|
216
|
+
- \`npm run agentkit -- env list\`: list local secret names without printing values.
|
|
217
|
+
- \`npm run agentkit -- docs llms\`: print the lightweight AgentKit docs router.
|
|
218
|
+
- \`npm run agentkit -- docs full\`: print the full AgentKit contract path only when a skill asks for it.
|
|
219
|
+
|
|
220
|
+
## Testing With A UI
|
|
221
|
+
|
|
222
|
+
- Local UI: run \`npm run dev\`, open the printed \`Chat:\` URL, and tell the owner the exact URL.
|
|
223
|
+
- 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.
|
|
224
|
+
- \`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.
|
|
225
|
+
- Before claiming real conversation behavior is tested, ask the owner which provider to use: OpenRouter, OpenAI, Anthropic, or another supported provider. Do not choose for them.
|
|
226
|
+
|
|
227
|
+
## Hosted Deploy
|
|
228
|
+
|
|
229
|
+
- Local scaffold, chat, eval, dev, inspect, tool, and build commands are token-free.
|
|
230
|
+
- 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>\`.
|
|
231
|
+
- 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.
|
|
232
|
+
- Deploy with \`npm run agentkit -- deploy\`, then check \`npm run agentkit -- deploy status\`.
|
|
233
|
+
- 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.
|
|
234
|
+
- Use \`npm run agentkit -- deploy --smoke "hello"\` or \`npm run agentkit -- deploy smoke --message "hello"\` for an official hosted chat smoke check.
|
|
235
|
+
- Do not run operator/admin commands from a user capsule.
|
|
236
|
+
|
|
237
|
+
## Files
|
|
238
|
+
|
|
239
|
+
- \`agentkit.config.ts\`: agent contract and tool registry.
|
|
240
|
+
- \`tools/lookup-order.ts\`: example TypeScript tool.
|
|
241
|
+
- \`prompts/instructions.md\`: support agent instructions.
|
|
242
|
+
- \`.agentkit/\`: local runtime state.
|
|
243
|
+
|
|
244
|
+
## Rules
|
|
245
|
+
|
|
246
|
+
- Keep required local secret names in \`.env.schema\` and values in ignored \`.env\`. AgentKit local commands load \`.env\` directly.
|
|
247
|
+
- Do not commit \`.env\` or \`.agentkit/\`.
|
|
248
|
+
`,
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
path: "AGENTKIT.md",
|
|
252
|
+
contents: `# AgentKit Docs
|
|
253
|
+
|
|
254
|
+
This folder is an AgentKit support Agent Capsule.
|
|
255
|
+
|
|
256
|
+
## Start Here
|
|
257
|
+
|
|
258
|
+
If the owner asks you to build an agent in natural language, that request is the brief. Do not ask them to fill another file first.
|
|
259
|
+
|
|
260
|
+
Example owner request:
|
|
261
|
+
|
|
262
|
+
> Develop an appointment and intake agent for an ophthalmology office.
|
|
263
|
+
|
|
264
|
+
Turn the request into a working local capsule:
|
|
265
|
+
|
|
266
|
+
- Update \`prompts/instructions.md\` with domain-specific behavior, boundaries, intake questions, and escalation rules.
|
|
267
|
+
- Create or update \`AGENT_SPEC.md\` with \`npm run agentkit -- spec init --brief "<owner request>"\`. The owner gives the general idea; the coding agent turns it into the structured contract.
|
|
268
|
+
- Update \`agentkit.config.ts\` when tools, secrets, provider, or access rules change.
|
|
269
|
+
- Add, replace, or remove TypeScript tools under \`tools/\` for real actions or external data.
|
|
270
|
+
- Use \`npm run agentkit -- sync init\` when the agent needs catalog sync, fixture seed data, or ordered migrations.
|
|
271
|
+
- Keep the first version runnable with \`test/fake\` unless the owner explicitly asks for a real provider.
|
|
272
|
+
- Do not use a wizard or recipe. Build the capsule directly from the scaffold, the AgentKit contract, and the owner's brief.
|
|
273
|
+
- Make practical assumptions and list them in your final response.
|
|
274
|
+
- Ask follow-up questions only when missing information blocks a safe local implementation.
|
|
275
|
+
|
|
276
|
+
## Local Commands
|
|
277
|
+
|
|
278
|
+
\`\`\`sh
|
|
279
|
+
npm run typecheck
|
|
280
|
+
npm run agentkit -- inspect
|
|
281
|
+
npm run agentkit -- tool lookup_order --input '{"orderId":"A100"}'
|
|
282
|
+
npm run eval
|
|
283
|
+
\`\`\`
|
|
284
|
+
|
|
285
|
+
\`test/fake\` proves the scaffold and deterministic tool paths. It does not prove natural conversation quality.
|
|
286
|
+
|
|
287
|
+
\`agentkit new\` installs dependencies by default. Run \`npm install\` only if the capsule was created with \`--no-install\`, install failed, or \`node_modules\` was deleted.
|
|
288
|
+
|
|
289
|
+
Set local development secrets without opening code:
|
|
290
|
+
|
|
291
|
+
\`\`\`sh
|
|
292
|
+
printf %s "$OPENAI_API_KEY" | npm run agentkit -- env set OPENAI_API_KEY --stdin
|
|
293
|
+
npm run agentkit -- inspect
|
|
294
|
+
npm run chat -- --message "hello"
|
|
295
|
+
\`\`\`
|
|
296
|
+
|
|
297
|
+
## Testing With A UI
|
|
298
|
+
|
|
299
|
+
Local UI:
|
|
300
|
+
|
|
301
|
+
\`\`\`sh
|
|
302
|
+
npm run dev
|
|
303
|
+
\`\`\`
|
|
304
|
+
|
|
305
|
+
Open the printed \`Chat:\` URL and tell the owner the exact URL.
|
|
306
|
+
|
|
307
|
+
Hosted deploy UI:
|
|
308
|
+
|
|
309
|
+
\`\`\`sh
|
|
310
|
+
npm run agentkit -- deploy
|
|
311
|
+
npm run agentkit -- chat-ui --deploy
|
|
312
|
+
\`\`\`
|
|
313
|
+
|
|
314
|
+
Open the printed \`Chat:\` URL and tell the owner this local UI is connected to the hosted deploy.
|
|
315
|
+
|
|
316
|
+
Before claiming real conversation behavior has been tested, ask the owner which provider to use: OpenRouter, OpenAI, Anthropic, or another supported provider. Do not choose for them. After they choose, update \`agentkit.config.ts\`, \`.env.schema\`, local secrets, hosted secrets if deploying, then rerun chat/UI checks.
|
|
317
|
+
|
|
318
|
+
If you add a tool, also run a fake-provider tool smoke test:
|
|
319
|
+
|
|
320
|
+
\`\`\`sh
|
|
321
|
+
npm run agentkit -- tool tool_name --input '{}'
|
|
322
|
+
\`\`\`
|
|
323
|
+
|
|
324
|
+
For the lightweight docs router, read the path printed by:
|
|
325
|
+
|
|
326
|
+
\`\`\`sh
|
|
327
|
+
npm run agentkit -- docs llms
|
|
328
|
+
\`\`\`
|
|
329
|
+
|
|
330
|
+
Read the full framework contract with \`npm run agentkit -- docs full\` only when a skill asks for it.
|
|
331
|
+
|
|
332
|
+
## Database Tools
|
|
333
|
+
|
|
334
|
+
Tools that need agent-owned tables should use canonical \`ctx.db\` from the tool context. \`ctx.database\` and \`ctx.storage.sql\` are aliases. Do not import local database drivers or Node-only APIs in a tool.
|
|
335
|
+
|
|
336
|
+
The recommended dual-storage pattern is:
|
|
337
|
+
|
|
338
|
+
1. Add tables to \`schema.sql\`.
|
|
339
|
+
2. Keep \`storage.driver: "agentkit"\` for deploy-ready capsules.
|
|
340
|
+
3. Run \`npm run agentkit -- tool ...\` or \`npm run chat ...\` locally. AgentKit applies \`schema.sql\` to local development storage.
|
|
341
|
+
4. Use \`npm run agentkit -- db migrate\`, \`db reset --yes\`, \`db seed\`, and \`db shell\` for local database setup and inspection.
|
|
342
|
+
5. Run \`npm run agentkit -- deploy\`. AgentKit migrates/provisions hosted storage internally.
|
|
343
|
+
|
|
344
|
+
\`schema.sql\` is an idempotent bootstrap file in v1. Use \`CREATE TABLE IF NOT EXISTS\`, \`CREATE INDEX IF NOT EXISTS\`, and safe additive changes. AgentKit does not run destructive schema changes or ordered \`migrations/*.sql\` automatically yet.
|
|
345
|
+
|
|
346
|
+
## Hosted Deploy
|
|
347
|
+
|
|
348
|
+
This capsule is deploy-ready by default.
|
|
349
|
+
|
|
350
|
+
1. Keep tools edge-safe and use \`ctx.db\` instead of importing database drivers.
|
|
351
|
+
2. Run \`npm run agentkit -- build\` only when you want to validate the artifact locally.
|
|
352
|
+
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>\`.
|
|
353
|
+
4. Put production secrets into managed secrets with \`npm run agentkit -- secret set <NAME> --from-local-env\`, \`--from-env\`, or \`--stdin\`.
|
|
354
|
+
5. Run \`npm run agentkit -- deploy\`.
|
|
355
|
+
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.
|
|
356
|
+
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.
|
|
357
|
+
|
|
358
|
+
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.
|
|
359
|
+
`,
|
|
360
|
+
},
|
|
361
|
+
{
|
|
362
|
+
path: "CLAUDE.md",
|
|
363
|
+
contents: `# ${projectName}
|
|
364
|
+
|
|
365
|
+
Use AgentKit conventions when editing this support capsule.
|
|
366
|
+
|
|
367
|
+
- The agent contract lives in \`agentkit.config.ts\`.
|
|
368
|
+
- The example tool lives in \`tools/lookup-order.ts\`.
|
|
369
|
+
- The default provider is \`test/fake\`, which can call tools from JSON messages during local tests.
|
|
370
|
+
- Ask the owner which real provider to use before switching from \`test/fake\`; do not choose OpenRouter, OpenAI, or Anthropic automatically.
|
|
371
|
+
- Keep required local secret names in \`.env.schema\` and values in ignored \`.env\`. AgentKit local commands load \`.env\` directly.
|
|
372
|
+
- Treat the owner's natural-language request as the brief and start implementing inside this capsule.
|
|
373
|
+
- Start with \`skills/agentkit-capsule/SKILL.md\` when the task is not obvious.
|
|
374
|
+
`,
|
|
375
|
+
},
|
|
376
|
+
{
|
|
377
|
+
path: "README.md",
|
|
378
|
+
contents: `# ${projectName}
|
|
379
|
+
|
|
380
|
+
Generated by AgentKit as a support Agent Capsule.
|
|
381
|
+
|
|
382
|
+
## Setup
|
|
383
|
+
|
|
384
|
+
\`\`\`sh
|
|
385
|
+
npm run chat -- --message "hello"
|
|
386
|
+
npm run agentkit -- tool lookup_order --input '{"orderId":"A100"}'
|
|
387
|
+
npm run eval
|
|
388
|
+
npm run dev
|
|
389
|
+
\`\`\`
|
|
390
|
+
|
|
391
|
+
\`agentkit new\` installs dependencies by default. Run \`npm install\` only if this capsule was created with \`--no-install\`, install failed, or \`node_modules\` was deleted.
|
|
392
|
+
|
|
393
|
+
The support template includes a local \`lookup_order\` TypeScript tool and uses \`test/fake\` by default.
|
|
394
|
+
\`test/fake\` does not validate real conversation quality. The owner must choose OpenRouter, OpenAI, Anthropic, or another supported provider before real model behavior is tested.
|
|
395
|
+
|
|
396
|
+
For UI testing, run \`npm run dev\` and open the printed \`Chat:\` URL. After hosted deploy, run \`npm run agentkit -- chat-ui --deploy\` and open its printed \`Chat:\` URL.
|
|
397
|
+
`,
|
|
398
|
+
},
|
|
399
|
+
];
|
|
400
|
+
},
|
|
401
|
+
};
|