@andreprado/agentkit 0.1.0-alpha.15 → 0.1.0-alpha.16

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.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: agentkit-channels
3
- description: Use when adding, connecting, testing, buffering, or debugging AgentKit website, Telegram, or WhatsApp channels, including channel config helpers, provider secrets, webhook setup, channel tests, delivery logs, and burst-message buffers.
3
+ description: Use when adding, connecting, testing, buffering, transcribing audio, or debugging AgentKit website, Telegram, or WhatsApp channels, including channel config helpers, provider secrets, webhook setup, channel tests, delivery logs, burst-message buffers, and transcription provider secrets.
4
4
  ---
5
5
 
6
6
  # AgentKit Channels
@@ -16,6 +16,39 @@ Channels receive user messages. Tools let the agent call external systems. Keep
16
16
  5. Connect channel resources through the CLI.
17
17
  6. Test, doctor, and inspect delivery logs.
18
18
 
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. 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
+
19
52
  ## Buffering
20
53
 
21
54
  Enable `buffer.mode: "debounce"` when clients send several short messages in a row and the agent should answer once.
@@ -22,6 +22,10 @@ Common states:
22
22
  webhook_received
23
23
  validated
24
24
  duplicate
25
+ audio_received
26
+ audio_downloaded
27
+ transcribing
28
+ transcribed
25
29
  buffered
26
30
  queued
27
31
  running
@@ -43,6 +47,15 @@ Common errors:
43
47
  - `channel_signature_invalid`: webhook secret, token, or origin header mismatch.
44
48
  - `channel_payload_invalid`: malformed or unsupported provider payload.
45
49
  - `channel_event_duplicate`: provider retry; do not create a second run.
50
+ - `audio_received`: audio message was accepted and normalized.
51
+ - `audio_downloaded`: retryable channel worker downloaded provider media into memory.
52
+ - `transcribing`: AgentKit is calling the configured transcription provider.
53
+ - `transcribed`: transcript text was queued for the agent.
54
+ - `channel_audio_download_unavailable`: provider audio payload did not include a usable download URL, or Zapster sent a non-HTTPS/non-Zapster media host.
55
+ - `transcription_secret_missing`: managed transcription secret is missing.
56
+ - `transcription_audio_too_large` or `transcription_audio_too_long`: audio exceeded configured limits.
57
+ - `transcription_audio_format_unsupported`: provider does not accept this audio MIME type or extension.
58
+ - `transcription_provider_unavailable`: retryable transcription provider failure.
46
59
  - `channel_limit_exceeded`: backpressure skipped the message.
47
60
  - `synthetic_expected_failure`: a synthetic test reached AgentKit, but the provider correctly rejected a fake test recipient.
48
61
  - `buffered` delivery state: message is waiting for the channel quiet window or max wait before one coalesced agent run is queued.
@@ -7,6 +7,12 @@ TELEGRAM_BOT_TOKEN
7
7
  TELEGRAM_WEBHOOK_SECRET
8
8
  ```
9
9
 
10
+ Audio transcription also needs the configured transcription secret, usually:
11
+
12
+ ```txt
13
+ GROQ_API_KEY
14
+ ```
15
+
10
16
  Commands:
11
17
 
12
18
  ```sh
@@ -36,3 +42,29 @@ telegramChannel({
36
42
  },
37
43
  })
38
44
  ```
45
+
46
+ Transcribe Telegram voice notes:
47
+
48
+ ```ts
49
+ export default defineAgent({
50
+ // ...
51
+ transcription: {
52
+ provider: "groq",
53
+ model: "whisper-large-v3-turbo",
54
+ secret: "GROQ_API_KEY",
55
+ language: "pt",
56
+ limits: {
57
+ maxDurationSeconds: 180,
58
+ maxBytes: 20_000_000,
59
+ },
60
+ },
61
+ channels: [
62
+ telegramChannel({
63
+ name: "support-telegram",
64
+ audio: { mode: "transcribe" },
65
+ }),
66
+ ],
67
+ });
68
+ ```
69
+
70
+ 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.
@@ -14,6 +14,8 @@ Optional hardening secret:
14
14
  ZAPSTER_WEBHOOK_TOKEN
15
15
  ```
16
16
 
17
+ Audio transcription also needs the configured transcription secret, usually `OPENAI_API_KEY` or `GROQ_API_KEY`.
18
+
17
19
  Commands:
18
20
 
19
21
  ```sh
@@ -46,3 +48,30 @@ whatsappChannel({
46
48
  },
47
49
  })
48
50
  ```
51
+
52
+ Transcribe WhatsApp audio:
53
+
54
+ ```ts
55
+ export default defineAgent({
56
+ // ...
57
+ transcription: {
58
+ provider: "openai",
59
+ model: "gpt-4o-mini-transcribe",
60
+ secret: "OPENAI_API_KEY",
61
+ language: "pt",
62
+ limits: {
63
+ maxDurationSeconds: 180,
64
+ maxBytes: 20_000_000,
65
+ },
66
+ },
67
+ channels: [
68
+ whatsappChannel({
69
+ name: "support-whatsapp",
70
+ provider: "zapster",
71
+ audio: { mode: "transcribe" },
72
+ }),
73
+ ],
74
+ });
75
+ ```
76
+
77
+ 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`.