@andreprado/agentkit 0.1.0-alpha.9 → 0.1.1

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.
Files changed (122) hide show
  1. package/README.md +18 -1
  2. package/docs/guides/add-channel.md +251 -7
  3. package/docs/guides/add-knowledge.md +10 -0
  4. package/docs/guides/add-managed-composio.md +165 -0
  5. package/docs/guides/add-tool.md +10 -3
  6. package/docs/guides/channel-security.md +162 -32
  7. package/docs/guides/connect-discord.md +178 -0
  8. package/docs/guides/connect-slack.md +126 -0
  9. package/docs/guides/connect-telegram.md +61 -1
  10. package/docs/guides/connect-whatsapp-evolution.md +121 -0
  11. package/docs/guides/connect-whatsapp-uazapi.md +139 -0
  12. package/docs/guides/connect-whatsapp-zapster.md +119 -16
  13. package/docs/guides/create-agent.md +31 -4
  14. package/docs/guides/debug-channel.md +159 -0
  15. package/docs/guides/improve-from-production.md +151 -0
  16. package/docs/guides/prepare-deploy.md +32 -14
  17. package/docs/guides/replay-production-traces.md +72 -0
  18. package/docs/guides/run-evals.md +95 -25
  19. package/docs/guides/security-rules.md +9 -5
  20. package/docs/guides/send-feedback.md +135 -0
  21. package/docs/guides/use-jev.md +67 -0
  22. package/docs/guides/use-provider.md +70 -3
  23. package/docs/llms-full.txt +295 -25
  24. package/docs/llms.txt +54 -7
  25. package/package.json +3 -7
  26. package/src/cli/args.ts +23 -2
  27. package/src/cli/cloud-client.ts +121 -9
  28. package/src/cli/commands/channels.ts +856 -36
  29. package/src/cli/commands/feedback.ts +438 -0
  30. package/src/cli/commands/provider.ts +47 -0
  31. package/src/cli/commands/transcribe.ts +171 -0
  32. package/src/cli/deploy-chat-ui.ts +232 -18
  33. package/src/cli/deploy-readiness.ts +227 -14
  34. package/src/cli/help.ts +67 -9
  35. package/src/cli/index.ts +740 -35
  36. package/src/cli/new-command.ts +41 -0
  37. package/src/cloud/client.ts +4 -3
  38. package/src/cloud/contracts.ts +1 -1
  39. package/src/create-project.ts +18 -35
  40. package/src/index.ts +565 -11
  41. package/src/providers/codex-auth.ts +111 -0
  42. package/src/providers/pi.ts +88 -19
  43. package/src/providers/test.ts +36 -0
  44. package/src/providers/types.ts +8 -0
  45. package/src/runtime/channel-test-harness.ts +21 -1
  46. package/src/runtime/channels/discord.ts +904 -0
  47. package/src/runtime/channels/generic-webhook.ts +682 -0
  48. package/src/runtime/channels/net-guard.ts +480 -0
  49. package/src/runtime/channels/provider-fetch.ts +54 -0
  50. package/src/runtime/channels/slack.ts +652 -0
  51. package/src/runtime/channels/telegram.ts +379 -15
  52. package/src/runtime/channels/whatsapp-evolution.ts +1330 -0
  53. package/src/runtime/channels/whatsapp-meta.ts +9 -0
  54. package/src/runtime/channels/whatsapp-uazapi.ts +1192 -0
  55. package/src/runtime/channels/whatsapp-zapster.ts +702 -40
  56. package/src/runtime/channels.ts +83 -3
  57. package/src/runtime/chat.ts +70 -44
  58. package/src/runtime/config.ts +512 -20
  59. package/src/runtime/core/manifest.ts +75 -5
  60. package/src/runtime/core/targets.ts +5 -5
  61. package/src/runtime/deploy-readiness.ts +34 -4
  62. package/src/runtime/dev-server.ts +639 -39
  63. package/src/runtime/env.ts +8 -3
  64. package/src/runtime/evals.ts +445 -74
  65. package/src/runtime/improve.ts +868 -0
  66. package/src/runtime/inspect.ts +173 -4
  67. package/src/runtime/integrations/composio.ts +425 -0
  68. package/src/runtime/knowledge/embeddings.ts +45 -7
  69. package/src/runtime/knowledge/ingest.ts +69 -6
  70. package/src/runtime/knowledge/retrieve.ts +25 -5
  71. package/src/runtime/knowledge/schema.ts +45 -1
  72. package/src/runtime/knowledge/vector.ts +30 -30
  73. package/src/runtime/prompt-context.ts +141 -0
  74. package/src/runtime/runtime-contract.ts +71 -7
  75. package/src/runtime/skills.ts +95 -0
  76. package/src/runtime/targets/cloudflare/build.ts +1010 -208
  77. package/src/runtime/targets/container/server.ts +1 -1
  78. package/src/runtime/targets/vps/deploy.ts +26 -9
  79. package/src/runtime/tool-runner.ts +9 -1
  80. package/src/runtime/tools.ts +26 -2
  81. package/src/runtime/transcription.ts +483 -0
  82. package/src/storage/sqlite.ts +7 -2
  83. package/src/templates/blank.ts +37 -9
  84. package/src/templates/dentista.ts +40 -14
  85. package/src/templates/skills/agentkit-build-agent/SKILL.md +34 -5
  86. package/src/templates/skills/agentkit-build-agent/templates/appointment-intake.instructions.md +2 -1
  87. package/src/templates/skills/agentkit-capsule/SKILL.md +32 -3
  88. package/src/templates/skills/agentkit-capsule/references/docs-router.md +2 -2
  89. package/src/templates/skills/agentkit-channels/SKILL.md +66 -1
  90. package/src/templates/skills/agentkit-channels/references/channel-buffering.md +8 -1
  91. package/src/templates/skills/agentkit-channels/references/channel-debugging.md +28 -3
  92. package/src/templates/skills/agentkit-channels/references/discord.md +93 -0
  93. package/src/templates/skills/agentkit-channels/references/slack.md +56 -0
  94. package/src/templates/skills/agentkit-channels/references/telegram.md +34 -0
  95. package/src/templates/skills/agentkit-channels/references/whatsapp-evolution.md +57 -0
  96. package/src/templates/skills/agentkit-channels/references/whatsapp-uazapi.md +54 -0
  97. package/src/templates/skills/agentkit-channels/references/whatsapp-zapster.md +42 -8
  98. package/src/templates/skills/agentkit-database/SKILL.md +11 -0
  99. package/src/templates/skills/agentkit-deploy/SKILL.md +9 -1
  100. package/src/templates/skills/agentkit-evals/SKILL.md +77 -13
  101. package/src/templates/skills/agentkit-evals/templates/multi-turn.eval.md +13 -6
  102. package/src/templates/skills/agentkit-evals/templates/no-leak.eval.md +8 -4
  103. package/src/templates/skills/agentkit-evals/templates/smoke.eval.md +8 -4
  104. package/src/templates/skills/agentkit-evals/templates/tool-call.eval.md +16 -7
  105. package/src/templates/skills/agentkit-improve/SKILL.md +96 -0
  106. package/src/templates/skills/agentkit-improve/references/replay-side-effects.md +18 -0
  107. package/src/templates/skills/agentkit-improve/references/trace-packets.md +22 -0
  108. package/src/templates/skills/agentkit-improve/templates/regression.eval.md +18 -0
  109. package/src/templates/skills/agentkit-integrations/SKILL.md +98 -0
  110. package/src/templates/skills/agentkit-knowledge/SKILL.md +4 -1
  111. package/src/templates/skills/agentkit-prompts/SKILL.md +3 -1
  112. package/src/templates/skills/agentkit-provider/SKILL.md +29 -4
  113. package/src/templates/skills/agentkit-security/SKILL.md +5 -2
  114. package/src/templates/skills/agentkit-tools/SKILL.md +8 -1
  115. package/src/templates/skills/agentkit-tools/examples/eval-safe-external-action.tool.md +8 -8
  116. package/src/templates/skills/agentkit-tools/examples/jev-service-fit.tool.md +110 -0
  117. package/src/templates/skills/agentkit-troubleshooting/SKILL.md +25 -1
  118. package/src/templates/support.ts +42 -12
  119. package/docs/guides/agentkit-skills-architecture.md +0 -471
  120. package/docs/guides/channels-implementation-map.md +0 -243
  121. package/docs/guides/channels-production-handoff.md +0 -101
  122. package/docs/portable-deploy-release-checklist.md +0 -41
@@ -89,19 +89,23 @@ defineTool({
89
89
 
90
90
  ## Safety Rules
91
91
 
92
+ - An Agent Capsule is executable TypeScript. Run AgentKit commands only in Capsules whose config, tools, evals, and sync code you trust; AgentKit does not sandbox Capsule code from the local filesystem, network, or process environment.
92
93
  - `.env` is local-only.
93
94
  - `.env.schema` is the committed contract for local secret names.
94
95
  - AgentKit local commands load `.env` directly so inspect, chat, tools, and evals share the same secret loader.
95
96
  - Production uses managed secrets.
96
- - Hosted alpha deploys require `cloudflare_deploy_alpha`; local commands do not require login.
97
+ - Hosted deploys require `cloudflare_deploy_alpha` or purchased/manual deploy slots; local commands do not require login.
97
98
  - Secret values must not appear in config, docs, prompts, evals, logs, exports, or SQLite.
98
99
  - A tool receives only secrets listed in that tool.
99
100
  - Avoid direct `process.env` reads inside tools.
100
101
  - Use `permissions` to describe external capabilities.
102
+ - Permissions ending in `:read` may run from chat, channels, and evals. Any other declared permission is operator-only and must be invoked directly with `agentkit tool <name> --input '<json>'` after reviewing the exact action.
103
+ - Local dev access accepts only loopback Host/Origin values and limits JSON and webhook bodies to 1 MiB. Keep public tunnels behind authenticated access instead of weakening these checks.
101
104
  - Add timeouts to network tools.
102
- - Treat public deploy URLs as unauthenticated transport, not access control.
103
- - Use access tokens and limits for clients.
105
+ - Treat hosted deploy URLs as addresses, not access control.
106
+ - Use deploy access tokens for hosted chat, hosted conversation reads, hosted trace reads, and any client app that talks to AgentKit Cloud.
104
107
  - Remove client PII before writing evals.
108
+ - 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
109
 
106
110
  ## Verification
107
111
 
@@ -132,9 +136,9 @@ Add the secret name to the tool `secrets` field and set it locally:
132
136
  npm run agentkit -- inspect
133
137
  ```
134
138
 
135
- Public URL is reachable:
139
+ Hosted URL is reachable without a token:
136
140
 
137
- Check hosted access mode. Default should be `private`.
141
+ Treat this as a security bug. Hosted AgentKit Cloud routes should reject missing deploy tokens except authenticated channel webhook ingress.
138
142
 
139
143
  ## Backend Contracts Used
140
144
 
@@ -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.
@@ -0,0 +1,67 @@
1
+ # Use Jev In A Capsule Tool
2
+
3
+ Use this when the owner asks their coding agent (Codex, Claude Code, or another agent) to build a capsule capability with TypeSafe/Jev, such as qualifying leads, ranking candidates, selecting a handler, or checking evidence.
4
+
5
+ Implement the requested behavior through the existing `defineTool` contract. Jev supplies typed judgments inside the tool; the capsule's conversational provider continues through AgentKit. Keep questions and business criteria in the tool code, shaped by the owner's brief. No special AgentKit provider, runtime hook, or globally enabled Jev tool is needed.
6
+
7
+ ## Read The Relevant TypeSafe Guidance
8
+
9
+ Read the live [TypeSafe docs index](https://docs.typesafe.ai/llms.txt), [building guide](https://docs.typesafe.ai/concepts/how-to-build-with-system-one), and the relevant primitive before designing the judgment:
10
+
11
+ - [Choice](https://docs.typesafe.ai/primitives/choice): select from defined alternatives; include “none” or “insufficient evidence” when appropriate.
12
+ - [Noul](https://docs.typesafe.ai/primitives/noul): estimate the probability of a yes/no condition. It has no separate confidence field.
13
+ - [Score](https://docs.typesafe.ai/primitives/score): rate along concrete ordered levels.
14
+
15
+ Use the closest cookbook from the index for the requested workflow. If the official `typesafe-ai` skill is installed, use it; it is optional and this workflow does not depend on a personal skill or helper being present. Check the current [HTTP contract](https://docs.typesafe.ai/api) when using the example, or the [JavaScript SDK](https://docs.typesafe.ai/sdk/javascript) if the capsule already uses it. Verify SDK compatibility with the capsule's deploy target before adding a dependency.
16
+
17
+ ## Build The Requested Capability
18
+
19
+ 1. Inspect the capsule's tools, config, prompts, and evals. Reuse an existing domain tool when Jev belongs inside its workflow.
20
+ 2. Adapt `skills/agentkit-tools/examples/jev-service-fit.tool.md` into `tools/<name>.ts`. The example uses native `fetch`, so no TypeSafe package is required. Register the export in the existing `agentkit.config.ts` tools array without replacing other config.
21
+ 3. Define narrow questions against relevant state: the client's request, available candidates, service definitions, or supporting evidence. Question IDs are only lookup keys; include the question's meaning in its instructions. Batch independent questions over the same state; sequence calls only when a later question needs an earlier result.
22
+ 4. Keep exact calculations, lookups, permission checks, and execution in code. Jev's output is evidence for a decision, never authorization for an external action. Preserve any existing tool permission requirements.
23
+ 5. Update `prompts/instructions.md` with when to call the tool and how to handle uncertain results or service failures. For the example, assess service fit before recommending the website service; ask for clarification when evidence is ambiguous, and do not treat a fit score as a quote, booking, or approval.
24
+ 6. Add deterministic checks and a persisted tool-call eval. Test the owner's actual criteria separately with labeled examples before choosing operational thresholds. [Confidence](https://docs.typesafe.ai/confidence) measures distribution concentration, not guaranteed correctness; a Noul near 0.5 represents uncertainty about yes/no, not medium intensity.
25
+
26
+ ## Secrets And External Data
27
+
28
+ Declare `TYPESAFE_API_KEY` in the tool's `secrets` array and add the name with an empty value to `.env.schema`:
29
+
30
+ ```dotenv
31
+ TYPESAFE_API_KEY=
32
+ ```
33
+
34
+ Set the real value through the local secret prompt:
35
+
36
+ ```sh
37
+ npm run agentkit -- env set TYPESAFE_API_KEY
38
+ ```
39
+
40
+ Read it only from `ctx.secrets.TYPESAFE_API_KEY` inside the tool. For a hosted capsule, follow [Prepare Deploy](prepare-deploy.md) and upload the key through managed secrets:
41
+
42
+ ```sh
43
+ npm run agentkit -- secret set TYPESAFE_API_KEY --from-local-env
44
+ ```
45
+
46
+ Send only the state needed for the judgment. Tool inputs and outputs are recorded, so avoid secrets, unnecessary client identifiers, and full conversation histories. Do not echo upstream response bodies or headers in errors. Forward `ctx.signal`, set a tool timeout, and validate returned values before using them. A timeout, 429, invalid response, or missing key must remain an explicit failure or a deliberately designed fallback; never turn it into a successful judgment.
47
+
48
+ ## Verify
49
+
50
+ The bundled example includes a fixture eval. In an isolated offline test capsule, supply a non-secret dummy `TYPESAFE_API_KEY`: AgentKit resolves declared secrets before entering the tool, even for eval fixtures. The fixture branch runs only in `eval` or `test`; `test/fake` as the conversational provider alone does not prevent live tool calls. Never upload a dummy key to a hosted capsule or substitute fixtures for production failures.
51
+
52
+ ```sh
53
+ npm run typecheck
54
+ npm run eval
55
+ npm run agentkit -- inspect
56
+ ```
57
+
58
+ For a live check with the real key, use synthetic data:
59
+
60
+ ```sh
61
+ npm run agentkit -- tool assess_service_fit --input '{"message":"I need a website for my bakery."}'
62
+ npm run agentkit -- conversations list
63
+ ```
64
+
65
+ Expect a probability between 0 and 1 and `evalFixture: false`; inspect the recorded call without exposing the key. The fixture verifies wiring, not Jev's accuracy. Also test invalid inputs, unavailable service, malformed responses, and cancellation with mocked HTTP responses. Measure actual quality, latency, and cost before expanding usage.
66
+
67
+ New capsules receive the example automatically. Existing capsules can update AgentKit and run `npm run agentkit -- skills sync` to refresh bundled skills; preserve any local skill edits before syncing.
@@ -6,7 +6,7 @@ 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 OpenRouter, OpenAI, Anthropic, or another supported provider.
9
+ Use this when local fake responses are no longer enough and the agent needs model behavior from OpenRouter, OpenAI, Anthropic, OpenCode Zen, OpenCode Go, or another supported provider.
10
10
 
11
11
  The coding agent should not choose a real provider automatically. Ask the owner which provider to use, then update the capsule.
12
12
 
@@ -21,6 +21,14 @@ npm run chat -- --message "hello"
21
21
  npm run agentkit -- inspect
22
22
  ```
23
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
+
24
32
  ## Files Created Or Edited
25
33
 
26
34
  Edit:
@@ -33,6 +41,39 @@ agentkit.config.ts
33
41
 
34
42
  Use `.env.schema` as the committed contract for required names. Keep `.env` local and ignored.
35
43
 
44
+ ## ChatGPT / Codex Login (Local)
45
+
46
+ To use the Codex subscription login instead of an OpenAI API key:
47
+
48
+ ```sh
49
+ npm run agentkit -- provider login openai-codex
50
+ ```
51
+
52
+ Run this in an interactive terminal, open the printed URL, and sign in with ChatGPT. If the browser callback cannot reach the terminal, paste the redirect URL into the prompt. This uses Pi's Codex OAuth flow and creates an AgentKit session; it does not read or change the Codex app/CLI credential cache.
53
+
54
+ Configure the capsule:
55
+
56
+ ```ts
57
+ provider: { name: "openai-codex", model: "gpt-5.4" },
58
+ secrets: [], // Keep any secrets required by your tools or other services.
59
+ ```
60
+
61
+ Use a model supported by the installed Pi SDK for `openai-codex`. Remove `OPENAI_API_KEY` from `secrets` and `.env.schema` only if no other capability (such as embeddings or transcription) needs it. No provider key or OAuth token belongs in `.env` or capsule files for this login.
62
+
63
+ ```sh
64
+ npm run agentkit -- provider status openai-codex
65
+ npm run chat -- --message "hello"
66
+ npm run agentkit -- provider logout openai-codex
67
+ ```
68
+
69
+ `status` reports `logged_out`, `logged_in`, or `refresh_required` without token values. It checks the local cache, not account access at OpenAI. Local chat, dev, and eval renew expiring credentials through Pi automatically. Credentials live outside the capsule at `~/.agentkit/providers/openai-codex.json` with owner-only file permissions. The login is shared by local capsules under the same OS user. Logout removes this AgentKit session locally; it does not revoke the session at OpenAI or sign out the Codex app.
70
+
71
+ This provider currently supports local execution only. Cloudflare, container, and VPS builds reject it with `target_runtime_incompatible`; choose an API-key provider and managed secrets for deployment. AgentKit never uploads the local OAuth session or falls back to API-key billing.
72
+
73
+ If refresh fails, rerun login. If `provider_auth_busy` persists after a crashed process, stop AgentKit processes before removing the `.lock` directory next to the credential file, then retry.
74
+
75
+ OpenAI documents subscription sign-in and API-key billing as separate authentication methods: [Codex authentication](https://learn.chatgpt.com/docs/auth).
76
+
36
77
  ## Minimal Working Example
37
78
 
38
79
  OpenAI:
@@ -77,6 +118,32 @@ provider: {
77
118
  secrets: ["OPENROUTER_API_KEY"],
78
119
  ```
79
120
 
121
+ 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.
122
+
123
+ OpenCode Zen:
124
+
125
+ ```ts
126
+ provider: {
127
+ name: "opencode",
128
+ model: "big-pickle",
129
+ },
130
+ secrets: ["OPENCODE_API_KEY"],
131
+ ```
132
+
133
+ Use an OpenCode Zen model id listed by the installed Pi SDK, such as `big-pickle`, `deepseek-v4-flash-free`, `claude-sonnet-4-5`, or `gpt-5.4-mini`. OpenCode Zen uses `OPENCODE_API_KEY`.
134
+
135
+ OpenCode Go:
136
+
137
+ ```ts
138
+ provider: {
139
+ name: "opencode-go",
140
+ model: "deepseek-v4-flash",
141
+ },
142
+ secrets: ["OPENCODE_API_KEY"],
143
+ ```
144
+
145
+ Use an OpenCode Go model id listed by the installed Pi SDK, such as `deepseek-v4-flash`, `deepseek-v4-pro`, `glm-5.1`, `kimi-k2.6`, `minimax-m2.7`, or `qwen3.6-plus`. OpenCode Go also uses `OPENCODE_API_KEY`.
146
+
80
147
  ## UI Verification
81
148
 
82
149
  After the provider is configured and the local secret is set, test through chat and UI:
@@ -109,7 +176,7 @@ npm run chat -- --message "hello"
109
176
 
110
177
  Expected:
111
178
 
112
- - Inspect shows the provider secret as `set`.
179
+ - For API-key providers, inspect shows the provider secret as `set`; for Codex, use `provider status openai-codex`.
113
180
  - Chat returns a real model response.
114
181
  - `.agentkit/agentkit.db` stores messages and usage tokens when Pi returns usage.
115
182
 
@@ -125,7 +192,7 @@ npm run agentkit -- inspect
125
192
 
126
193
  `provider_model_unsupported`:
127
194
 
128
- Use a model id known to the installed Pi SDK for that provider.
195
+ For OpenAI, Anthropic, OpenCode Zen, or OpenCode Go, 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.
129
196
 
130
197
  Provider returns auth failure:
131
198