@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,146 +0,0 @@
|
|
|
1
|
-
import { mkdir, readFile, writeFile } from "node:fs/promises";
|
|
2
|
-
import { join, resolve } from "node:path";
|
|
3
|
-
|
|
4
|
-
import { loadAgentCapsule } from "../../config";
|
|
5
|
-
import { buildSharedAgentManifest, type ManifestSchema, type SharedAgentManifest } from "../../core/manifest";
|
|
6
|
-
|
|
7
|
-
export type ContainerBuildResult = {
|
|
8
|
-
target: "container";
|
|
9
|
-
root: string;
|
|
10
|
-
buildDir: string;
|
|
11
|
-
manifestPath: string;
|
|
12
|
-
serverPath: string;
|
|
13
|
-
packageJsonPath: string;
|
|
14
|
-
dockerfilePath: string;
|
|
15
|
-
migrationsDir: string;
|
|
16
|
-
warnings: string[];
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export type ContainerManifest = Omit<SharedAgentManifest, "runtime"> & {
|
|
20
|
-
target: "container";
|
|
21
|
-
runtime: "container";
|
|
22
|
-
container: {
|
|
23
|
-
runtime: "node";
|
|
24
|
-
entrypoint: "server.ts";
|
|
25
|
-
port: 4123;
|
|
26
|
-
};
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
const CONTAINER_BUILD_DIR = ".agentkit/build/container";
|
|
30
|
-
|
|
31
|
-
export async function buildContainerAgentCapsule(cwd = process.cwd()): Promise<ContainerBuildResult> {
|
|
32
|
-
const capsule = await loadAgentCapsule(cwd);
|
|
33
|
-
const databaseConfig = capsule.config.storage.database;
|
|
34
|
-
const databaseSchema = await loadApplicationSchema(
|
|
35
|
-
capsule.root,
|
|
36
|
-
databaseConfig?.driver === "turso" ? databaseConfig.schema : undefined,
|
|
37
|
-
);
|
|
38
|
-
const manifest = buildContainerManifest(buildSharedAgentManifest(capsule, { databaseSchema }));
|
|
39
|
-
const buildDir = join(capsule.root, CONTAINER_BUILD_DIR);
|
|
40
|
-
const migrationsDir = join(buildDir, "migrations");
|
|
41
|
-
const manifestPath = join(buildDir, "agent.manifest.json");
|
|
42
|
-
const serverPath = join(buildDir, "server.ts");
|
|
43
|
-
const packageJsonPath = join(buildDir, "package.json");
|
|
44
|
-
const dockerfilePath = join(buildDir, "Dockerfile");
|
|
45
|
-
|
|
46
|
-
await mkdir(migrationsDir, { recursive: true });
|
|
47
|
-
await writeFile(manifestPath, `${JSON.stringify(manifest, null, 2)}\n`);
|
|
48
|
-
await writeFile(serverPath, renderContainerServer());
|
|
49
|
-
await writeFile(packageJsonPath, renderContainerPackageJson(capsule.config.name));
|
|
50
|
-
await writeFile(dockerfilePath, renderDockerfile());
|
|
51
|
-
|
|
52
|
-
if (databaseSchema) {
|
|
53
|
-
await writeFile(join(migrationsDir, "schema.sql"), databaseSchema.source);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
return {
|
|
57
|
-
target: "container",
|
|
58
|
-
root: capsule.root,
|
|
59
|
-
buildDir,
|
|
60
|
-
manifestPath,
|
|
61
|
-
serverPath,
|
|
62
|
-
packageJsonPath,
|
|
63
|
-
dockerfilePath,
|
|
64
|
-
migrationsDir,
|
|
65
|
-
warnings: [],
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
function buildContainerManifest(shared: SharedAgentManifest): ContainerManifest {
|
|
70
|
-
return {
|
|
71
|
-
...shared,
|
|
72
|
-
target: "container",
|
|
73
|
-
runtime: "container",
|
|
74
|
-
container: {
|
|
75
|
-
runtime: "node",
|
|
76
|
-
entrypoint: "server.ts",
|
|
77
|
-
port: 4123,
|
|
78
|
-
},
|
|
79
|
-
};
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
async function loadApplicationSchema(root: string, schemaPath: string | undefined): Promise<ManifestSchema | null> {
|
|
83
|
-
if (!schemaPath) {
|
|
84
|
-
return null;
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
const source = await readFile(resolve(root, schemaPath), "utf8");
|
|
88
|
-
const digest = await crypto.subtle.digest("SHA-256", new TextEncoder().encode(source));
|
|
89
|
-
return {
|
|
90
|
-
source,
|
|
91
|
-
sha256: Array.from(new Uint8Array(digest), (byte) => byte.toString(16).padStart(2, "0")).join(""),
|
|
92
|
-
};
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
function renderContainerServer(): string {
|
|
96
|
-
return `import { startContainerRuntime } from "@andreprado/agentkit/runtime/container";
|
|
97
|
-
|
|
98
|
-
await startContainerRuntime();
|
|
99
|
-
`;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
function renderContainerPackageJson(agentName: string): string {
|
|
103
|
-
return `${JSON.stringify(
|
|
104
|
-
{
|
|
105
|
-
name: `agentkit-${slugify(agentName)}-container`,
|
|
106
|
-
private: true,
|
|
107
|
-
type: "module",
|
|
108
|
-
scripts: {
|
|
109
|
-
start: "tsx server.ts",
|
|
110
|
-
},
|
|
111
|
-
dependencies: {
|
|
112
|
-
"@andreprado/agentkit": "latest",
|
|
113
|
-
"tsx": "^4.22.3",
|
|
114
|
-
},
|
|
115
|
-
},
|
|
116
|
-
null,
|
|
117
|
-
2,
|
|
118
|
-
)}\n`;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
function renderDockerfile(): string {
|
|
122
|
-
return `FROM node:24-slim
|
|
123
|
-
|
|
124
|
-
WORKDIR /app
|
|
125
|
-
COPY package.json server.ts agent.manifest.json ./
|
|
126
|
-
COPY migrations ./migrations
|
|
127
|
-
RUN npm install --omit=dev
|
|
128
|
-
|
|
129
|
-
ENV HOST=0.0.0.0
|
|
130
|
-
ENV PORT=4123
|
|
131
|
-
ENV AGENTKIT_CAPSULE_ROOT=/capsule
|
|
132
|
-
|
|
133
|
-
EXPOSE 4123
|
|
134
|
-
CMD ["npm", "start"]
|
|
135
|
-
`;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
function slugify(value: string): string {
|
|
139
|
-
const slug = value
|
|
140
|
-
.toLowerCase()
|
|
141
|
-
.replace(/[^a-z0-9-]+/g, "-")
|
|
142
|
-
.replace(/^-+|-+$/g, "")
|
|
143
|
-
.slice(0, 48);
|
|
144
|
-
|
|
145
|
-
return slug || "agent";
|
|
146
|
-
}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { resolve } from "node:path";
|
|
2
|
-
|
|
3
|
-
import { startAgentDevServer, type AgentDevServer } from "../../dev-server";
|
|
4
|
-
|
|
5
|
-
export type ContainerRuntimeOptions = {
|
|
6
|
-
capsuleRoot?: string;
|
|
7
|
-
hostname?: string;
|
|
8
|
-
port?: number;
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export async function startContainerRuntime(options: ContainerRuntimeOptions = {}): Promise<AgentDevServer> {
|
|
12
|
-
const capsuleRoot = resolve(options.capsuleRoot ?? process.env.AGENTKIT_CAPSULE_ROOT ?? process.cwd());
|
|
13
|
-
const hostname = options.hostname ?? process.env.HOST ?? "0.0.0.0";
|
|
14
|
-
const port = options.port ?? parsePort(process.env.PORT) ?? 4123;
|
|
15
|
-
return startAgentDevServer(capsuleRoot, { hostname, port, access: "enforce" });
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
function parsePort(value: string | undefined): number | undefined {
|
|
19
|
-
if (!value) {
|
|
20
|
-
return undefined;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
const port = Number(value);
|
|
24
|
-
return Number.isInteger(port) && port > 0 && port <= 65535 ? port : undefined;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
if (import.meta.main) {
|
|
28
|
-
const runtime = await startContainerRuntime();
|
|
29
|
-
|
|
30
|
-
console.log("AgentKit container runtime running");
|
|
31
|
-
console.log(`API: http://${runtime.hostname}:${runtime.port}`);
|
|
32
|
-
console.log(`Inspect: http://${runtime.hostname}:${runtime.port}/_agentkit`);
|
|
33
|
-
}
|
|
@@ -1,223 +0,0 @@
|
|
|
1
|
-
import { chmod, mkdir, readFile, writeFile } from "node:fs/promises";
|
|
2
|
-
import { join } from "node:path";
|
|
3
|
-
|
|
4
|
-
import type { LocalDeployState } from "../../core/deploy-state";
|
|
5
|
-
import type { ContainerBuildResult } from "../container/build";
|
|
6
|
-
|
|
7
|
-
export type VpsDeployOptions = {
|
|
8
|
-
host: string;
|
|
9
|
-
dryRun?: boolean;
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
export type VpsDeployPlan = {
|
|
13
|
-
target: "vps";
|
|
14
|
-
runtime: "container";
|
|
15
|
-
host: string;
|
|
16
|
-
buildDir: string;
|
|
17
|
-
composePath: string;
|
|
18
|
-
envExamplePath: string;
|
|
19
|
-
secretsPath: string;
|
|
20
|
-
handoffPath: string;
|
|
21
|
-
statePath: string;
|
|
22
|
-
commands: string[];
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
const VPS_BUILD_DIR = ".agentkit/build/vps";
|
|
26
|
-
|
|
27
|
-
export async function prepareVpsDeploy(
|
|
28
|
-
container: ContainerBuildResult,
|
|
29
|
-
options: VpsDeployOptions,
|
|
30
|
-
): Promise<VpsDeployPlan> {
|
|
31
|
-
const buildDir = join(container.root, VPS_BUILD_DIR);
|
|
32
|
-
const composePath = join(buildDir, "compose.yaml");
|
|
33
|
-
const envExamplePath = join(buildDir, ".env.production.example");
|
|
34
|
-
const envPath = join(buildDir, ".env.production");
|
|
35
|
-
const secretsPath = join(buildDir, "SECRETS.md");
|
|
36
|
-
const handoffPath = join(buildDir, "PRODUCTION_HANDOFF.md");
|
|
37
|
-
const statePath = join(container.root, ".agentkit/deploy.json");
|
|
38
|
-
const manifest = JSON.parse(await readFile(container.manifestPath, "utf8")) as {
|
|
39
|
-
name: string;
|
|
40
|
-
secrets: string[];
|
|
41
|
-
access: {
|
|
42
|
-
mode: "private" | "token" | "public";
|
|
43
|
-
};
|
|
44
|
-
};
|
|
45
|
-
|
|
46
|
-
await mkdir(buildDir, { recursive: true });
|
|
47
|
-
const envExample = renderEnvExample(manifest.secrets);
|
|
48
|
-
await writeFile(composePath, renderCompose(manifest.name));
|
|
49
|
-
await writeFile(envExamplePath, envExample);
|
|
50
|
-
await writeFile(envPath, envExample, { mode: 0o600 });
|
|
51
|
-
await chmod(envPath, 0o600);
|
|
52
|
-
await writeFile(secretsPath, renderSecretsChecklist(manifest.secrets));
|
|
53
|
-
await writeFile(handoffPath, renderProductionHandoff(options.host, manifest.name, manifest.access.mode));
|
|
54
|
-
|
|
55
|
-
const state: LocalDeployState = {
|
|
56
|
-
deploy_id: `vps_${slugify(manifest.name)}`,
|
|
57
|
-
project_id: `local_${slugify(manifest.name)}`,
|
|
58
|
-
url: `https://${options.host}`,
|
|
59
|
-
target: "vps",
|
|
60
|
-
runtime: "container",
|
|
61
|
-
resources: {
|
|
62
|
-
vps: {
|
|
63
|
-
host: options.host,
|
|
64
|
-
compose: composePath,
|
|
65
|
-
env_example: envExamplePath,
|
|
66
|
-
sqlite_path: "/data/agentkit.db",
|
|
67
|
-
files_path: "/capsule/.agentkit/files",
|
|
68
|
-
},
|
|
69
|
-
container: {
|
|
70
|
-
build_dir: container.buildDir,
|
|
71
|
-
},
|
|
72
|
-
},
|
|
73
|
-
access: {
|
|
74
|
-
mode: "operator-managed",
|
|
75
|
-
},
|
|
76
|
-
created_at: new Date().toISOString(),
|
|
77
|
-
};
|
|
78
|
-
await writeFile(statePath, `${JSON.stringify(state, null, 2)}\n`, { mode: 0o600 });
|
|
79
|
-
await chmod(statePath, 0o600);
|
|
80
|
-
|
|
81
|
-
return {
|
|
82
|
-
target: "vps",
|
|
83
|
-
runtime: "container",
|
|
84
|
-
host: options.host,
|
|
85
|
-
buildDir,
|
|
86
|
-
composePath,
|
|
87
|
-
envExamplePath,
|
|
88
|
-
secretsPath,
|
|
89
|
-
handoffPath,
|
|
90
|
-
statePath,
|
|
91
|
-
commands: [
|
|
92
|
-
`cp ${envExamplePath} ${envPath}`,
|
|
93
|
-
`docker compose -f ${composePath} --env-file ${envPath} config`,
|
|
94
|
-
`docker compose -f ${composePath} --env-file ${envPath} up -d --build`,
|
|
95
|
-
`curl -fsS https://${options.host}/health`,
|
|
96
|
-
`curl -fsS -H "Authorization: Bearer $AGENTKIT_PRIVATE_TOKEN" https://${options.host}/_agentkit`,
|
|
97
|
-
],
|
|
98
|
-
};
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
function renderCompose(agentName: string): string {
|
|
102
|
-
return `services:
|
|
103
|
-
agent:
|
|
104
|
-
build:
|
|
105
|
-
context: ../container
|
|
106
|
-
image: agentkit-${slugify(agentName)}:latest
|
|
107
|
-
restart: unless-stopped
|
|
108
|
-
env_file:
|
|
109
|
-
- .env.production
|
|
110
|
-
environment:
|
|
111
|
-
HOST: 0.0.0.0
|
|
112
|
-
PORT: 4123
|
|
113
|
-
AGENTKIT_SQLITE_PATH: /data/agentkit.db
|
|
114
|
-
ports:
|
|
115
|
-
- "\${AGENTKIT_PORT:-4123}:4123"
|
|
116
|
-
volumes:
|
|
117
|
-
- ../../..:/capsule
|
|
118
|
-
- agentkit_data:/data
|
|
119
|
-
- agentkit_files:/capsule/.agentkit/files
|
|
120
|
-
healthcheck:
|
|
121
|
-
test: ["CMD", "node", "-e", "fetch('http://127.0.0.1:4123/health').then((r)=>process.exit(r.ok?0:1)).catch(()=>process.exit(1))"]
|
|
122
|
-
interval: 30s
|
|
123
|
-
timeout: 5s
|
|
124
|
-
retries: 3
|
|
125
|
-
start_period: 10s
|
|
126
|
-
|
|
127
|
-
volumes:
|
|
128
|
-
agentkit_data:
|
|
129
|
-
agentkit_files:
|
|
130
|
-
`;
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
function renderEnvExample(secrets: string[]): string {
|
|
134
|
-
const secretLines = secrets.map((name) => `${name}=`).join("\n");
|
|
135
|
-
return `# Copy to .env.production on the VPS and fill values there.
|
|
136
|
-
AGENTKIT_PORT=4123
|
|
137
|
-
AGENTKIT_CAPSULE_ROOT=/capsule
|
|
138
|
-
AGENTKIT_SQLITE_PATH=/data/agentkit.db
|
|
139
|
-
${secretLines ? `\n${secretLines}\n` : ""}
|
|
140
|
-
`;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
function renderSecretsChecklist(secrets: string[]): string {
|
|
144
|
-
const lines = secrets.length > 0 ? secrets.map((name) => `- [ ] ${name}`).join("\n") : "- No production secrets required for the current manifest.";
|
|
145
|
-
return `# VPS Secret Checklist
|
|
146
|
-
|
|
147
|
-
Fill these names in .env.production on the host. Do not commit secret values.
|
|
148
|
-
|
|
149
|
-
${lines}
|
|
150
|
-
`;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
function renderProductionHandoff(host: string, agentName: string, accessMode: "private" | "token" | "public"): string {
|
|
154
|
-
return `# VPS Production Handoff
|
|
155
|
-
|
|
156
|
-
## Deploy
|
|
157
|
-
|
|
158
|
-
1. Copy .agentkit/build/vps to the VPS or run these commands from the capsule root on the VPS.
|
|
159
|
-
2. Copy .agentkit/build/vps/.env.production.example to .agentkit/build/vps/.env.production and fill secret values on the host.
|
|
160
|
-
3. Run:
|
|
161
|
-
|
|
162
|
-
\`\`\`sh
|
|
163
|
-
docker compose -f .agentkit/build/vps/compose.yaml --env-file .agentkit/build/vps/.env.production config
|
|
164
|
-
docker compose -f .agentkit/build/vps/compose.yaml --env-file .agentkit/build/vps/.env.production up -d --build
|
|
165
|
-
\`\`\`
|
|
166
|
-
|
|
167
|
-
## Ports And Reverse Proxy
|
|
168
|
-
|
|
169
|
-
- Container port: 4123.
|
|
170
|
-
- Host port: AGENTKIT_PORT, default 4123.
|
|
171
|
-
- Put nginx, Caddy, Traefik, or your VPS proxy in front of http://127.0.0.1:4123 for https://${host}.
|
|
172
|
-
|
|
173
|
-
## Smoke
|
|
174
|
-
|
|
175
|
-
\`\`\`sh
|
|
176
|
-
curl -fsS https://${host}/health
|
|
177
|
-
curl -fsS -H "Authorization: Bearer $AGENTKIT_PRIVATE_TOKEN" https://${host}/_agentkit
|
|
178
|
-
curl -fsS -X POST https://${host}/chat \\
|
|
179
|
-
-H 'content-type: application/json'${renderChatAuthHeader(accessMode)} \\
|
|
180
|
-
-d '{"message":{"role":"user","content":"hello"}}'
|
|
181
|
-
\`\`\`
|
|
182
|
-
|
|
183
|
-
Set AGENTKIT_PRIVATE_TOKEN for privileged AgentKit endpoints. Chat access follows access.mode: ${accessMode}.
|
|
184
|
-
|
|
185
|
-
## Database
|
|
186
|
-
|
|
187
|
-
- Default database: SQLite at /data/agentkit.db in the agentkit_data volume.
|
|
188
|
-
- Backup: snapshot the agentkit_data Docker volume or copy /data/agentkit.db after stopping the container.
|
|
189
|
-
- Postgres upgrade path: set a managed DATABASE_URL in .env.production after the container runtime grows the Postgres store.
|
|
190
|
-
|
|
191
|
-
## Files
|
|
192
|
-
|
|
193
|
-
- Local files persist in the agentkit_files volume mounted at /capsule/.agentkit/files.
|
|
194
|
-
|
|
195
|
-
## Rollback
|
|
196
|
-
|
|
197
|
-
\`\`\`sh
|
|
198
|
-
docker compose -f .agentkit/build/vps/compose.yaml --env-file .agentkit/build/vps/.env.production down
|
|
199
|
-
docker image ls 'agentkit-${slugify(agentName)}'
|
|
200
|
-
docker compose -f .agentkit/build/vps/compose.yaml --env-file .agentkit/build/vps/.env.production up -d --no-build
|
|
201
|
-
\`\`\`
|
|
202
|
-
`;
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
function renderChatAuthHeader(accessMode: "private" | "token" | "public"): string {
|
|
206
|
-
if (accessMode === "public") {
|
|
207
|
-
return "";
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
const secretName = accessMode === "private" ? "AGENTKIT_PRIVATE_TOKEN" : "AGENTKIT_ACCESS_TOKEN";
|
|
211
|
-
return ` \\
|
|
212
|
-
-H "Authorization: Bearer $${secretName}"`;
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
function slugify(value: string): string {
|
|
216
|
-
const slug = value
|
|
217
|
-
.toLowerCase()
|
|
218
|
-
.replace(/[^a-z0-9-]+/g, "-")
|
|
219
|
-
.replace(/^-+|-+$/g, "")
|
|
220
|
-
.slice(0, 48);
|
|
221
|
-
|
|
222
|
-
return slug || "agent";
|
|
223
|
-
}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: agentkit-deploy
|
|
3
|
-
description: Use when preparing or running AgentKit hosted deploys, deploy readiness checks, managed secrets, deploy smoke tests, hosted chat UI checks, access tokens, or production handoff.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# AgentKit Deploy
|
|
7
|
-
|
|
8
|
-
Use this when the owner asks to prepare, test, or run hosted deploy.
|
|
9
|
-
|
|
10
|
-
## Rules
|
|
11
|
-
|
|
12
|
-
- The user should not choose hosting infrastructure. AgentKit owns target routing.
|
|
13
|
-
- Keep production secret values out of the capsule.
|
|
14
|
-
- Use hosted managed secrets, not committed `.env`.
|
|
15
|
-
- Run readiness checks before saying deploy-ready.
|
|
16
|
-
|
|
17
|
-
## Local Readiness
|
|
18
|
-
|
|
19
|
-
```sh
|
|
20
|
-
npm run typecheck
|
|
21
|
-
npm run agentkit -- skills status
|
|
22
|
-
npm run agentkit -- inspect
|
|
23
|
-
npm run agentkit -- db migrate
|
|
24
|
-
npm run chat -- --message "hello"
|
|
25
|
-
npm run agentkit -- deploy --dry-run
|
|
26
|
-
npm run agentkit -- deploy doctor
|
|
27
|
-
```
|
|
28
|
-
|
|
29
|
-
If this deploy fixes production behavior, replay the collected evidence first:
|
|
30
|
-
|
|
31
|
-
```sh
|
|
32
|
-
npm run agentkit -- replay .agentkit/improve/<run> --against local
|
|
33
|
-
```
|
|
34
|
-
|
|
35
|
-
## Hosted Flow
|
|
36
|
-
|
|
37
|
-
```sh
|
|
38
|
-
npm run agentkit -- login --token agk_user_...
|
|
39
|
-
npm run agentkit -- secret sync --from-local
|
|
40
|
-
npm run agentkit -- secret list
|
|
41
|
-
npm run agentkit -- deploy --smoke "hello"
|
|
42
|
-
npm run agentkit -- deploy status
|
|
43
|
-
npm run agentkit -- chat-ui --deploy
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
Open the printed `Chat:` URL and report it to the owner.
|
|
47
|
-
|
|
48
|
-
## Production Handoff
|
|
49
|
-
|
|
50
|
-
`npm run agentkit -- deploy` prints a production handoff after a successful deploy. Use it as the source of truth for the deploy URL, UI command, secret status, database/schema artifact, integration connect commands, smoke status, and next recommended command.
|
|
51
|
-
|
|
52
|
-
Report changed files, required env/secret names, database schema changes, deploy order, smoke checks, rollback concerns, and whether the provider was still `test/fake`.
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: agentkit-integrations
|
|
3
|
-
description: Use when adding, inspecting, connecting, or troubleshooting AgentKit-managed integrations such as managed Composio in an Agent Capsule.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# AgentKit Integrations
|
|
7
|
-
|
|
8
|
-
Use this when the owner asks for managed connected apps, Gmail/Calendar/Slack/Linear through AgentKit, or paid AgentKit-managed Composio.
|
|
9
|
-
|
|
10
|
-
## Managed Composio
|
|
11
|
-
|
|
12
|
-
Managed Composio is a paid hosted AgentKit feature. Use it when the owner wants AgentKit to manage OAuth/connect links, per-agent connected app state, deploy readiness, and hosted Composio credentials.
|
|
13
|
-
|
|
14
|
-
Use BYO `defineTool` instead when the owner wants to bring their own Composio account/API key.
|
|
15
|
-
|
|
16
|
-
## Config
|
|
17
|
-
|
|
18
|
-
Edit `agentkit.config.ts`:
|
|
19
|
-
|
|
20
|
-
```ts
|
|
21
|
-
import { composioManaged, defineAgent } from "@andreprado/agentkit";
|
|
22
|
-
|
|
23
|
-
export default defineAgent({
|
|
24
|
-
integrations: [
|
|
25
|
-
composioManaged({
|
|
26
|
-
toolkits: ["gmail", "googlecalendar"],
|
|
27
|
-
tools: {
|
|
28
|
-
gmail: ["GMAIL_FETCH_EMAILS", "GMAIL_SEND_EMAIL"],
|
|
29
|
-
googlecalendar: [
|
|
30
|
-
"GOOGLECALENDAR_EVENTS_LIST",
|
|
31
|
-
"GOOGLECALENDAR_CREATE_EVENT",
|
|
32
|
-
"GOOGLECALENDAR_UPDATE_EVENT",
|
|
33
|
-
],
|
|
34
|
-
},
|
|
35
|
-
confirmExternalWrites: true,
|
|
36
|
-
}),
|
|
37
|
-
],
|
|
38
|
-
});
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
Keep the action list explicit. Do not expose the whole Composio catalog by default.
|
|
42
|
-
|
|
43
|
-
For Google Calendar, do not configure create-only access. Include `GOOGLECALENDAR_EVENTS_LIST` so the agent can inspect availability before writing. For `GOOGLECALENDAR_CREATE_EVENT`, pass UTC `start_datetime` and explicit `event_duration_minutes` or `event_duration_hour`; AgentKit blocks Composio's implicit 30-minute duration default.
|
|
44
|
-
|
|
45
|
-
An integration that allows managed Composio write actions is operator-only. AgentKit blocks its generated tool during model-driven chat, channel, and eval runs. Review the exact action, invoke it directly with `agentkit tool`, and pass `confirmed: true` for writes. `confirmExternalWrites: false` disables only that secondary input check, not the operator-only permission boundary.
|
|
46
|
-
|
|
47
|
-
## Testability
|
|
48
|
-
|
|
49
|
-
Do not rely on the real connected app for ordinary evals. When adding an integration, also add deterministic coverage for:
|
|
50
|
-
|
|
51
|
-
- the safe path, such as free/busy before calendar create;
|
|
52
|
-
- missing confirmation before an external write;
|
|
53
|
-
- provider errors such as 429, timeout, missing auth, empty result, or unavailable slot;
|
|
54
|
-
- privacy rules, such as not showing a full calendar or raw provider payload to the client;
|
|
55
|
-
- payload invariants, such as timezone conversion, duration, recipients, or record ids.
|
|
56
|
-
|
|
57
|
-
Use eval-safe branches inside capsule tools, local fixtures, or `test/fake` behavior when the hosted integration cannot run locally without touching the real provider.
|
|
58
|
-
|
|
59
|
-
## Commands
|
|
60
|
-
|
|
61
|
-
```sh
|
|
62
|
-
npm run agentkit -- inspect
|
|
63
|
-
npm run agentkit -- deploy doctor
|
|
64
|
-
npm run agentkit -- deploy
|
|
65
|
-
npm run agentkit -- integrations status --toolkit googlecalendar
|
|
66
|
-
npm run agentkit -- integrations connect composio --toolkit gmail
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
`integrations connect composio` requires a hosted deploy because the connect link is deploy-scoped. After declaring `composioManaged(...)`, tell the owner the sequence is:
|
|
70
|
-
|
|
71
|
-
```sh
|
|
72
|
-
npm run agentkit -- deploy doctor
|
|
73
|
-
npm run agentkit -- deploy
|
|
74
|
-
npm run agentkit -- integrations connect composio --toolkit googlecalendar
|
|
75
|
-
```
|
|
76
|
-
|
|
77
|
-
The deploy handoff prints the connect command for each configured toolkit.
|
|
78
|
-
|
|
79
|
-
## Rules
|
|
80
|
-
|
|
81
|
-
- Do not add `COMPOSIO_API_KEY` to `.env.schema` for managed Composio.
|
|
82
|
-
- Do not ask the owner for a Composio key when using managed Composio.
|
|
83
|
-
- Do not ask the owner for Composio auth config ids; AgentKit Cloud resolves toolkit auth configs.
|
|
84
|
-
- Managed Composio requires a non-anonymous hosted deploy and `managed_composio` entitlement.
|
|
85
|
-
- The generated tool is `agentkit_composio_execute`.
|
|
86
|
-
- Use one Composio settings profile per agent.
|
|
87
|
-
|
|
88
|
-
## Verification
|
|
89
|
-
|
|
90
|
-
Expected `inspect` output includes:
|
|
91
|
-
|
|
92
|
-
```txt
|
|
93
|
-
integrations[0].provider = composio
|
|
94
|
-
tools includes agentkit_composio_execute
|
|
95
|
-
managedSecrets includes COMPOSIO_API_KEY
|
|
96
|
-
```
|
|
97
|
-
|
|
98
|
-
If `deploy doctor` reports `managed_composio_entitlement_required`, the owner must log in with a paid AgentKit Cloud account or ask an operator to grant it.
|