@andreprado/agentkit 0.1.1 → 0.2.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.
Files changed (95) hide show
  1. package/README.md +8 -77
  2. package/docs/guides/add-channel.md +14 -92
  3. package/docs/guides/add-knowledge.md +0 -21
  4. package/docs/guides/add-tool.md +5 -11
  5. package/docs/guides/channel-security.md +3 -207
  6. package/docs/guides/connect-discord.md +7 -172
  7. package/docs/guides/connect-slack.md +6 -121
  8. package/docs/guides/connect-telegram.md +6 -165
  9. package/docs/guides/connect-whatsapp-evolution.md +6 -116
  10. package/docs/guides/connect-whatsapp-uazapi.md +6 -134
  11. package/docs/guides/connect-whatsapp-zapster.md +6 -202
  12. package/docs/guides/create-agent.md +5 -14
  13. package/docs/guides/debug-channel.md +4 -156
  14. package/docs/guides/improve-local.md +13 -0
  15. package/docs/guides/local-only-migration.md +35 -0
  16. package/docs/guides/replay-local-traces.md +11 -0
  17. package/docs/guides/run-evals.md +2 -4
  18. package/docs/guides/security-rules.md +5 -154
  19. package/docs/guides/use-jev.md +3 -6
  20. package/docs/guides/use-provider.md +0 -3
  21. package/docs/guides/write-feedback.md +10 -0
  22. package/docs/llms-full.txt +27 -448
  23. package/docs/llms.txt +8 -44
  24. package/package.json +2 -4
  25. package/src/cli/commands/channels.ts +8 -1613
  26. package/src/cli/commands/feedback.ts +8 -86
  27. package/src/cli/constants.ts +0 -3
  28. package/src/cli/flags.ts +0 -28
  29. package/src/cli/help.ts +16 -92
  30. package/src/cli/index.ts +15 -1091
  31. package/src/index.ts +6 -158
  32. package/src/providers/pi.ts +2 -0
  33. package/src/runtime/channels/discord.ts +2 -2
  34. package/src/runtime/chat.ts +5 -3
  35. package/src/runtime/config.ts +14 -148
  36. package/src/runtime/database.ts +2 -2
  37. package/src/runtime/dev-server.ts +8 -8
  38. package/src/runtime/env.ts +11 -0
  39. package/src/runtime/improve.ts +2 -262
  40. package/src/runtime/inspect.ts +13 -73
  41. package/src/runtime/knowledge/ingest.ts +1 -1
  42. package/src/runtime/knowledge/tool.ts +16 -2
  43. package/src/runtime/knowledge/vector.ts +1 -1
  44. package/src/runtime/tool-runner.ts +5 -3
  45. package/src/runtime/tools.ts +10 -14
  46. package/src/storage/sqlite.ts +11 -32
  47. package/src/templates/blank.ts +15 -102
  48. package/src/templates/common.ts +60 -0
  49. package/src/templates/dentista.ts +7 -74
  50. package/src/templates/skills/agentkit-capsule/SKILL.md +5 -7
  51. package/src/templates/skills/agentkit-capsule/references/docs-router.md +2 -3
  52. package/src/templates/skills/agentkit-channels/SKILL.md +6 -119
  53. package/src/templates/skills/agentkit-channels/references/channel-buffering.md +0 -9
  54. package/src/templates/skills/agentkit-channels/references/channel-debugging.md +1 -64
  55. package/src/templates/skills/agentkit-channels/references/discord.md +2 -92
  56. package/src/templates/skills/agentkit-channels/references/slack.md +2 -55
  57. package/src/templates/skills/agentkit-channels/references/telegram.md +2 -71
  58. package/src/templates/skills/agentkit-channels/references/whatsapp-evolution.md +2 -56
  59. package/src/templates/skills/agentkit-channels/references/whatsapp-uazapi.md +2 -53
  60. package/src/templates/skills/agentkit-channels/references/whatsapp-zapster.md +2 -70
  61. package/src/templates/skills/agentkit-database/SKILL.md +2 -4
  62. package/src/templates/skills/agentkit-evals/SKILL.md +1 -1
  63. package/src/templates/skills/agentkit-improve/SKILL.md +6 -85
  64. package/src/templates/skills/agentkit-improve/references/trace-packets.md +1 -1
  65. package/src/templates/skills/agentkit-provider/SKILL.md +0 -1
  66. package/src/templates/skills/agentkit-security/SKILL.md +1 -3
  67. package/src/templates/skills/agentkit-tools/SKILL.md +1 -1
  68. package/src/templates/skills/agentkit-tools/examples/database-write.tool.md +1 -2
  69. package/src/templates/skills/agentkit-troubleshooting/SKILL.md +5 -11
  70. package/src/templates/support.ts +8 -92
  71. package/docs/guides/add-managed-composio.md +0 -165
  72. package/docs/guides/improve-from-production.md +0 -151
  73. package/docs/guides/prepare-deploy.md +0 -227
  74. package/docs/guides/replay-production-traces.md +0 -72
  75. package/docs/guides/send-feedback.md +0 -135
  76. package/src/cli/cloud-client.ts +0 -377
  77. package/src/cli/deploy-chat-ui.ts +0 -606
  78. package/src/cli/deploy-readiness.ts +0 -561
  79. package/src/cloud/artifact.ts +0 -139
  80. package/src/cloud/client.ts +0 -80
  81. package/src/cloud/contracts.ts +0 -63
  82. package/src/cloud/index.ts +0 -3
  83. package/src/runtime/build.ts +0 -43
  84. package/src/runtime/core/deploy-state.ts +0 -54
  85. package/src/runtime/core/manifest.ts +0 -283
  86. package/src/runtime/core/targets.ts +0 -133
  87. package/src/runtime/deploy-readiness.ts +0 -135
  88. package/src/runtime/deploy.ts +0 -1
  89. package/src/runtime/integrations/composio.ts +0 -425
  90. package/src/runtime/targets/cloudflare/build.ts +0 -3319
  91. package/src/runtime/targets/container/build.ts +0 -146
  92. package/src/runtime/targets/container/server.ts +0 -33
  93. package/src/runtime/targets/vps/deploy.ts +0 -223
  94. package/src/templates/skills/agentkit-deploy/SKILL.md +0 -52
  95. package/src/templates/skills/agentkit-integrations/SKILL.md +0 -98
@@ -1,127 +1,14 @@
1
1
  ---
2
2
  name: agentkit-channels
3
- description: Use when adding, connecting, testing, buffering, transcribing audio, or debugging AgentKit website, Telegram, WhatsApp, Discord, Slack, or generic webhook channels, including channel config helpers, provider secrets, webhook setup, channel tests, delivery logs, burst-message buffers, and transcription provider secrets.
3
+ description: Configure and debug local AgentKit website, messaging, and webhook channels.
4
4
  ---
5
5
 
6
- # AgentKit Channels
6
+ # Local Channels
7
7
 
8
- Channels receive user messages. Tools let the agent call external systems. Keep them separate.
8
+ Read `docs/guides/add-channel.md` using the root from `agentkit docs path`, then the provider guide. Keep `runtime: "local"`, register the channel helper in config, and put secret names in `.env.schema`. Set values through `agentkit env set <NAME> --stdin`.
9
9
 
10
- ## Workflow
10
+ Run `agentkit inspect`, `agentkit channels list`, and `agentkit dev`. POST authenticated fixtures to the local webhook route and inspect the response and conversation trace. For real provider traffic, configure its webhook manually against an HTTPS tunnel. The local process must remain running. Only authenticated webhook routes accept tunnel hosts.
11
11
 
12
- 1. Add channel helpers in `agentkit.config.ts`.
13
- 2. Keep `runtime: "edge"` and `storage.driver: "agentkit"`.
14
- 3. Deploy before hosted channel creation.
15
- 4. Configure provider secrets as managed secrets.
16
- 5. Connect channel resources through the CLI.
17
- 6. Test, doctor, and inspect delivery logs.
12
+ Keep provider signature checks, query-token secrets, reply routing validation, and SSRF restrictions. Synthetic fixtures do not prove real provider delivery. Use `AGENTKIT_CHANNEL_SEND_DRY_RUN=1` when a test must not contact real recipients. AgentKit does not run a Discord Gateway worker.
18
13
 
19
- ## Audio Transcription
20
-
21
- Enable transcription at the agent level and opt in per channel with `audio.mode: "transcribe"`.
22
-
23
- ```ts
24
- export default defineAgent({
25
- // ...
26
- transcription: {
27
- provider: "groq",
28
- model: "whisper-large-v3-turbo",
29
- secret: "GROQ_API_KEY",
30
- language: "pt",
31
- limits: {
32
- maxDurationSeconds: 180,
33
- maxBytes: 20_000_000,
34
- },
35
- },
36
- channels: [
37
- telegramChannel({
38
- name: "support-telegram",
39
- audio: { mode: "transcribe" },
40
- }),
41
- ],
42
- });
43
- ```
44
-
45
- V1 providers:
46
-
47
- - `openai`: `gpt-4o-mini-transcribe`, `gpt-4o-transcribe`, `whisper-1`; default secret `OPENAI_API_KEY`.
48
- - `groq`: `whisper-large-v3-turbo`, `whisper-large-v3`, `distil-whisper-large-v3-en`; default secret `GROQ_API_KEY`.
49
-
50
- Telegram voice notes are usually OGG/Opus, so use Groq for the default Telegram voice-note path in V1. Zapster audio needs a usable HTTPS Zapster media download URL in the webhook payload; arbitrary hosts are rejected before bearer auth is sent. UAZAPI audio downloads go through UAZAPI `/message/download` with base64 return enabled. Evolution audio downloads go through Evolution API `/chat/getBase64FromMediaMessage/{instance}` with base64 return enabled. Arbitrary UAZAPI and Evolution webhook media hosts are not fetched. Hosted channel creation requires the transcription secret automatically when the channel enables transcription. Webhooks only enqueue audio jobs; download and transcription run in the retryable channel worker before the agent run.
51
-
52
- Discord channels do not support audio in V1.
53
-
54
- ## Buffering
55
-
56
- Enable `buffer.mode: "debounce"` when clients send several short messages in a row and the agent should answer once.
57
-
58
- ```ts
59
- whatsappChannel({
60
- name: "support-whatsapp",
61
- provider: "zapster",
62
- buffer: {
63
- mode: "debounce",
64
- quietWindowMs: 2500,
65
- maxWaitMs: 12000,
66
- maxMessages: 20,
67
- maxChars: 8000,
68
- },
69
- })
70
- ```
71
-
72
- Buffered deliveries show `buffered` until AgentKit flushes the conversation buffer into one queued run.
73
-
74
- ## Commands
75
-
76
- ```sh
77
- npm run agentkit -- inspect
78
- npm run agentkit -- deploy
79
- npm run agentkit -- channels list
80
- npm run agentkit -- channels add website website-chat
81
- npm run agentkit -- channels connect telegram support-telegram
82
- npm run agentkit -- channels add whatsapp support-whatsapp --provider zapster
83
- npm run agentkit -- channels connect whatsapp support-whatsapp --provider uazapi
84
- npm run agentkit -- channels connect whatsapp main-whatsapp --provider evolution
85
- npm run agentkit -- channels connect discord support-discord
86
- npm run agentkit -- channels connect discord server-discord --mode bot
87
- npm run agentkit -- channels connect slack support-slack
88
- npm run agentkit -- channels connect webhook n8n-webhook
89
- npm run agentkit -- channels doctor support-telegram
90
- npm run agentkit -- channels test support-telegram --message "hello"
91
- npm run agentkit -- channels test-audio support-telegram --fixture voice-note
92
- npm run agentkit -- transcribe smoke --provider groq
93
- npm run agentkit -- channels deliveries list support-telegram
94
- ```
95
-
96
- ## References
97
-
98
- - `references/discord.md`
99
- - `references/slack.md`
100
- - `references/telegram.md`
101
- - `references/whatsapp-evolution.md`
102
- - `references/whatsapp-uazapi.md`
103
- - `references/whatsapp-zapster.md`
104
- - `references/channel-buffering.md`
105
- - `references/channel-debugging.md`
106
-
107
- ## Safety
108
-
109
- Do not paste provider tokens into code, docs, fixtures, prompts, evals, or delivery logs. Webhook URLs are public transport endpoints; authenticity comes from provider validation or channel tokens.
110
-
111
- ## Generic Webhooks
112
-
113
- Use `webhookChannel({ name: "n8n-webhook" })` for n8n, Make, Zapier, Pipedream, or custom server events.
114
-
115
- Canonical JSON:
116
-
117
- ```json
118
- {
119
- "event_id": "evt_123",
120
- "external_id": "customer_123",
121
- "message": "hello from n8n"
122
- }
123
- ```
124
-
125
- `event_id` is required for dedupe. `external_id` is recommended for conversation continuity and is hashed before storage. Authenticate with `Authorization: Bearer <AGENTKIT_WEBHOOK_SECRET>`, `X-AgentKit-Webhook-Secret`, or `X-AgentKit-Webhook-Signature: sha256=<hmac of raw JSON body>`.
126
-
127
- Generic webhooks are inbound-only in V1. Add a separate tool if the agent must call back into n8n after it runs.
14
+ Use `docs/guides/debug-channel.md` and `docs/guides/channel-security.md` for diagnosis and trust boundaries. Provider-specific notes live in `references/`.
@@ -42,15 +42,6 @@ Behavior:
42
42
 
43
43
  Debug:
44
44
 
45
- ```sh
46
- agentkit channels buffers list <name>
47
- agentkit channels buffers show <conversation-id>
48
- agentkit channels buffers flush <conversation-id>
49
- agentkit channels buffers clear <conversation-id>
50
- agentkit channels buffers retry <conversation-id>
51
- agentkit channels deliveries list <name>
52
- agentkit channels deliveries show <delivery-id>
53
- ```
54
45
 
55
46
  Expected delivery states:
56
47
 
@@ -1,66 +1,3 @@
1
1
  # Channel Debugging
2
2
 
3
- Start with:
4
-
5
- ```sh
6
- agentkit channels list
7
- agentkit channels status <name>
8
- agentkit channels doctor <name>
9
- agentkit channels test <name> --message "hello"
10
- agentkit channels test-audio <name> --fixture voice-note
11
- agentkit transcribe smoke --provider groq
12
- agentkit channels deliveries list <name> --since 24h
13
- agentkit channels deliveries show <delivery-id>
14
- agentkit channels buffers list <name>
15
- agentkit channels buffers show <conversation-id>
16
- agentkit channels buffers flush <conversation-id>
17
- agentkit channels buffers clear <conversation-id>
18
- agentkit channels buffers retry <conversation-id>
19
- ```
20
-
21
- Common states:
22
-
23
- ```txt
24
- webhook_received
25
- validated
26
- duplicate
27
- audio_received
28
- audio_downloaded
29
- transcribing
30
- transcribed
31
- buffered
32
- queued
33
- running
34
- agent_completed
35
- provider_request_built
36
- provider_sent
37
- adapter_stubbed
38
- delivered
39
- provider_failed
40
- synthetic_expected_failure
41
- dead_lettered
42
- skipped
43
- ```
44
-
45
- Common errors:
46
-
47
- - `channel_not_found`: webhook URL points to an unknown channel. `channels test` is the official synthetic smoke and should resolve the current `.agentkit/deploy.json` channel.
48
- - `channel_secret_missing`: required hosted secret is not set.
49
- - `channel_signature_invalid`: webhook secret, token, origin header, or Discord public key mismatch.
50
- - Discord bot mode with no deliveries: confirm `--mode bot`, `DISCORD_BOT_TOKEN`, Message Content Intent, server install, and channel permissions for View Channel, Read Message History, and Send Messages.
51
- - `channel_payload_invalid`: malformed or unsupported provider payload.
52
- - `channel_event_duplicate`: provider retry; do not create a second run.
53
- - `audio_received`: audio message was accepted and normalized.
54
- - `audio_downloaded`: retryable channel worker downloaded provider media into memory.
55
- - `transcribing`: AgentKit is calling the configured transcription provider.
56
- - `transcribed`: transcript text was queued for the agent.
57
- - `channel_audio_download_unavailable`: provider audio payload did not include a usable download URL, or Zapster sent a non-HTTPS/non-Zapster media host.
58
- - `transcription_secret_missing`: managed transcription secret is missing.
59
- - `transcription_audio_too_large` or `transcription_audio_too_long`: audio exceeded configured limits.
60
- - `transcription_audio_format_unsupported`: provider does not accept this audio MIME type or extension.
61
- - `transcription_provider_unavailable`: retryable transcription provider failure.
62
- - `channel_limit_exceeded`: backpressure skipped the message.
63
- - `synthetic_expected_failure`: a synthetic test reached AgentKit, but the provider correctly rejected a fake test recipient.
64
- - `buffered` delivery state: message is waiting for the channel quiet window or max wait before one coalesced agent run is queued.
65
- - `adapter_stubbed`: adapter completed without calling an outbound provider, either because explicit dry-run mode is enabled or the channel is inbound-only.
66
- - `provider_sent`: the provider accepted the outbound send and returned a provider message ID.
3
+ Read `docs/guides/debug-channel.md` from the root printed by `agentkit docs path`. Configure local secrets and use `agentkit dev` for diagnostics. Provider webhook registration is manual; synthetic checks do not prove real delivery.
@@ -1,93 +1,3 @@
1
- # Discord Channel
1
+ # Discord
2
2
 
3
- Discord supports two modes:
4
-
5
- - `interactions`: slash commands through the Discord Interactions Endpoint URL.
6
- - `bot`: normal server messages through a Discord Bot user and Gateway connection.
7
-
8
- Use bot mode when the owner asks for the agent to answer without slash commands.
9
-
10
- ## Slash Commands
11
-
12
- Required secret:
13
-
14
- ```txt
15
- DISCORD_PUBLIC_KEY
16
- ```
17
-
18
- Config:
19
-
20
- ```ts
21
- discordChannel({ name: "support-discord" })
22
- ```
23
-
24
- Commands:
25
-
26
- ```sh
27
- agentkit deploy
28
- agentkit secret set DISCORD_PUBLIC_KEY --stdin
29
- agentkit channels connect discord support-discord
30
- agentkit channels test support-discord --message "hello"
31
- agentkit channels deliveries list support-discord
32
- ```
33
-
34
- Paste the printed webhook URL into the application's Interactions Endpoint URL. Register a slash command with a string option named `message`, `text`, `prompt`, `question`, `query`, or `input`.
35
-
36
- ## Bot Server Messages
37
-
38
- Required secret:
39
-
40
- ```txt
41
- DISCORD_BOT_TOKEN
42
- ```
43
-
44
- Config:
45
-
46
- ```ts
47
- discordChannel({
48
- name: "server-discord",
49
- mode: "bot",
50
- })
51
- ```
52
-
53
- Commands:
54
-
55
- ```sh
56
- agentkit deploy
57
- agentkit secret set DISCORD_BOT_TOKEN --stdin
58
- agentkit channels connect discord server-discord --mode bot
59
- agentkit channels test server-discord --message "hello"
60
- agentkit channels deliveries list server-discord
61
- ```
62
-
63
- In the Discord Developer Portal, open the Bot page, enable Message Content Intent, install the app into the server, and grant the bot `View Channel`, `Read Message History`, and `Send Messages` in the channels it should answer.
64
-
65
- Bot mode processes every readable non-bot text message Discord sends over the Gateway. Keep server permissions narrow if the agent should answer only in specific channels.
66
-
67
- ## Buffering
68
-
69
- Buffer rapid Discord messages:
70
-
71
- ```ts
72
- discordChannel({
73
- name: "server-discord",
74
- mode: "bot",
75
- buffer: {
76
- mode: "debounce",
77
- quietWindowMs: 1500,
78
- maxWaitMs: 8000,
79
- maxMessages: 20,
80
- maxChars: 8000,
81
- },
82
- })
83
- ```
84
-
85
- ## Runtime Behavior
86
-
87
- Slash-command mode validates `X-Signature-Ed25519` and `X-Signature-Timestamp` against the raw body and `DISCORD_PUBLIC_KEY`, returns `type: 1` for Discord `PING`, acknowledges slash commands with a deferred response, then sends the final answer as an interaction follow-up.
88
-
89
- Bot mode connects to Discord Gateway with `DISCORD_BOT_TOKEN`, requests guild message and message-content intents, ignores bot-authored messages, normalizes `MESSAGE_CREATE`, and sends the final answer through `/channels/<channel_id>/messages`.
90
-
91
- All outbound Discord sends use `allowed_mentions: { parse: [] }`. Discord interaction tokens and bot tokens must not appear in delivery, queue, buffer, or doctor API responses.
92
-
93
- Discord audio is not supported in V1; do not configure `audio` on `discordChannel`.
3
+ Read `docs/guides/connect-discord.md` from the root printed by `agentkit docs path`. Configure local secrets and use `agentkit dev` for diagnostics. Provider webhook registration is manual; synthetic checks do not prove real delivery.
@@ -1,56 +1,3 @@
1
- # Slack Channel
1
+ # Slack
2
2
 
3
- Slack uses Events API webhooks.
4
-
5
- V1 supports:
6
-
7
- - `app_mention` in channels.
8
- - `message.im` direct messages.
9
- - Outbound replies through `chat.postMessage`.
10
-
11
- V1 does not support Socket Mode, files, audio transcription, app-management automation, or all-channel message listening.
12
-
13
- ## Required Secrets
14
-
15
- ```txt
16
- SLACK_BOT_TOKEN
17
- SLACK_SIGNING_SECRET
18
- ```
19
-
20
- ## Config
21
-
22
- ```ts
23
- slackChannel({
24
- name: "support-slack",
25
- })
26
- ```
27
-
28
- ## Commands
29
-
30
- ```sh
31
- agentkit deploy
32
- agentkit secret set SLACK_BOT_TOKEN --stdin
33
- agentkit secret set SLACK_SIGNING_SECRET --stdin
34
- agentkit channels connect slack support-slack
35
- agentkit channels test support-slack --message "hello"
36
- agentkit channels deliveries list support-slack
37
- ```
38
-
39
- ## Slack Setup
40
-
41
- In Slack app configuration:
42
-
43
- 1. Basic Information: copy Signing Secret into `SLACK_SIGNING_SECRET`.
44
- 2. OAuth & Permissions: add bot scopes `app_mentions:read`, `im:history`, and `chat:write`.
45
- 3. Install or reinstall the app to the workspace.
46
- 4. Copy the Bot User OAuth Token into `SLACK_BOT_TOKEN`.
47
- 5. Event Subscriptions: enable events and paste the AgentKit webhook URL.
48
- 6. Subscribe to bot events `app_mention` and `message.im`.
49
-
50
- ## Runtime Behavior
51
-
52
- AgentKit verifies `X-Slack-Signature` and `X-Slack-Request-Timestamp` against the raw body before processing events. It rejects stale timestamps, answers `url_verification` with the literal challenge, skips bot/subtype messages, maps channel mentions to Slack threads, maps DMs to the Slack DM channel and user, and replies with `chat.postMessage`.
53
-
54
- Outbound Slack text escapes Slack control mentions and disables link-name expansion and unfurls.
55
-
56
- Slack audio is not supported in V1; do not configure `audio` on `slackChannel`.
3
+ Read `docs/guides/connect-slack.md` from the root printed by `agentkit docs path`. Configure local secrets and use `agentkit dev` for diagnostics. Provider webhook registration is manual; synthetic checks do not prove real delivery.
@@ -1,72 +1,3 @@
1
- # Telegram Channel
1
+ # Telegram
2
2
 
3
- Required secrets:
4
-
5
- ```txt
6
- TELEGRAM_BOT_TOKEN
7
- TELEGRAM_WEBHOOK_SECRET
8
- ```
9
-
10
- Audio transcription also needs the configured transcription secret, usually:
11
-
12
- ```txt
13
- GROQ_API_KEY
14
- ```
15
-
16
- Commands:
17
-
18
- ```sh
19
- agentkit deploy
20
- agentkit secret set TELEGRAM_BOT_TOKEN --stdin
21
- agentkit secret set TELEGRAM_WEBHOOK_SECRET --stdin
22
- agentkit channels connect telegram support-telegram
23
- agentkit channels doctor support-telegram
24
- agentkit channels status support-telegram
25
- agentkit channels test support-telegram --message "hello"
26
- agentkit channels test-audio support-telegram --fixture voice-note
27
- agentkit transcribe smoke --provider groq
28
- agentkit channels deliveries list support-telegram
29
- ```
30
-
31
- `connect` creates or reuses the hosted channel, validates managed secrets, calls Telegram `setWebhook`, confirms `getWebhookInfo`, runs a synthetic smoke, and prints the human Telegram steps. Use `setup --apply` only when you need to repeat webhook registration without running smoke.
32
-
33
- Buffer rapid Telegram messages:
34
-
35
- ```ts
36
- telegramChannel({
37
- name: "support-telegram",
38
- buffer: {
39
- mode: "debounce",
40
- quietWindowMs: 1500,
41
- maxWaitMs: 8000,
42
- maxMessages: 20,
43
- maxChars: 8000,
44
- },
45
- })
46
- ```
47
-
48
- Transcribe Telegram voice notes:
49
-
50
- ```ts
51
- export default defineAgent({
52
- // ...
53
- transcription: {
54
- provider: "groq",
55
- model: "whisper-large-v3-turbo",
56
- secret: "GROQ_API_KEY",
57
- language: "pt",
58
- limits: {
59
- maxDurationSeconds: 180,
60
- maxBytes: 20_000_000,
61
- },
62
- },
63
- channels: [
64
- telegramChannel({
65
- name: "support-telegram",
66
- audio: { mode: "transcribe" },
67
- }),
68
- ],
69
- });
70
- ```
71
-
72
- AgentKit validates the Telegram webhook, normalizes `voice` and `audio` payloads, enqueues an audio job, then the retryable channel worker calls Telegram `getFile`, downloads the media with `TELEGRAM_BOT_TOKEN`, sends the bytes to the configured transcription provider, and runs the agent with transcript text. Telegram voice notes are usually OGG/Opus; use Groq in V1 for that path. `test-audio` validates the audio channel ingress path; `transcribe smoke` validates the transcription provider separately.
3
+ Read `docs/guides/connect-telegram.md` from the root printed by `agentkit docs path`. Configure local secrets and use `agentkit dev` for diagnostics. Provider webhook registration is manual; synthetic checks do not prove real delivery.
@@ -1,57 +1,3 @@
1
- # WhatsApp Through Evolution API
1
+ # Whatsapp Evolution
2
2
 
3
- Required secrets:
4
-
5
- ```txt
6
- EVOLUTION_API_BASE_URL
7
- EVOLUTION_API_KEY
8
- EVOLUTION_INSTANCE_NAME
9
- EVOLUTION_WEBHOOK_TOKEN
10
- ```
11
-
12
- Audio transcription also needs the configured transcription secret, usually `OPENAI_API_KEY` or `GROQ_API_KEY`.
13
-
14
- Commands:
15
-
16
- ```sh
17
- agentkit deploy
18
- agentkit channels add whatsapp main-whatsapp --provider evolution
19
- agentkit channels setup main-whatsapp --apply
20
- agentkit channels status main-whatsapp
21
- agentkit channels test main-whatsapp --message "hello"
22
- agentkit channels deliveries list main-whatsapp
23
- ```
24
-
25
- AgentKit applies Evolution setup by calling `/webhook/set/{instance}` with the stable hosted URL and then confirming the configured webhook through `/webhook/find/{instance}`. AgentKit appends `?token=<EVOLUTION_WEBHOOK_TOKEN>` to the registered webhook URL.
26
-
27
- Inbound Evolution `MESSAGES_UPSERT` webhooks normalize text and audio messages. `fromMe` messages are skipped to avoid reply loops. Unsupported media should be logged as skipped/unsupported without creating an agent run.
28
-
29
- Outbound replies call Evolution API `POST /message/sendText/{instance}` with the `apikey` header and a JSON body containing `number` and `text`. Only set `AGENTKIT_CHANNEL_SEND_DRY_RUN=1` in tests when Evolution should not receive a real message.
30
-
31
- Buffer rapid WhatsApp messages:
32
-
33
- ```ts
34
- whatsappChannel({
35
- name: "main-whatsapp",
36
- provider: "evolution",
37
- buffer: {
38
- mode: "debounce",
39
- quietWindowMs: 2500,
40
- maxWaitMs: 12000,
41
- maxMessages: 20,
42
- maxChars: 8000,
43
- },
44
- })
45
- ```
46
-
47
- Transcribe WhatsApp audio:
48
-
49
- ```ts
50
- whatsappChannel({
51
- name: "main-whatsapp",
52
- provider: "evolution",
53
- audio: { mode: "transcribe" },
54
- })
55
- ```
56
-
57
- Evolution audio downloads use `/chat/getBase64FromMediaMessage/{instance}` and AgentKit rejects unsafe Evolution base URLs before sending `EVOLUTION_API_KEY`; do not use localhost, private-network hosts, or HTTP base URLs.
3
+ Read `docs/guides/connect-whatsapp-evolution.md` from the root printed by `agentkit docs path`. Configure local secrets and use `agentkit dev` for diagnostics. Provider webhook registration is manual; synthetic checks do not prove real delivery.
@@ -1,54 +1,3 @@
1
- # WhatsApp Through UAZAPI
1
+ # Whatsapp Uazapi
2
2
 
3
- Required secrets:
4
-
5
- ```txt
6
- UAZAPI_BASE_URL
7
- UAZAPI_TOKEN
8
- UAZAPI_WEBHOOK_TOKEN
9
- ```
10
-
11
- Audio transcription also needs the configured transcription secret, usually `OPENAI_API_KEY` or `GROQ_API_KEY`.
12
-
13
- Commands:
14
-
15
- ```sh
16
- node -e "process.stdout.write(require('node:crypto').randomBytes(32).toString('hex'))" | npm run agentkit -- env set UAZAPI_WEBHOOK_TOKEN --stdin
17
- npm run agentkit -- env set UAZAPI_BASE_URL --stdin
18
- npm run agentkit -- env set UAZAPI_TOKEN --stdin
19
- npm run agentkit -- dev
20
- ```
21
-
22
- `UAZAPI_WEBHOOK_TOKEN` is generated by the user for AgentKit; UAZAPI does not issue it. Expose the local port through an HTTPS tunnel and register the exact `/channels/support-whatsapp/whatsapp/uazapi/webhook?token=<UAZAPI_WEBHOOK_TOKEN>` URL with `addUrlEvents: false` and `addUrlTypesMessages: false`. Send a real message to confirm UAZAPI preserves the complete URL.
23
-
24
- Inbound UAZAPI `messages` webhooks normalize text and audio messages. `fromMe` and `wasSentByApi` messages are skipped to avoid reply loops. Unsupported media should be logged as skipped/unsupported without creating an agent run.
25
-
26
- Outbound replies call UAZAPI `POST /send/text` with the `token` header and a JSON body containing `number`, `text`, `readchat`, `async`, `track_source`, and `track_id`. Only set `AGENTKIT_CHANNEL_SEND_DRY_RUN=1` in tests when UAZAPI should not receive a real message.
27
-
28
- Buffer rapid WhatsApp messages:
29
-
30
- ```ts
31
- whatsappChannel({
32
- name: "support-whatsapp",
33
- provider: "uazapi",
34
- buffer: {
35
- mode: "debounce",
36
- quietWindowMs: 2500,
37
- maxWaitMs: 12000,
38
- maxMessages: 20,
39
- maxChars: 8000,
40
- },
41
- })
42
- ```
43
-
44
- Transcribe WhatsApp audio:
45
-
46
- ```ts
47
- whatsappChannel({
48
- name: "support-whatsapp",
49
- provider: "uazapi",
50
- audio: { mode: "transcribe" },
51
- })
52
- ```
53
-
54
- UAZAPI audio downloads use `/message/download` with `return_base64: true`, `return_link: false`, `generate_mp3: false`, and `transcribe: false`. AgentKit rejects unsafe UAZAPI base URLs before sending `UAZAPI_TOKEN`; do not use localhost, private-network hosts, or HTTP base URLs.
3
+ Read `docs/guides/connect-whatsapp-uazapi.md` from the root printed by `agentkit docs path`. Configure local secrets and use `agentkit dev` for diagnostics. Provider webhook registration is manual; synthetic checks do not prove real delivery.
@@ -1,71 +1,3 @@
1
- # WhatsApp Through Zapster
1
+ # Whatsapp Zapster
2
2
 
3
- Required secrets:
4
-
5
- ```txt
6
- ZAPSTER_API_KEY
7
- ZAPSTER_INSTANCE_ID
8
- ZAPSTER_WEBHOOK_ID
9
- ZAPSTER_WEBHOOK_TOKEN
10
- ```
11
-
12
- Audio transcription also needs the configured transcription secret, usually `OPENAI_API_KEY` or `GROQ_API_KEY`.
13
-
14
- Commands:
15
-
16
- ```sh
17
- node -e "process.stdout.write(require('node:crypto').randomBytes(32).toString('hex'))" | npm run agentkit -- env set ZAPSTER_WEBHOOK_TOKEN --stdin
18
- npm run agentkit -- env set ZAPSTER_API_KEY --stdin
19
- npm run agentkit -- env set ZAPSTER_INSTANCE_ID --stdin
20
- npm run agentkit -- env set ZAPSTER_WEBHOOK_ID --stdin
21
- npm run agentkit -- dev
22
- ```
23
-
24
- `ZAPSTER_WEBHOOK_TOKEN` is generated by the user for AgentKit; Zapster does not issue it. Expose the local port through an HTTPS tunnel and register the exact `/channels/support-whatsapp/whatsapp/zapster/webhook?token=<ZAPSTER_WEBHOOK_TOKEN>` URL. Send a real message to confirm Zapster preserves the complete URL. Keep phone numbers redacted in logs by default.
25
-
26
- AgentKit handles Zapster `message.received` envelopes with event id at `id`, message text at `data.content.text`, and contact identity at `data.sender.id`. Unsupported media should be logged as skipped/unsupported without creating an agent run.
27
-
28
- Outbound replies call `POST https://api.zapsterapi.com/v1/wa/messages` with bearer auth and a JSON body containing `recipient`, `text`, and `instance_id`. Only set `AGENTKIT_CHANNEL_SEND_DRY_RUN=1` in tests when Zapster should not receive a real message.
29
-
30
- Buffer rapid WhatsApp messages:
31
-
32
- ```ts
33
- whatsappChannel({
34
- name: "support-whatsapp",
35
- provider: "zapster",
36
- buffer: {
37
- mode: "debounce",
38
- quietWindowMs: 2500,
39
- maxWaitMs: 12000,
40
- maxMessages: 20,
41
- maxChars: 8000,
42
- },
43
- })
44
- ```
45
-
46
- Transcribe WhatsApp audio:
47
-
48
- ```ts
49
- export default defineAgent({
50
- // ...
51
- transcription: {
52
- provider: "openai",
53
- model: "gpt-4o-mini-transcribe",
54
- secret: "OPENAI_API_KEY",
55
- language: "pt",
56
- limits: {
57
- maxDurationSeconds: 180,
58
- maxBytes: 20_000_000,
59
- },
60
- },
61
- channels: [
62
- whatsappChannel({
63
- name: "support-whatsapp",
64
- provider: "zapster",
65
- audio: { mode: "transcribe" },
66
- }),
67
- ],
68
- });
69
- ```
70
-
71
- Zapster audio payloads must include a usable HTTPS Zapster media download URL such as `audio.downloadUrl`, `audio.url`, `audio.mediaUrl`, or the snake_case equivalents. AgentKit rejects arbitrary hosts before sending `ZAPSTER_API_KEY`. The retryable channel worker downloads the media, transcribes it through the configured provider secret, and runs the agent with transcript text. If Zapster sends only a media ID in V1, AgentKit records `channel_audio_download_unavailable`.
3
+ Read `docs/guides/connect-whatsapp-zapster.md` from the root printed by `agentkit docs path`. Configure local secrets and use `agentkit dev` for diagnostics. Provider webhook registration is manual; synthetic checks do not prove real delivery.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: agentkit-database
3
- description: Use when adding AgentKit-managed database tables, editing schema.sql, writing database-backed tools, seeding local data, or verifying local/hosted storage compatibility through ctx.db.
3
+ description: Use when adding AgentKit-local database tables, editing schema.sql, writing database-backed tools, seeding local data, or verifying local storage compatibility through ctx.db.
4
4
  ---
5
5
 
6
6
  # AgentKit Database
@@ -23,7 +23,7 @@ When the owner asks the agent to save or update records, do not stop after addin
23
23
  - Put the first idempotent bootstrap schema in `schema.sql`.
24
24
  - For production-shaped changes, prefer ordered `migrations/*.sql` files such as `migrations/0001_initial.sql`.
25
25
  - Keep `schema.sql` idempotent with `CREATE TABLE IF NOT EXISTS`, `CREATE INDEX IF NOT EXISTS`, and safe additive changes.
26
- - Keep deploy-ready capsules on `storage.driver: "agentkit"`.
26
+ - Keep local capsules on `storage.driver: "agentkit"`.
27
27
  - Use `ctx.db` inside tools. `ctx.database` and `ctx.storage.sql` are aliases.
28
28
  - Do not import SQLite, Turso, or other database drivers from tools.
29
29
  - Do not edit `.agentkit/agentkit.db` by hand.
@@ -52,5 +52,3 @@ npm run typecheck
52
52
  npm run agentkit -- db migrate
53
53
  npm run agentkit -- tool <tool_name> --input '<json>'
54
54
  ```
55
-
56
- Hosted deploy applies AgentKit-managed storage internally. The user should not create hosted databases or buckets by hand.
@@ -19,7 +19,7 @@ Use evals after chat works and before claiming behavior is stable.
19
19
  6. For date-sensitive flows, set top-level `now` to an ISO timestamp with `Z` or a numeric offset so today, tomorrow, weekdays, and tool date validation stay deterministic.
20
20
  7. Use `turns` for full conversation flows, such as user asks, agent calls a tool, then the answer follows the required format.
21
21
  8. Convert local failures into regression tests with `npm run agentkit -- eval from-conversation <conversation-id>`.
22
- 9. Convert hosted or local production evidence into regression tests with `npm run agentkit -- improve collect --deploy --since 24h`, then `npm run agentkit -- improve evals .agentkit/improve/<run>`.
22
+ 9. Convert local production evidence into regression tests with `npm run agentkit -- improve collect --since 24h`, then `npm run agentkit -- improve evals .agentkit/improve/<run>`.
23
23
  10. Do not put secrets or real client PII in evals.
24
24
  11. For tools that write externally, delete, charge money, send email, or call real customer systems, branch on `ctx.runtime.environment === "eval"` inside the registered tool.
25
25