Skip to contentSkip to navigationSkip to topbar
Page toolsOn this page
Looking for more inspiration?Visit the

Create an AI-ready knowledge base


This guide helps you transform raw data into an AI-ready knowledge base.


Overview

overview page anchor

Enterprise Knowledge uses a simple hierarchy: sources live inside knowledge bases. After you create a knowledge base, you provide its unique ID to your AI tool, which gives the AI the context it needs to stay on-brand and accurate.

Follow these steps to learn how to structure your data and connect your knowledge to AI tools like Conversation Intelligence.


Step 1: Create your knowledge base

step-1-create-your-knowledge-base page anchor

Think of a knowledge base as your library. It's the container that your AI tools search through.

To create a knowledge base, make a POST request to the knowledge bases endpoint:

Create a knowledge base

create-a-knowledge-base page anchor
1
curl -X POST "https://knowledge.twilio.com/v2/ControlPlane/KnowledgeBases" \
2
-u $TWILIO_API_KEY:$TWILIO_API_SECRET \
3
-H "Content-Type: application/json" \
4
-d '{
5
"displayName": "my-knowledge-base"
6
}'

Save the knowledge base ID that you'll receive (for example, KBxxxxxxxxxx). You need this ID to link your knowledge to CINTEL or TAC in Step 3.

For more details, see the knowledge bases API reference.


Step 2: Add a source to your knowledge base

step-2-add-a-source-to-your-knowledge-base page anchor

Add the actual source information to your knowledge base. You can use a website URL, raw text, or upload a file.

Example: Add a website source

example-add-a-website-source page anchor

To add a website source, make a POST request to the knowledge sources endpoint with your kbId:

1
curl -X POST "https://knowledge.twilio.com/v2/KnowledgeBases/KBxxxxxxxxxx/Knowledge" \
2
-u $TWILIO_API_KEY:$TWILIO_API_SECRET \
3
-H "Content-Type: application/json" \
4
-d '{
5
"name": "Product Documentation",
6
"description": "Official product guides and API documentation",
7
"source": {
8
"type": "web",
9
"url": {
10
"web": "https://example.com/docs",
11
"crawlDepth": 3,
12
"crawlPeriod": "WEEKLY"
13
}
14
}
15
}'

Step 3: Connect your knowledge base to AI tools

step-3-connect-your-knowledge-base-to-ai-tools page anchor

Use your knowledge base with Twilio Agent Connect (TAC) or Conversation Intelligence (CINTEL) to provide AI context.

Most Twilio AI features require you to pass the kbId in the tool's configuration or with the Assistant API.

Integrating with Twilio Agent Connect (TAC)

integrating-with-twilio-agent-connect-tac page anchor

To give your agents real-time suggestions based on your knowledge:

  1. In the Twilio Console, navigate to your Assistant configuration.
  2. Paste your kbId into the Knowledge Management section.
  3. When an agent is queried, TAC semantically searches this specific kbId to suggest a response.

Integrating with Conversation Intelligence (CINTEL)

integrating-with-conversation-intelligence-cintel page anchor

To use knowledge for automated analysis, attach your knowledge base to an intelligence configuration. Make a PUT request to the Intelligence Configuration resource with your knowledge base ID in the context.knowledge.bases array:

1
curl -X PUT "https://intelligence.twilio.com/v3/ControlPlane/Configurations/<INTELLIGENCE_CONFIGURATION_ID>" \
2
-u $TWILIO_API_KEY:$TWILIO_API_SECRET \
3
-H "Content-Type: application/json" \
4
-d '{
5
"displayName": "real-time-intelligence-config",
6
"description": "Intelligence configuration with knowledge context",
7
"rules": [
8
{
9
"operators": [
10
{
11
"id": "<OPERATOR_ID>"
12
}
13
],
14
"triggers": [
15
{
16
"on": "COMMUNICATION",
17
"parameters": {
18
"count": 2
19
}
20
}
21
],
22
"actions": [
23
{
24
"type": "WEBHOOK",
25
"method": "POST",
26
"url": "https://your-webhook-endpoint.com/rule-action"
27
}
28
],
29
"context": {
30
"memory": {
31
"enabled": true
32
},
33
"knowledge": {
34
"bases": [
35
"KBxxxxxxxxxx"
36
]
37
}
38
}
39
}
40
]
41
}'

For step-by-step instructions, see Create an intelligence configuration.

Using Knowledge in a language operator

using-knowledge-in-a-language-operator page anchor

After linking your knowledge base, you can use Custom Language Operators to access this data as Context. In your Operator definition, enable knowledge_retrieval. The AI then:

  1. Listens to the live conversation.
  2. Searches your knowledge base for relevant facts. For example, "What is our 30-day refund policy?"
  3. Determines if the agent is providing information that matches your documentation.

For more information, see Language Operators.


Best practices for AI-friendly knowledge sources

best-practices-for-ai-friendly-knowledge-sources page anchor

To ensure your AI tools provide accurate answers and avoid hallucinations:

  • Remove contradictory content: Sources with conflicting information confuse semantic search and increase hallucination risk. Review and reconcile any duplicate or conflicting information before adding to your knowledge base.
  • Use consistent terminology: Define key terms once and use them consistently throughout your sources. For example, use "refund policy" or "return policy" consistently, not both interchangeably.
  • Avoid speculative content: Stick to facts and documented information. Avoid marketing language, opinions, or phrases like "likely," "probably," or "expected to" that the AI might treat as definitive facts.
  • Chunk content: When using text sources, keep snippets focused and organized. Break large documents into logical sections by topic instead of pasting entire manuals into one field.
  • Use clear formatting: Use Markdown-style headers in raw text. This helps the semantic indexer understand your content hierarchy.
  • Set recrawl frequency: If your website changes frequently, set crawlPeriod to WEEKLY to keep the AI up to date with your latest information.
  • Write descriptive source names: Give each knowledge source a clear description. CINTEL uses these descriptions to determine which source is most relevant to specific conversation topics.
  • Configure permissions: Ensure your API key has the appropriate ControlPlane permissions to read and write to knowledge resources.