Labsco
openai logo

twilio-enterprise-knowledge

✓ Official4,081

by openai · part of openai/plugins

Add knowledge retrieval to AI agents using Twilio's Enterprise Knowledge product. Enterprise Knowledge is a centralized, searchable repository of your organization's documents, websites, and content — FAQs, support policies, warranty terms, product catalogs. Current models don't have access to how you run your business today. Enterprise Knowledge gives agents a way to query this repository during a conversation and ground their responses in your actual approved source material. This skill covers

🧩 One of 7 skills in the openai/plugins package — works on its own, and pairs well with its siblings.

This is the playbook your agent receives when the skill activates — you don't need to read it to use the skill, but it's here to audit before installing.

Overview

Enterprise Knowledge gives AI and human agents access to your organization's actual source material during a conversation — FAQs, warranty policies, support scripts, product catalogs. Models trained on general data don't know how your business operates today; Enterprise Knowledge closes that gap by letting agents query a searchable repository of your approved content and inject accurate, up-to-date answers rather than hallucinated ones.

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 and captures institutional content: how your products work, what your policies say, what your agents are supposed to do. It is distinct from Conversation Memory, which is scoped to individual end-customers. The two are designed to be combined — enterprise content for accuracy and business practices, customer memory for personalization.

Auth: Basic AuthTWILIO_ACCOUNT_SID and TWILIO_AUTH_TOKEN.


Key Patterns

Combine Enterprise Knowledge with Conversation Memory Recall

For the best agent responses, combine both: Enterprise Knowledge for company content, Recall for individual customer history.

Python

# Run both in parallel
recall_res = requests.post(
    f"https://memory.twilio.com/v1/Services/{MEMORY_STORE_SID}/Profiles/{profile_id}/Recall",
    auth=(account_sid, auth_token),
    json={"query": user_query, "observationsLimit": 5}
)
search_res = requests.post(
    f"https://knowledge.twilio.com/v1/KnowledgeBases/{KB_ID}/Search",
    auth=(account_sid, auth_token),
    json={"query": user_query, "top": 3}
)

customer_history = "\n".join(o["content"] for o in recall_res.json().get("observations", []))
knowledge_chunks = "\n\n".join(c["content"] for c in search_res.json().get("chunks", []))

system_prompt = f"""Customer history:
{customer_history}

Relevant documentation:
{knowledge_chunks}"""

Refresh Stale Web Sources

Re-crawl a web source without changing its config:

requests.patch(
    f"https://knowledge.twilio.com/v1/KnowledgeBases/{kb_id}/Knowledge/{knowledge_id}?refresh=true",
    auth=(account_sid, auth_token),
    json={}
)
# Returns 202 — source re-queued for processing

Filter Search to Specific Sources

When your knowledge base has multiple sources (scripts, FAQs, policies), target search to the relevant one:

results = requests.post(
    f"https://knowledge.twilio.com/v1/KnowledgeBases/{kb_id}/Search",
    auth=(account_sid, auth_token),
    json={
        "query": "cancellation policy",
        "top": 5,
        "knowledgeIds": [policy_knowledge_id]
    }
).json()

Omit knowledgeIds to search across all sources in the knowledge base.

Inspect Processed Chunks

To audit what got indexed from a source:

chunks = requests.get(
    f"https://knowledge.twilio.com/v1/KnowledgeBases/{kb_id}/Knowledge/{knowledge_id}/Chunks",
    auth=(account_sid, auth_token),
    params={"pageSize": 50}
).json()

for chunk in chunks["chunks"]:
    print(chunk["content"][:100])

CANNOT

  • Cannot add sources before Knowledge Base is active — Creation is async (returns 202). Poll Location header until status: ACTIVE.
  • Cannot use one host for all operations — Management is on memory.twilio.com; sources and search are on knowledge.twilio.com. Wrong host returns 404.
  • Cannot include auth header when uploading to presigned URLimportUrl is already signed. Adding your auth header will fail.
  • Cannot use expired presigned URLsuploadExpiration is typically 1 hour. Upload promptly.
  • Cannot search before processing completes — Web crawl and file indexing are async (seconds to minutes). Poll status first.
  • Cannot use high crawl depth without performance impactcrawlDepth 1–10, default 2. Higher depths dramatically increase processing time.
  • Cannot exceed 16MB per file upload — Hard limit
  • Cannot exceed 185,000 characters per text source — Hard limit
  • Cannot retrieve more than 20 search results per querytop-K max is 20
  • Cannot use spaces or underscores in displayName — Alphanumeric and hyphens only (^[a-zA-Z0-9-]+$)
  • Cannot use Knowledge for customer-specific context — Knowledge is shared across all customers. Use twilio-customer-memory for per-customer context.
  • Cannot retry FAILED sources — Delete and recreate. No retry endpoint. Check chunk count after COMPLETED to verify extraction.

Next Steps

  • Per-customer context: twilio-customer-memory — combine with Enterprise Knowledge for full agent context (company knowledge + individual customer history)
  • Conversation Intelligence operators with enterprise context: twilio-conversation-intelligence — feed Enterprise Knowledge chunks into Conversation Intelligence operators to give them business context. Examples:
    • Script Adherence: index your approved call scripts as a knowledge source; the operator can evaluate agent compliance against the retrieved script for the current conversation type
    • Custom upsell classifier: index product offers, pricing tiers, or eligibility rules; a custom classification operator can use retrieved offer details to detect upsell opportunities mid-conversation
    • Next Best Response: retrieved policy or FAQ chunks injected alongside the operator prompt improve suggestion quality
  • Wire into a voice AI agent: twilio-voice-conversation-relay
  • TAC SDK integration: twilio-agent-connect
  • Debug integration issues: twilio-debugging-observability