twilio-enterprise-knowledge
This skill adds retrieval-augmented generation (RAG) to AI agents using Twilio Enterprise Knowledge, enabling semantic search across your organization's…
Identity proven by GitHub's verified organisation badge (twilio)
- Agents
- Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode, claude.ai and API
- License
- MIT (permissive)
- Pin
- 8aba46fpinned Oct 9, 2026
- Context cost
- about 3,200 tokenswhen the skill loads
- GitHub stars
- 37on twilio/ai
- Scripts
- None found
What it does
“Add knowledge retrieval (RAG) to AI agents using Twilio Enterprise Knowledge. Covers provisioning Knowledge Bases, uploading sources from web URLs, PDFs, and raw text, and running semantic search to retrieve relevant chunks at runtime. Use this skill to ground agent responses in your organization's actual approved content — FAQs, policies, product docs — rather than hallucinated answers.”
Generated summary from the skill's own text
This skill adds retrieval-augmented generation (RAG) to AI agents using Twilio Enterprise Knowledge, enabling semantic search across your organization's content like FAQs, policies, and product docs. Agents can upload sources from web URLs, PDFs, and text, then inject ranked search results into LLM prompts to ground responses in approved company knowledge rather than hallucinated answers. It integrates with conversation memory to combine institutional knowledge with per-customer context.
When to use it
- Support agents need to reference company FAQs, policies, or product documentation
- Grounding agent responses in approved organizational content is critical
- Combining customer history with institutional knowledge for context
- Agents answer questions across multiple document types and sources
When not to
- Per-customer memory alone; use conversation memory skill instead
- Answers require real-time data beyond uploaded static content
- Knowledge Base limit of 5 per account is insufficient for your use case
Install
These commands install from the publisher's repository and need no account.
skills CLI
npx skills add twilio/ai --skill twilio-enterprise-knowledgeInstalls from the repository's default branch, which may have changed since the commit we checked.
GitHub CLI 2.90 or later
gh skill install twilio/ai twilio-enterprise-knowledge@8aba46fb65dc8d9a20f4b301a68352064b4159a5Installs the commit we checked (8aba46f).
Copy by hand
Download the folder at 8aba46f and put it in .claude/skills/twilio-enterprise-knowledge for Claude Code and in .agents/skills/twilio-enterprise-knowledge for Codex, Cursor, Gemini CLI, GitHub Copilot and OpenCode.
Claude Code plugin
/plugin install twilio-developer-kit@claude-plugins-officialThe publisher's plugin in Claude's official marketplace. It may hold more than this skill, and we have not pinned it.
Copy for your agent
A prompt for any coding agent. It installs this skill from GitHub at the pinned commit, copies the files as they are, and runs nothing unless you ask.
Prompt
Install the agent skill "twilio-enterprise-knowledge" by Twilio. Source, pinned to commit 8aba46fb65dc8d9a20f4b301a68352064b4159a5: https://github.com/twilio/ai/tree/8aba46fb65dc8d9a20f4b301a68352064b4159a5/skills/twilio/twilio-enterprise-knowledge 1. Download that folder at exactly this commit. Do not use the default branch. 2. Copy every file unchanged, keeping the folder structure, into .claude/skills/twilio-enterprise-knowledge/ for Claude Code and .agents/skills/twilio-enterprise-knowledge/ for Codex, Cursor, Gemini CLI, GitHub Copilot and OpenCode. Create the folders if they do not exist. 3. Do not edit the files, and do not run any script in the folder unless I ask you to. 4. When you are done, list the files you copied and where you put them. Listing and checks: https://www.agentnative.dev/skills/twilio/twilio-enterprise-knowledge
SKILL.md at the pin
---
name: twilio-enterprise-knowledge
description: >
Add knowledge retrieval (RAG) to AI agents using Twilio Enterprise Knowledge.
Covers provisioning Knowledge Bases, uploading sources from web URLs, PDFs,
and raw text, and running semantic search to retrieve relevant chunks at
runtime. Use this skill to ground agent responses in your organization's
actual approved content — FAQs, policies, product docs — rather than
hallucinated answers.
---
## Overview
Enterprise Knowledge gives AI agents access to your organization's source material during conversations — FAQs, warranty policies, support scripts, product catalogs. It closes the gap between general model knowledge and how your business actually operates.
```
Your content (web/PDF/text) → Knowledge Base → Indexed chunks
Agent query → Search → Ranked chunks → Inject into LLM prompt
```
Enterprise Knowledge is shared across your organization — it captures institutional content. It is distinct from Conversation Memory (`twilio-conversation-memory`), which is per-customer context. The two are designed to be combined: enterprise content for accuracy, customer memory for personalization.
**Base URL:** `https://knowledge.twilio.com`
**Authentication:** HTTP Basic — `Authorization: Basic {base64(accountSid:authToken)}`
**Rules for agents:**
- Always poll `statusUrl` after any 202 response — all writes are async
- Always wait for Knowledge Base status `COMPLETED` before adding sources
- Always wait for source processing to complete before searching
- Never use `/v1/` paths — all routes use `/v2/` prefix
- Never include auth headers when uploading to presigned URLs — they're already signed
- Never use spaces or underscores in `displayName` — pattern is `^[a-zA-Z0-9-]+$`
- Never exceed 16MB per file upload or 1,048,576 chars per text source
---
## Prerequisites
- Twilio account with Enterprise Knowledge enabled
— A credit card must be added to the account
— See `twilio-account-setup` for initial setup
— See `twilio-iam-auth-setup` for credential best practices
- Environment variables:
- `TWILIO_ACCOUNT_SID`
- `TWILIO_AUTH_TOKEN`
- SDK: `pip install twilio` / `npm install twilio`
---
## Quickstart
**Step 1 — Create a Knowledge Base**
**Python**
```python
import os, requests, time
account_sid = os.environ["TWILIO_ACCOUNT_SID"]
auth_token = os.environ["TWILIO_AUTH_TOKEN"]
base_url = "https://knowledge.twilio.com"
auth = (account_sid, auth_token)
res = requests.post(
f"{base_url}/v2/ControlPlane/KnowledgeBases",
auth=auth,
json={"displayName": "product-docs", "description": "Support agent knowledge"}
)
status_url = res.json()["statusUrl"]
while True:
op = requests.get(status_url, auth=auth).json()
if op["status"] == "COMPLETED":
kb_id = op["result"]["id"]
break
if op["status"] == "FAILED":
raise Exception(op["error"]["detail"])
time.sleep(2)
print(kb_id) # know_knowledgebase_xxx
```
**Node.js**
```javascript
const accountSid = process.env.TWILIO_ACCOUNT_SID;
const authToken = process.env.TWILIO_AUTH_TOKEN;
const baseUrl = "https://knowledge.twilio.com";
const authHeader = "Basic " + btoa(`${accountSid}:${authToken}`);
const headers = { "Authorization": authHeader, "Content-Type": "application/json" };
const res = await fetch(`${baseUrl}/v2/ControlPlane/KnowledgeBases`, {
method: "POST",
headers,
body: JSON.stringify({ displayName: "product-docs", description: "Support agent knowledge" }),
});
const { statusUrl } = await res.json();
let kbId;
while (true) {
const op = await fetch(statusUrl, { headers: { "Authorization": authHeader } }).then(r => r.json());
if (op.status === "COMPLETED") { kbId = op.result.id; break; }
if (op.status === "FAILED") throw new Error(op.error.detail);
await new Promise(r => setTimeout(r, 2000));
}
```
**Step 2 — Add a Knowledge Source**
Three source types: **Web** (crawl a URL), **File** (upload PDF/CSV/Markdown/text, max 16MB), **Text** (inline, max 1,048,576 chars).
**Python**
```python
knowledge = requests.post(
f"{base_url}/v2/KnowledgeBases/{kb_id}/Knowledge",
auth=auth,
json={
"name": "Product Documentation",
"description": "Public product docs",
"source": {"type": "Web", "url": "https://docs.example.com", "crawlDepth": 3}
}
).json()
knowledge_id = knowledge["id"]
```
**Node.js**
```javascript
const knowledge = await fetch(`${baseUrl}/v2/KnowledgeBases/${kbId}/Knowledge`, {
method: "POST",
headers,
body: JSON.stringify({
name: "Product Documentation",
description: "Public product docs",
source: { type: "Web", url: "https://docs.example.com", crawlDepth: 3 },
}),
}).then(r => r.json());
const knowledgeId = knowledge.id;
```
**Step 3 — Wait for processing**
Sources are processed asynchronously. Poll until `status` is `COMPLETED`.
**Python**
```python
while True:
k = requests.get(
f"{base_url}/v2/KnowledgeBases/{kb_id}/Knowledge/{knowledge_id}", auth=auth
).json()
if k["status"] == "COMPLETED":
break
if k["status"] == "FAILED":
raise Exception(f"Processing failed: {k}")
time.sleep(3)
```
**Node.js**
```javascript
while (true) {
const k = await fetch(
`${baseUrl}/v2/KnowledgeBases/${kbId}/Knowledge/${knowledgeId}`,
{ headers: { "Authorization": authHeader } }
).then(r => r.json());
if (k.status === "COMPLETED") break;
if (k.status === "FAILED") throw new Error(JSON.stringify(k));
await new Promise(r => setTimeout(r, 3000));
}
```
Statuses: `SCHEDULED` → `QUEUED` → `PROCESSING` → `COMPLETED` / `FAILED`
**Step 4 — Search and inject into LLM prompt**
**Python**
```python
results = requests.post(
f"{base_url}/v2/KnowledgeBases/{kb_id}/Search",
auth=auth,
json={"query": "How do I reset my password?", "top": 5}
).json()
chunks = "\n\n".join(c["content"] for c in results["chunks"])
system_prompt = f"""You are a helpful support agent.
Relevant knowledge:
{chunks}
Answer using only the above content."""
```
**Node.js**
```javascript
const results = await fetch(`${baseUrl}/v2/KnowledgeBases/${kbId}/Search`, {
method: "POST",
headers,
body: JSON.stringify({ query: "How do I reset my password?", top: 5 }),
}).then(r => r.json());
const chunks = results.chunks.map(c => c.content).join("\n\n");
const systemPrompt = `You are a helpful support agent.\n\nRelevant knowledge:\n${chunks}`;
```
---
## Key Patterns
### Combine with Conversation Memory
For the best agent responses, combine Enterprise Knowledge (company content) with Conversation Memory Recall (individual customer history).
**Python**
```python
recall_res = requests.post(
f"https://memory.twilio.com/v1/Stores/{store_id}/Profiles/{profile_id}/Recall",
auth=auth,
json={"query": user_query, "observationsLimit": 5}
).json()
search_res = requests.post(
f"{base_url}/v2/KnowledgeBases/{kb_id}/Search",
auth=auth,
json={"query": user_query, "top": 3}
).json()
customer_context = "\n".join(o["content"] for o in recall_res.get("observations", []))
knowledge = "\n\n".join(c["content"] for c in search_res.get("chunks", []))
system_prompt = f"""Customer history:\n{customer_context}\n\nDocumentation:\n{knowledge}"""
```
**Node.js**
```javascript
const [recallRes, searchRes] = await Promise.all([
fetch(`https://memory.twilio.com/v1/Stores/${storeId}/Profiles/${profileId}/Recall`, {
method: "POST",
headers,
body: JSON.stringify({ query: userQuery, observationsLimit: 5 }),
}).then(r => r.json()),
fetch(`${baseUrl}/v2/KnowledgeBases/${kbId}/Search`, {
method: "POST",
headers,
body: JSON.stringify({ query: userQuery, top: 3 }),
}).then(r => r.json()),
]);
const customerContext = recallRes.observations.map(o => o.content).join("\n");
const knowledge = searchRes.chunks.map(c => c.content).join("\n\n");
```
### File Upload (PDF/CSV/Markdown)
File sources return a presigned URL. Upload the file there — do not include auth headers.
**Python**
```python
knowledge = requests.post(
f"{base_url}/v2/KnowledgeBases/{kb_id}/Knowledge",
auth=auth,
json={"name": "Handbook", "description": "Employee handbook", "source": {"type": "File"}}
).json()
upload_url = knowledge["source"]["importUrl"]
with open("handbook.pdf", "rb") as f:
requests.put(upload_url, data=f, headers={"Content-Type": "application/pdf"})
```
**Node.js**
```javascript
const knowledge = await fetch(`${baseUrl}/v2/KnowledgeBases/${kbId}/Knowledge`, {
method: "POST",
headers,
body: JSON.stringify({ name: "Handbook", description: "Employee handbook", source: { type: "File" } }),
}).then(r => r.json());
const file = await fs.promises.readFile("handbook.pdf");
await fetch(knowledge.source.importUrl, {
method: "PUT",
headers: { "Content-Type": "application/pdf" },
body: file,
});
```
### Filter Search to Specific Sources
When your Knowledge Base has multiple sources, target search to specific ones:
**Python**
```python
results = requests.post(
f"{base_url}/v2/KnowledgeBases/{kb_id}/Search",
auth=auth,
json={"query": "cancellation policy", "top": 5, "knowledgeIds": [policy_source_id]}
).json()
for chunk in results["chunks"]:
print(f"[{chunk['score']:.3f}] {chunk['content'][:100]}")
```
**Node.js**
```javascript
const results = await fetch(`${baseUrl}/v2/KnowledgeBases/${kbId}/Search`, {
method: "POST",
headers,
body: JSON.stringify({ query: "cancellation policy", top: 5, knowledgeIds: [policySourceId] }),
}).then(r => r.json());
for (const chunk of results.chunks) {
console.log(`[${chunk.score.toFixed(3)}] ${chunk.content.slice(0, 100)}`);
}
```
Omit `knowledgeIds` to search across all sources. Max 100 IDs per request.
### Refresh a Web Source
Re-crawl without changing config. Set `crawlPeriod` for automatic recrawling.
**Python**
```python
requests.patch(
f"{base_url}/v2/KnowledgeBases/{kb_id}/Knowledge/{knowledge_id}?refresh=true",
auth=auth,
json={"name": "Product Documentation"}
)
requests.patch(
f"{base_url}/v2/KnowledgeBases/{kb_id}/Knowledge/{knowledge_id}",
auth=auth,
json={"name": "Product Documentation", "source": {"type": "Web", "crawlPeriod": "WEEKLY"}}
)
```
**Node.js**
```javascript
await fetch(`${baseUrl}/v2/KnowledgeBases/${kbId}/Knowledge/${knowledgeId}?refresh=true`, {
method: "PATCH",
headers,
body: JSON.stringify({ name: "Product Documentation" }),
});
await fetch(`${baseUrl}/v2/KnowledgeBases/${kbId}/Knowledge/${knowledgeId}`, {
method: "PATCH",
headers,
body: JSON.stringify({ name: "Product Documentation", source: { type: "Web", crawlPeriod: "WEEKLY" } }),
});
```
Crawl period options: `WEEKLY` | `BIWEEKLY` | `MONTHLY` | `NEVER`
### Inspect Chunks
Audit what was indexed from a source:
**Python**
```python
chunks = requests.get(
f"{base_url}/v2/KnowledgeBases/{kb_id}/Knowledge/{knowledge_id}/Chunks",
auth=auth,
params={"pageSize": 50}
).json()
for chunk in chunks["chunks"]:
print(f"[{chunk['metadata']['sourceType']}] {chunk['content'][:100]}")
```
**Node.js**
```javascript
const chunks = await fetch(
`${baseUrl}/v2/KnowledgeBases/${kbId}/Knowledge/${knowledgeId}/Chunks?pageSize=50`,
{ headers: { "Authorization": authHeader } }
).then(r => r.json());
for (const chunk of chunks.chunks) {
console.log(`[${chunk.metadata.sourceType}] ${chunk.content.slice(0, 100)}`);
}
```
Paginate with `pageToken` from `chunks.meta.nextToken`.
---
## CANNOT
- Cannot exceed 5 Knowledge Bases per account
- Cannot exceed 10 knowledge sources per Knowledge Base
- Cannot add sources before Knowledge Base is active — poll `statusUrl` until `COMPLETED`
- Cannot use v1 endpoints — all routes use `/v2/` prefix on `knowledge.twilio.com`
- Cannot include auth header when uploading to presigned URL — `importUrl` is already signed
- Cannot search before source processing completes — poll source status first
- Cannot exceed 16 MiB (16,777,216 bytes) per file upload
- Cannot exceed 1,048,576 characters (~1MB) per text source pushed via API
- Cannot exceed 2048 characters in a search query
- Cannot exceed 2048 characters in a web source URL
- Cannot retrieve more than 20 search results per query (`top` max is 20)
- Cannot exceed 100 `knowledgeIds` in a search filter
- Cannot set crawl depth beyond 1–10 levels for web sources
- Cannot use custom crawl schedules — locked to fixed intervals: `WEEKLY`, `BIWEEKLY`, `MONTHLY`, or `NEVER`
- Cannot use spaces or underscores in `displayName` — alphanumeric and hyphens only
- Cannot use `name` longer than 30 characters for knowledge sources
- Cannot modify immutable fields (`id`, `type`, `status`, `url`, `createdAt`, `updatedAt`) via PATCH
- Cannot use Knowledge for per-customer context — use `twilio-conversation-memory` for that
---
## Next Steps
- **Per-customer context:** `twilio-conversation-memory` — combine with Enterprise Knowledge for full agent context
- **Background transcript intelligence:** `twilio-conversation-intelligence`
- **Voice agent with ConversationRelay:** `twilio-voice-conversation-relay`
- **TAC SDK integration:** `twilio-agent-connect`
- **Debug integration issues:** `twilio-debugging-observability`
From twilio/ai at 8aba46f, shown as plain text under its license: MIT (permissive). The license text is in LICENSE.
View SKILL.md on GitHub at 8aba46fFiles
- SKILL.md13 KB · b24af6ac3feb
- agents/
- openai.yaml462 B · e430d6a63f82
- assets/
- icon-large.png9.6 KB · 0ba822e01172
- icon-small.png5.6 KB · 400e3f49b6c1
4 files, 29 KB in total. Each file has a sha256 in the pin's manifest; the first 12 characters are shown.
Skill folder on GitHub at 8aba46fMore from Twilio
twilio-account-setup
Sets up a Twilio account from scratch, including free trial signup, credential retrieval, phone number purchase, and enabling specific products like AI…
Claude Code, Codex, Cursor +4 · about 2.5K tokens · pinned 7 days ago
twilio-agent-augmentation-architect
This skill helps developers design AI-augmented contact center systems that enhance human agents with real-time intelligence.
Claude Code, Codex, Cursor +3 · about 3.6K tokens · pinned 7 days ago
twilio-agent-connect
Twilio Agent Connect is middleware that integrates LLM agents with Twilio communication channels (voice, SMS, RCS, WhatsApp, chat).
Claude Code, Codex, Cursor +4 · about 4.1K tokens · pinned 7 days ago
twilio-ai-agent-architect
Planning skill that helps developers design AI-powered conversational agents by assessing their use case across outcome sophistication, channels, and customer…
Claude Code, Codex, Cursor +3 · about 4.9K tokens · pinned 7 days ago
twilio-call-recordings
This skill teaches agents to record Twilio voice calls correctly using the appropriate method for the use case.
Claude Code, Codex, Cursor +4 · about 2.6K tokens · pinned 7 days ago
twilio-cli-reference
The Twilio CLI reference enables agents to manage Twilio resources directly from the terminal, including phone number provisioning, sending SMS and email…
Claude Code, Codex, Cursor +4 · about 1.8K tokens · pinned 7 days ago
Related in AI and agents
databricks-unstructured-pdf-generation
This skill generates synthetic PDF documents from HTML and pairs them with test questions for RAG evaluation datasets on Databricks Unity Catalog.
by DatabricksOfficial publisher
Contains scripts
Claude Code, Codex, Cursor +3 · about 1.6K tokens · pinned 7 days ago
letta-filesystem-to-memfs
This skill migrates deprecated Letta Filesystem folder and file uploads to MemFS by extracting documents to markdown, chunking them into stable files, and…
by LettaOfficial publisher
Contains scripts
Claude Code, Codex, Cursor +3 · about 1.2K tokens · pinned 7 days ago
twilio-conversation-intelligence
This skill guides developers in implementing Twilio's Conversation Intelligence v3 API for real-time and post-conversation analysis of SMS, Voice, RCS…
by TwilioOfficial publisher
Claude Code, Codex, Cursor +4 · about 8.8K tokens · pinned 7 days ago
twilio-conversation-memory
Store and retrieve customer context using Twilio's Conversation Memory service.
by TwilioOfficial publisher
Claude Code, Codex, Cursor +4 · about 2.8K tokens · pinned 7 days ago
vectara-agents
This skill enables developers to build AI agents on the Vectara platform using retrieval-augmented generation (RAG).
by VectaraOfficial publisher
Claude Code, Codex, Cursor +3 · about 8K tokens · pinned 7 days ago
agent-builder
Agent Builder orchestrates the creation, modification, testing, and publishing of n8n Agents.
by n8nOfficial publisher
Claude Code, Codex, Cursor +3 · about 2.3K tokens · pinned 7 days ago