[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill-openai-twilio-enterprise-knowledge":3,"mdc--931myl-key":36,"related-repo-openai-twilio-enterprise-knowledge":3528,"related-org-openai-twilio-enterprise-knowledge":3649},{"slug":4,"name":4,"fn":5,"description":6,"org":7,"tags":11,"stars":25,"repoUrl":26,"updatedAt":27,"license":28,"forks":29,"topics":30,"repo":31,"sourceUrl":34,"mdContent":35},"twilio-enterprise-knowledge","integrate Twilio Enterprise Knowledge","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 provisioning a Knowledge Base and uploading knowledge sources from web URLs, PDFs, and raw text, and running semantic search to retrieve relevant chunks at runtime. Enterprise Knowledge is shared across your organization — it captures what your organization knows and how it is meant to run. It is distinct from Conversation Memory (twilio-customer-memory), which is scoped to individual end-customers and captures what you know about a specific person. The two are designed to be combined: enterprise content for business practices, customer memory for personalization.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},"openai","OpenAI","https:\u002F\u002Fpexgzepcugksgbtrxkhf.supabase.co\u002Fstorage\u002Fv1\u002Fobject\u002Fpublic\u002Forg-logos\u002Fopenai.png",[12,16,19,22],{"name":13,"slug":14,"type":15},"Knowledge Management","knowledge-management","tag",{"name":17,"slug":18,"type":15},"Search","search",{"name":20,"slug":21,"type":15},"Agents","agents",{"name":23,"slug":24,"type":15},"Twilio","twilio",3992,"https:\u002F\u002Fgithub.com\u002Fopenai\u002Fplugins","2026-06-30T19:00:57.102",null,465,[],{"repoUrl":26,"stars":25,"forks":29,"topics":32,"description":33},[],"OpenAI Plugins","https:\u002F\u002Fgithub.com\u002Fopenai\u002Fplugins\u002Ftree\u002FHEAD\u002Fplugins\u002Ftwilio-developer-kit\u002Fskills\u002Ftwilio-enterprise-knowledge","---\nname: twilio-enterprise-knowledge\ndescription: >\n  Add knowledge retrieval to AI agents using Twilio's Enterprise Knowledge\n  product. Enterprise Knowledge is a centralized, searchable repository of your\n  organization's documents, websites, and content — FAQs, support policies,\n  warranty terms, product catalogs. Current models don't have access to how you\n  run your business today. Enterprise Knowledge gives agents a way to query this\n  repository during a conversation and ground their responses in your actual\n  approved source material. This skill covers provisioning a Knowledge Base and\n  uploading knowledge sources from web URLs, PDFs, and raw text, and running\n  semantic search to retrieve relevant chunks at runtime. Enterprise Knowledge is\n  shared across your organization — it captures what your organization knows and\n  how it is meant to run. It is distinct from Conversation Memory\n  (twilio-customer-memory), which is scoped to individual end-customers and\n  captures what you know about a specific person. The two are designed to be\n  combined: enterprise content for business practices, customer memory for\n  personalization.\n---\n\n## Overview\n\nEnterprise 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.\n\n```\nYour content (web\u002FPDF\u002Ftext) → Knowledge Base → Indexed chunks\nAgent query → Search → Ranked chunks → Inject into LLM prompt\n```\n\nEnterprise 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.\n\n**Auth: Basic Auth** — `TWILIO_ACCOUNT_SID` and `TWILIO_AUTH_TOKEN`.\n\n---\n\n## Prerequisites\n\n- Twilio account with Enterprise Knowledge access (requires enablement)\n  — New to Twilio? See `twilio-account-setup`\n- `TWILIO_ACCOUNT_SID` and `TWILIO_AUTH_TOKEN` — see `twilio-iam-auth-setup`\n\n---\n\n## Quickstart\n\n### Step 1 — Create a Knowledge Base\n\nKnowledge Bases are containers for knowledge sources. Creation is async — returns 202, poll the `Location` header until `status: ACTIVE`.\n\n**Python**\n```python\nimport os, requests, time\n\naccount_sid = os.environ[\"TWILIO_ACCOUNT_SID\"]\nauth_token = os.environ[\"TWILIO_AUTH_TOKEN\"]\n\nres = requests.post(\n    \"https:\u002F\u002Fmemory.twilio.com\u002Fv1\u002FControlPlane\u002FKnowledgeBases\",\n    auth=(account_sid, auth_token),\n    json={\n        \"displayName\": \"product-docs\",          # alphanumeric + hyphens only\n        \"description\": \"Product documentation for customer support agents\"\n    }\n)\n\noperation_url = res.headers[\"Location\"]\n\n# Poll until ready\nwhile True:\n    kb = requests.get(operation_url, auth=(account_sid, auth_token)).json()\n    if kb.get(\"status\") == \"ACTIVE\":\n        kb_id = kb[\"id\"]\n        break\n    if kb.get(\"status\") == \"FAILED\":\n        raise Exception(\"Knowledge Base creation failed\")\n    time.sleep(2)\n\nprint(kb_id)\n```\n\n**Node.js**\n```javascript\nconst accountSid = process.env.TWILIO_ACCOUNT_SID;\nconst authToken = process.env.TWILIO_AUTH_TOKEN;\nconst authHeader = \"Basic \" + btoa(`${accountSid}:${authToken}`);\n\nconst res = await fetch(\"https:\u002F\u002Fmemory.twilio.com\u002Fv1\u002FControlPlane\u002FKnowledgeBases\", {\n    method: \"POST\",\n    headers: {\n        \"Authorization\": authHeader,\n        \"Content-Type\": \"application\u002Fjson\",\n    },\n    body: JSON.stringify({\n        displayName: \"product-docs\",\n        description: \"Product documentation for customer support agents\",\n    }),\n});\n\nconst operationUrl = res.headers.get(\"Location\");\n\nlet kbId;\nwhile (true) {\n    const kb = await fetch(operationUrl, {\n        headers: { \"Authorization\": authHeader },\n    }).then(r => r.json());\n    if (kb.status === \"ACTIVE\") { kbId = kb.id; break; }\n    if (kb.status === \"FAILED\") throw new Error(\"Knowledge Base creation failed\");\n    await new Promise(r => setTimeout(r, 2000));\n}\n```\n\n### Step 2 — Add a Knowledge Source\n\nThree source types: **Web** (crawl a URL), **File** (upload PDF\u002FCSV\u002FMarkdown\u002Ftext), **Text** (inline raw text).\n\n#### Web source\n\n```python\nknowledge = requests.post(\n    f\"https:\u002F\u002Fknowledge.twilio.com\u002Fv1\u002FKnowledgeBases\u002F{kb_id}\u002FKnowledge\",\n    auth=(account_sid, auth_token),\n    json={\n        \"name\": \"Product Documentation\",\n        \"description\": \"Public product docs\",\n        \"source\": {\n            \"type\": \"Web\",\n            \"url\": \"https:\u002F\u002Fdocs.example.com\",\n            \"crawlDepth\": 3,           # 1–10, default 2\n            \"crawlPeriod\": \"WEEKLY\"    # WEEKLY | BIWEEKLY | MONTHLY | NEVER\n        }\n    }\n).json()\n\nknowledge_id = knowledge[\"id\"]\n```\n\n#### File source (PDF, CSV, Markdown, TSV, plain text — max 16MB)\n\n```python\n# Step 1: Create the source — returns a presigned upload URL\nknowledge = requests.post(\n    f\"https:\u002F\u002Fknowledge.twilio.com\u002Fv1\u002FKnowledgeBases\u002F{kb_id}\u002FKnowledge\",\n    auth=(account_sid, auth_token),\n    json={\n        \"name\": \"Company Handbook\",\n        \"source\": {\n            \"type\": \"File\",\n            \"fileName\": \"handbook.pdf\",\n            \"fileSize\": 2048576,\n            \"mimeType\": \"application\u002Fpdf\"\n        }\n    }\n).json()\n\nknowledge_id = knowledge[\"id\"]\nupload_url = knowledge[\"source\"][\"importUrl\"]   # presigned S3 URL\n\n# Step 2: PUT file to presigned URL — no auth header, URL is already signed\nwith open(\"handbook.pdf\", \"rb\") as f:\n    requests.put(upload_url, data=f, headers={\"Content-Type\": \"application\u002Fpdf\"})\n```\n\n#### Text source (inline content, max 185,000 chars)\n\n```python\nknowledge = requests.post(\n    f\"https:\u002F\u002Fknowledge.twilio.com\u002Fv1\u002FKnowledgeBases\u002F{kb_id}\u002FKnowledge\",\n    auth=(account_sid, auth_token),\n    json={\n        \"name\": \"Refund Policy\",\n        \"source\": {\n            \"type\": \"Text\",\n            \"content\": \"Our refund policy: customers may return items within 30 days...\"\n        }\n    }\n).json()\n```\n\n### Step 3 — Wait for Processing\n\nKnowledge sources are processed asynchronously. Poll until `status` is `COMPLETED`.\n\n```python\ndef wait_for_knowledge(kb_id, knowledge_id):\n    while True:\n        k = requests.get(\n            f\"https:\u002F\u002Fknowledge.twilio.com\u002Fv1\u002FKnowledgeBases\u002F{kb_id}\u002FKnowledge\u002F{knowledge_id}\",\n            auth=(account_sid, auth_token)\n        ).json()\n        if k[\"status\"] == \"COMPLETED\":\n            return k\n        if k[\"status\"] == \"FAILED\":\n            raise Exception(f\"Knowledge processing failed: {k}\")\n        time.sleep(3)\n\nwait_for_knowledge(kb_id, knowledge_id)\n```\n\nStatuses: `SCHEDULED` → `QUEUED` → `PROCESSING` → `COMPLETED` \u002F `FAILED`\n\n### Step 4 — Search and Inject into LLM\n\n**Python**\n```python\nresults = requests.post(\n    f\"https:\u002F\u002Fknowledge.twilio.com\u002Fv1\u002FKnowledgeBases\u002F{kb_id}\u002FSearch\",\n    auth=(account_sid, auth_token),\n    json={\n        \"query\": \"How do I reset my password?\",\n        \"top\": 5,                              # max 20\n        \"knowledgeIds\": [knowledge_id]         # optional — search specific sources\n    }\n).json()\n\nchunks = \"\\n\\n\".join(c[\"content\"] for c in results.get(\"chunks\", []))\n\nsystem_prompt = f\"\"\"You are a helpful support agent.\n\nRelevant knowledge:\n{chunks}\n\nAnswer the customer's question using only the above content.\"\"\"\n```\n\n**Node.js**\n```javascript\nconst results = await fetch(\n    `https:\u002F\u002Fknowledge.twilio.com\u002Fv1\u002FKnowledgeBases\u002F${kbId}\u002FSearch`,\n    {\n        method: \"POST\",\n        headers: {\n            \"Authorization\": authHeader,\n            \"Content-Type\": \"application\u002Fjson\",\n        },\n        body: JSON.stringify({\n            query: userMessage,\n            top: 5,\n            knowledgeIds: [knowledgeId],\n        }),\n    }\n).then(r => r.json());\n\nconst chunks = results.chunks.map(c => c.content).join(\"\\n\\n\");\nconst systemPrompt = `You are a helpful support agent.\\n\\nRelevant knowledge:\\n${chunks}`;\n```\n\n---\n\n## Key Patterns\n\n### Combine Enterprise Knowledge with Conversation Memory Recall\n\nFor the best agent responses, combine both: Enterprise Knowledge for company content, Recall for individual customer history.\n\n**Python**\n```python\n# Run both in parallel\nrecall_res = requests.post(\n    f\"https:\u002F\u002Fmemory.twilio.com\u002Fv1\u002FServices\u002F{MEMORY_STORE_SID}\u002FProfiles\u002F{profile_id}\u002FRecall\",\n    auth=(account_sid, auth_token),\n    json={\"query\": user_query, \"observationsLimit\": 5}\n)\nsearch_res = requests.post(\n    f\"https:\u002F\u002Fknowledge.twilio.com\u002Fv1\u002FKnowledgeBases\u002F{KB_ID}\u002FSearch\",\n    auth=(account_sid, auth_token),\n    json={\"query\": user_query, \"top\": 3}\n)\n\ncustomer_history = \"\\n\".join(o[\"content\"] for o in recall_res.json().get(\"observations\", []))\nknowledge_chunks = \"\\n\\n\".join(c[\"content\"] for c in search_res.json().get(\"chunks\", []))\n\nsystem_prompt = f\"\"\"Customer history:\n{customer_history}\n\nRelevant documentation:\n{knowledge_chunks}\"\"\"\n```\n\n### Refresh Stale Web Sources\n\nRe-crawl a web source without changing its config:\n\n```python\nrequests.patch(\n    f\"https:\u002F\u002Fknowledge.twilio.com\u002Fv1\u002FKnowledgeBases\u002F{kb_id}\u002FKnowledge\u002F{knowledge_id}?refresh=true\",\n    auth=(account_sid, auth_token),\n    json={}\n)\n# Returns 202 — source re-queued for processing\n```\n\n### Filter Search to Specific Sources\n\nWhen your knowledge base has multiple sources (scripts, FAQs, policies), target search to the relevant one:\n\n```python\nresults = requests.post(\n    f\"https:\u002F\u002Fknowledge.twilio.com\u002Fv1\u002FKnowledgeBases\u002F{kb_id}\u002FSearch\",\n    auth=(account_sid, auth_token),\n    json={\n        \"query\": \"cancellation policy\",\n        \"top\": 5,\n        \"knowledgeIds\": [policy_knowledge_id]\n    }\n).json()\n```\n\nOmit `knowledgeIds` to search across all sources in the knowledge base.\n\n### Inspect Processed Chunks\n\nTo audit what got indexed from a source:\n\n```python\nchunks = requests.get(\n    f\"https:\u002F\u002Fknowledge.twilio.com\u002Fv1\u002FKnowledgeBases\u002F{kb_id}\u002FKnowledge\u002F{knowledge_id}\u002FChunks\",\n    auth=(account_sid, auth_token),\n    params={\"pageSize\": 50}\n).json()\n\nfor chunk in chunks[\"chunks\"]:\n    print(chunk[\"content\"][:100])\n```\n\n---\n\n## CANNOT\n\n- **Cannot add sources before Knowledge Base is active** — Creation is async (returns 202). Poll `Location` header until `status: ACTIVE`.\n- **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.\n- **Cannot include auth header when uploading to presigned URL** — `importUrl` is already signed. Adding your auth header will fail.\n- **Cannot use expired presigned URLs** — `uploadExpiration` is typically 1 hour. Upload promptly.\n- **Cannot search before processing completes** — Web crawl and file indexing are async (seconds to minutes). Poll status first.\n- **Cannot use high crawl depth without performance impact** — `crawlDepth` 1–10, default 2. Higher depths dramatically increase processing time.\n- **Cannot exceed 16MB per file upload** — Hard limit\n- **Cannot exceed 185,000 characters per text source** — Hard limit\n- **Cannot retrieve more than 20 search results per query** — `top-K` max is 20\n- **Cannot use spaces or underscores in `displayName`** — Alphanumeric and hyphens only (`^[a-zA-Z0-9-]+$`)\n- **Cannot use Knowledge for customer-specific context** — Knowledge is shared across all customers. Use `twilio-customer-memory` for per-customer context.\n- **Cannot retry FAILED sources** — Delete and recreate. No retry endpoint. Check chunk count after `COMPLETED` to verify extraction.\n\n---\n\n## Next Steps\n\n- **Per-customer context:** `twilio-customer-memory` — combine with Enterprise Knowledge for full agent context (company knowledge + individual customer history)\n- **Conversation Intelligence operators with enterprise context:** `twilio-conversation-intelligence` — feed Enterprise Knowledge chunks into Conversation Intelligence operators to give them business context. Examples:\n  - **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\n  - **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\n  - **Next Best Response:** retrieved policy or FAQ chunks injected alongside the operator prompt improve suggestion quality\n- **Wire into a voice AI agent:** `twilio-voice-conversation-relay`\n- **TAC SDK integration:** `twilio-agent-connect`\n- **Debug integration issues:** `twilio-debugging-observability`\n",{"data":37,"body":38},{"name":4,"description":6},{"type":39,"children":40},"root",[41,50,56,69,74,101,105,111,149,152,158,165,185,193,444,452,1460,1466,1492,1499,1630,1636,1800,1806,1893,1899,1918,2028,2067,2073,2080,2223,2230,2756,2759,2765,2771,2776,2783,2943,2949,2954,3007,3013,3018,3091,3104,3110,3115,3183,3186,3192,3398,3401,3407,3522],{"type":42,"tag":43,"props":44,"children":46},"element","h2",{"id":45},"overview",[47],{"type":48,"value":49},"text","Overview",{"type":42,"tag":51,"props":52,"children":53},"p",{},[54],{"type":48,"value":55},"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.",{"type":42,"tag":57,"props":58,"children":62},"pre",{"className":59,"code":61,"language":48},[60],"language-text","Your content (web\u002FPDF\u002Ftext) → Knowledge Base → Indexed chunks\nAgent query → Search → Ranked chunks → Inject into LLM prompt\n",[63],{"type":42,"tag":64,"props":65,"children":67},"code",{"__ignoreMap":66},"",[68],{"type":48,"value":61},{"type":42,"tag":51,"props":70,"children":71},{},[72],{"type":48,"value":73},"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.",{"type":42,"tag":51,"props":75,"children":76},{},[77,83,85,91,93,99],{"type":42,"tag":78,"props":79,"children":80},"strong",{},[81],{"type":48,"value":82},"Auth: Basic Auth",{"type":48,"value":84}," — ",{"type":42,"tag":64,"props":86,"children":88},{"className":87},[],[89],{"type":48,"value":90},"TWILIO_ACCOUNT_SID",{"type":48,"value":92}," and ",{"type":42,"tag":64,"props":94,"children":96},{"className":95},[],[97],{"type":48,"value":98},"TWILIO_AUTH_TOKEN",{"type":48,"value":100},".",{"type":42,"tag":102,"props":103,"children":104},"hr",{},[],{"type":42,"tag":43,"props":106,"children":108},{"id":107},"prerequisites",[109],{"type":48,"value":110},"Prerequisites",{"type":42,"tag":112,"props":113,"children":114},"ul",{},[115,127],{"type":42,"tag":116,"props":117,"children":118},"li",{},[119,121],{"type":48,"value":120},"Twilio account with Enterprise Knowledge access (requires enablement)\n— New to Twilio? See ",{"type":42,"tag":64,"props":122,"children":124},{"className":123},[],[125],{"type":48,"value":126},"twilio-account-setup",{"type":42,"tag":116,"props":128,"children":129},{},[130,135,136,141,143],{"type":42,"tag":64,"props":131,"children":133},{"className":132},[],[134],{"type":48,"value":90},{"type":48,"value":92},{"type":42,"tag":64,"props":137,"children":139},{"className":138},[],[140],{"type":48,"value":98},{"type":48,"value":142}," — see ",{"type":42,"tag":64,"props":144,"children":146},{"className":145},[],[147],{"type":48,"value":148},"twilio-iam-auth-setup",{"type":42,"tag":102,"props":150,"children":151},{},[],{"type":42,"tag":43,"props":153,"children":155},{"id":154},"quickstart",[156],{"type":48,"value":157},"Quickstart",{"type":42,"tag":159,"props":160,"children":162},"h3",{"id":161},"step-1-create-a-knowledge-base",[163],{"type":48,"value":164},"Step 1 — Create a Knowledge Base",{"type":42,"tag":51,"props":166,"children":167},{},[168,170,176,178,184],{"type":48,"value":169},"Knowledge Bases are containers for knowledge sources. Creation is async — returns 202, poll the ",{"type":42,"tag":64,"props":171,"children":173},{"className":172},[],[174],{"type":48,"value":175},"Location",{"type":48,"value":177}," header until ",{"type":42,"tag":64,"props":179,"children":181},{"className":180},[],[182],{"type":48,"value":183},"status: ACTIVE",{"type":48,"value":100},{"type":42,"tag":51,"props":186,"children":187},{},[188],{"type":42,"tag":78,"props":189,"children":190},{},[191],{"type":48,"value":192},"Python",{"type":42,"tag":57,"props":194,"children":198},{"className":195,"code":196,"language":197,"meta":66,"style":66},"language-python shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","import os, requests, time\n\naccount_sid = os.environ[\"TWILIO_ACCOUNT_SID\"]\nauth_token = os.environ[\"TWILIO_AUTH_TOKEN\"]\n\nres = requests.post(\n    \"https:\u002F\u002Fmemory.twilio.com\u002Fv1\u002FControlPlane\u002FKnowledgeBases\",\n    auth=(account_sid, auth_token),\n    json={\n        \"displayName\": \"product-docs\",          # alphanumeric + hyphens only\n        \"description\": \"Product documentation for customer support agents\"\n    }\n)\n\noperation_url = res.headers[\"Location\"]\n\n# Poll until ready\nwhile True:\n    kb = requests.get(operation_url, auth=(account_sid, auth_token)).json()\n    if kb.get(\"status\") == \"ACTIVE\":\n        kb_id = kb[\"id\"]\n        break\n    if kb.get(\"status\") == \"FAILED\":\n        raise Exception(\"Knowledge Base creation failed\")\n    time.sleep(2)\n\nprint(kb_id)\n","python",[199],{"type":42,"tag":64,"props":200,"children":201},{"__ignoreMap":66},[202,213,223,232,241,249,258,267,276,285,294,303,312,321,329,338,346,355,364,373,382,391,400,409,418,427,435],{"type":42,"tag":203,"props":204,"children":207},"span",{"class":205,"line":206},"line",1,[208],{"type":42,"tag":203,"props":209,"children":210},{},[211],{"type":48,"value":212},"import os, requests, time\n",{"type":42,"tag":203,"props":214,"children":216},{"class":205,"line":215},2,[217],{"type":42,"tag":203,"props":218,"children":220},{"emptyLinePlaceholder":219},true,[221],{"type":48,"value":222},"\n",{"type":42,"tag":203,"props":224,"children":226},{"class":205,"line":225},3,[227],{"type":42,"tag":203,"props":228,"children":229},{},[230],{"type":48,"value":231},"account_sid = os.environ[\"TWILIO_ACCOUNT_SID\"]\n",{"type":42,"tag":203,"props":233,"children":235},{"class":205,"line":234},4,[236],{"type":42,"tag":203,"props":237,"children":238},{},[239],{"type":48,"value":240},"auth_token = os.environ[\"TWILIO_AUTH_TOKEN\"]\n",{"type":42,"tag":203,"props":242,"children":244},{"class":205,"line":243},5,[245],{"type":42,"tag":203,"props":246,"children":247},{"emptyLinePlaceholder":219},[248],{"type":48,"value":222},{"type":42,"tag":203,"props":250,"children":252},{"class":205,"line":251},6,[253],{"type":42,"tag":203,"props":254,"children":255},{},[256],{"type":48,"value":257},"res = requests.post(\n",{"type":42,"tag":203,"props":259,"children":261},{"class":205,"line":260},7,[262],{"type":42,"tag":203,"props":263,"children":264},{},[265],{"type":48,"value":266},"    \"https:\u002F\u002Fmemory.twilio.com\u002Fv1\u002FControlPlane\u002FKnowledgeBases\",\n",{"type":42,"tag":203,"props":268,"children":270},{"class":205,"line":269},8,[271],{"type":42,"tag":203,"props":272,"children":273},{},[274],{"type":48,"value":275},"    auth=(account_sid, auth_token),\n",{"type":42,"tag":203,"props":277,"children":279},{"class":205,"line":278},9,[280],{"type":42,"tag":203,"props":281,"children":282},{},[283],{"type":48,"value":284},"    json={\n",{"type":42,"tag":203,"props":286,"children":288},{"class":205,"line":287},10,[289],{"type":42,"tag":203,"props":290,"children":291},{},[292],{"type":48,"value":293},"        \"displayName\": \"product-docs\",          # alphanumeric + hyphens only\n",{"type":42,"tag":203,"props":295,"children":297},{"class":205,"line":296},11,[298],{"type":42,"tag":203,"props":299,"children":300},{},[301],{"type":48,"value":302},"        \"description\": \"Product documentation for customer support agents\"\n",{"type":42,"tag":203,"props":304,"children":306},{"class":205,"line":305},12,[307],{"type":42,"tag":203,"props":308,"children":309},{},[310],{"type":48,"value":311},"    }\n",{"type":42,"tag":203,"props":313,"children":315},{"class":205,"line":314},13,[316],{"type":42,"tag":203,"props":317,"children":318},{},[319],{"type":48,"value":320},")\n",{"type":42,"tag":203,"props":322,"children":324},{"class":205,"line":323},14,[325],{"type":42,"tag":203,"props":326,"children":327},{"emptyLinePlaceholder":219},[328],{"type":48,"value":222},{"type":42,"tag":203,"props":330,"children":332},{"class":205,"line":331},15,[333],{"type":42,"tag":203,"props":334,"children":335},{},[336],{"type":48,"value":337},"operation_url = res.headers[\"Location\"]\n",{"type":42,"tag":203,"props":339,"children":341},{"class":205,"line":340},16,[342],{"type":42,"tag":203,"props":343,"children":344},{"emptyLinePlaceholder":219},[345],{"type":48,"value":222},{"type":42,"tag":203,"props":347,"children":349},{"class":205,"line":348},17,[350],{"type":42,"tag":203,"props":351,"children":352},{},[353],{"type":48,"value":354},"# Poll until ready\n",{"type":42,"tag":203,"props":356,"children":358},{"class":205,"line":357},18,[359],{"type":42,"tag":203,"props":360,"children":361},{},[362],{"type":48,"value":363},"while True:\n",{"type":42,"tag":203,"props":365,"children":367},{"class":205,"line":366},19,[368],{"type":42,"tag":203,"props":369,"children":370},{},[371],{"type":48,"value":372},"    kb = requests.get(operation_url, auth=(account_sid, auth_token)).json()\n",{"type":42,"tag":203,"props":374,"children":376},{"class":205,"line":375},20,[377],{"type":42,"tag":203,"props":378,"children":379},{},[380],{"type":48,"value":381},"    if kb.get(\"status\") == \"ACTIVE\":\n",{"type":42,"tag":203,"props":383,"children":385},{"class":205,"line":384},21,[386],{"type":42,"tag":203,"props":387,"children":388},{},[389],{"type":48,"value":390},"        kb_id = kb[\"id\"]\n",{"type":42,"tag":203,"props":392,"children":394},{"class":205,"line":393},22,[395],{"type":42,"tag":203,"props":396,"children":397},{},[398],{"type":48,"value":399},"        break\n",{"type":42,"tag":203,"props":401,"children":403},{"class":205,"line":402},23,[404],{"type":42,"tag":203,"props":405,"children":406},{},[407],{"type":48,"value":408},"    if kb.get(\"status\") == \"FAILED\":\n",{"type":42,"tag":203,"props":410,"children":412},{"class":205,"line":411},24,[413],{"type":42,"tag":203,"props":414,"children":415},{},[416],{"type":48,"value":417},"        raise Exception(\"Knowledge Base creation failed\")\n",{"type":42,"tag":203,"props":419,"children":421},{"class":205,"line":420},25,[422],{"type":42,"tag":203,"props":423,"children":424},{},[425],{"type":48,"value":426},"    time.sleep(2)\n",{"type":42,"tag":203,"props":428,"children":430},{"class":205,"line":429},26,[431],{"type":42,"tag":203,"props":432,"children":433},{"emptyLinePlaceholder":219},[434],{"type":48,"value":222},{"type":42,"tag":203,"props":436,"children":438},{"class":205,"line":437},27,[439],{"type":42,"tag":203,"props":440,"children":441},{},[442],{"type":48,"value":443},"print(kb_id)\n",{"type":42,"tag":51,"props":445,"children":446},{},[447],{"type":42,"tag":78,"props":448,"children":449},{},[450],{"type":48,"value":451},"Node.js",{"type":42,"tag":57,"props":453,"children":457},{"className":454,"code":455,"language":456,"meta":66,"style":66},"language-javascript shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","const accountSid = process.env.TWILIO_ACCOUNT_SID;\nconst authToken = process.env.TWILIO_AUTH_TOKEN;\nconst authHeader = \"Basic \" + btoa(`${accountSid}:${authToken}`);\n\nconst res = await fetch(\"https:\u002F\u002Fmemory.twilio.com\u002Fv1\u002FControlPlane\u002FKnowledgeBases\", {\n    method: \"POST\",\n    headers: {\n        \"Authorization\": authHeader,\n        \"Content-Type\": \"application\u002Fjson\",\n    },\n    body: JSON.stringify({\n        displayName: \"product-docs\",\n        description: \"Product documentation for customer support agents\",\n    }),\n});\n\nconst operationUrl = res.headers.get(\"Location\");\n\nlet kbId;\nwhile (true) {\n    const kb = await fetch(operationUrl, {\n        headers: { \"Authorization\": authHeader },\n    }).then(r => r.json());\n    if (kb.status === \"ACTIVE\") { kbId = kb.id; break; }\n    if (kb.status === \"FAILED\") throw new Error(\"Knowledge Base creation failed\");\n    await new Promise(r => setTimeout(r, 2000));\n}\n","javascript",[458],{"type":42,"tag":64,"props":459,"children":460},{"__ignoreMap":66},[461,509,549,641,648,702,733,749,779,816,824,859,888,917,933,948,955,1018,1025,1042,1070,1113,1155,1213,1306,1390,1452],{"type":42,"tag":203,"props":462,"children":463},{"class":205,"line":206},[464,470,476,482,487,491,496,500,504],{"type":42,"tag":203,"props":465,"children":467},{"style":466},"--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA",[468],{"type":48,"value":469},"const",{"type":42,"tag":203,"props":471,"children":473},{"style":472},"--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8",[474],{"type":48,"value":475}," accountSid ",{"type":42,"tag":203,"props":477,"children":479},{"style":478},"--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF",[480],{"type":48,"value":481},"=",{"type":42,"tag":203,"props":483,"children":484},{"style":472},[485],{"type":48,"value":486}," process",{"type":42,"tag":203,"props":488,"children":489},{"style":478},[490],{"type":48,"value":100},{"type":42,"tag":203,"props":492,"children":493},{"style":472},[494],{"type":48,"value":495},"env",{"type":42,"tag":203,"props":497,"children":498},{"style":478},[499],{"type":48,"value":100},{"type":42,"tag":203,"props":501,"children":502},{"style":472},[503],{"type":48,"value":90},{"type":42,"tag":203,"props":505,"children":506},{"style":478},[507],{"type":48,"value":508},";\n",{"type":42,"tag":203,"props":510,"children":511},{"class":205,"line":215},[512,516,521,525,529,533,537,541,545],{"type":42,"tag":203,"props":513,"children":514},{"style":466},[515],{"type":48,"value":469},{"type":42,"tag":203,"props":517,"children":518},{"style":472},[519],{"type":48,"value":520}," authToken ",{"type":42,"tag":203,"props":522,"children":523},{"style":478},[524],{"type":48,"value":481},{"type":42,"tag":203,"props":526,"children":527},{"style":472},[528],{"type":48,"value":486},{"type":42,"tag":203,"props":530,"children":531},{"style":478},[532],{"type":48,"value":100},{"type":42,"tag":203,"props":534,"children":535},{"style":472},[536],{"type":48,"value":495},{"type":42,"tag":203,"props":538,"children":539},{"style":478},[540],{"type":48,"value":100},{"type":42,"tag":203,"props":542,"children":543},{"style":472},[544],{"type":48,"value":98},{"type":42,"tag":203,"props":546,"children":547},{"style":478},[548],{"type":48,"value":508},{"type":42,"tag":203,"props":550,"children":551},{"class":205,"line":225},[552,556,561,565,570,576,581,586,592,597,602,607,612,617,622,627,632,637],{"type":42,"tag":203,"props":553,"children":554},{"style":466},[555],{"type":48,"value":469},{"type":42,"tag":203,"props":557,"children":558},{"style":472},[559],{"type":48,"value":560}," authHeader ",{"type":42,"tag":203,"props":562,"children":563},{"style":478},[564],{"type":48,"value":481},{"type":42,"tag":203,"props":566,"children":567},{"style":478},[568],{"type":48,"value":569}," \"",{"type":42,"tag":203,"props":571,"children":573},{"style":572},"--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D",[574],{"type":48,"value":575},"Basic ",{"type":42,"tag":203,"props":577,"children":578},{"style":478},[579],{"type":48,"value":580},"\"",{"type":42,"tag":203,"props":582,"children":583},{"style":478},[584],{"type":48,"value":585}," +",{"type":42,"tag":203,"props":587,"children":589},{"style":588},"--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF",[590],{"type":48,"value":591}," btoa",{"type":42,"tag":203,"props":593,"children":594},{"style":472},[595],{"type":48,"value":596},"(",{"type":42,"tag":203,"props":598,"children":599},{"style":478},[600],{"type":48,"value":601},"`${",{"type":42,"tag":203,"props":603,"children":604},{"style":472},[605],{"type":48,"value":606},"accountSid",{"type":42,"tag":203,"props":608,"children":609},{"style":478},[610],{"type":48,"value":611},"}",{"type":42,"tag":203,"props":613,"children":614},{"style":572},[615],{"type":48,"value":616},":",{"type":42,"tag":203,"props":618,"children":619},{"style":478},[620],{"type":48,"value":621},"${",{"type":42,"tag":203,"props":623,"children":624},{"style":472},[625],{"type":48,"value":626},"authToken",{"type":42,"tag":203,"props":628,"children":629},{"style":478},[630],{"type":48,"value":631},"}`",{"type":42,"tag":203,"props":633,"children":634},{"style":472},[635],{"type":48,"value":636},")",{"type":42,"tag":203,"props":638,"children":639},{"style":478},[640],{"type":48,"value":508},{"type":42,"tag":203,"props":642,"children":643},{"class":205,"line":234},[644],{"type":42,"tag":203,"props":645,"children":646},{"emptyLinePlaceholder":219},[647],{"type":48,"value":222},{"type":42,"tag":203,"props":649,"children":650},{"class":205,"line":243},[651,655,660,664,670,675,679,683,688,692,697],{"type":42,"tag":203,"props":652,"children":653},{"style":466},[654],{"type":48,"value":469},{"type":42,"tag":203,"props":656,"children":657},{"style":472},[658],{"type":48,"value":659}," res ",{"type":42,"tag":203,"props":661,"children":662},{"style":478},[663],{"type":48,"value":481},{"type":42,"tag":203,"props":665,"children":667},{"style":666},"--shiki-light:#39ADB5;--shiki-light-font-style:italic;--shiki-default:#89DDFF;--shiki-default-font-style:italic;--shiki-dark:#89DDFF;--shiki-dark-font-style:italic",[668],{"type":48,"value":669}," await",{"type":42,"tag":203,"props":671,"children":672},{"style":588},[673],{"type":48,"value":674}," fetch",{"type":42,"tag":203,"props":676,"children":677},{"style":472},[678],{"type":48,"value":596},{"type":42,"tag":203,"props":680,"children":681},{"style":478},[682],{"type":48,"value":580},{"type":42,"tag":203,"props":684,"children":685},{"style":572},[686],{"type":48,"value":687},"https:\u002F\u002Fmemory.twilio.com\u002Fv1\u002FControlPlane\u002FKnowledgeBases",{"type":42,"tag":203,"props":689,"children":690},{"style":478},[691],{"type":48,"value":580},{"type":42,"tag":203,"props":693,"children":694},{"style":478},[695],{"type":48,"value":696},",",{"type":42,"tag":203,"props":698,"children":699},{"style":478},[700],{"type":48,"value":701}," {\n",{"type":42,"tag":203,"props":703,"children":704},{"class":205,"line":251},[705,711,715,719,724,728],{"type":42,"tag":203,"props":706,"children":708},{"style":707},"--shiki-light:#E53935;--shiki-default:#F07178;--shiki-dark:#F07178",[709],{"type":48,"value":710},"    method",{"type":42,"tag":203,"props":712,"children":713},{"style":478},[714],{"type":48,"value":616},{"type":42,"tag":203,"props":716,"children":717},{"style":478},[718],{"type":48,"value":569},{"type":42,"tag":203,"props":720,"children":721},{"style":572},[722],{"type":48,"value":723},"POST",{"type":42,"tag":203,"props":725,"children":726},{"style":478},[727],{"type":48,"value":580},{"type":42,"tag":203,"props":729,"children":730},{"style":478},[731],{"type":48,"value":732},",\n",{"type":42,"tag":203,"props":734,"children":735},{"class":205,"line":260},[736,741,745],{"type":42,"tag":203,"props":737,"children":738},{"style":707},[739],{"type":48,"value":740},"    headers",{"type":42,"tag":203,"props":742,"children":743},{"style":478},[744],{"type":48,"value":616},{"type":42,"tag":203,"props":746,"children":747},{"style":478},[748],{"type":48,"value":701},{"type":42,"tag":203,"props":750,"children":751},{"class":205,"line":269},[752,757,762,766,770,775],{"type":42,"tag":203,"props":753,"children":754},{"style":478},[755],{"type":48,"value":756},"        \"",{"type":42,"tag":203,"props":758,"children":759},{"style":707},[760],{"type":48,"value":761},"Authorization",{"type":42,"tag":203,"props":763,"children":764},{"style":478},[765],{"type":48,"value":580},{"type":42,"tag":203,"props":767,"children":768},{"style":478},[769],{"type":48,"value":616},{"type":42,"tag":203,"props":771,"children":772},{"style":472},[773],{"type":48,"value":774}," authHeader",{"type":42,"tag":203,"props":776,"children":777},{"style":478},[778],{"type":48,"value":732},{"type":42,"tag":203,"props":780,"children":781},{"class":205,"line":278},[782,786,791,795,799,803,808,812],{"type":42,"tag":203,"props":783,"children":784},{"style":478},[785],{"type":48,"value":756},{"type":42,"tag":203,"props":787,"children":788},{"style":707},[789],{"type":48,"value":790},"Content-Type",{"type":42,"tag":203,"props":792,"children":793},{"style":478},[794],{"type":48,"value":580},{"type":42,"tag":203,"props":796,"children":797},{"style":478},[798],{"type":48,"value":616},{"type":42,"tag":203,"props":800,"children":801},{"style":478},[802],{"type":48,"value":569},{"type":42,"tag":203,"props":804,"children":805},{"style":572},[806],{"type":48,"value":807},"application\u002Fjson",{"type":42,"tag":203,"props":809,"children":810},{"style":478},[811],{"type":48,"value":580},{"type":42,"tag":203,"props":813,"children":814},{"style":478},[815],{"type":48,"value":732},{"type":42,"tag":203,"props":817,"children":818},{"class":205,"line":287},[819],{"type":42,"tag":203,"props":820,"children":821},{"style":478},[822],{"type":48,"value":823},"    },\n",{"type":42,"tag":203,"props":825,"children":826},{"class":205,"line":296},[827,832,836,841,845,850,854],{"type":42,"tag":203,"props":828,"children":829},{"style":707},[830],{"type":48,"value":831},"    body",{"type":42,"tag":203,"props":833,"children":834},{"style":478},[835],{"type":48,"value":616},{"type":42,"tag":203,"props":837,"children":838},{"style":472},[839],{"type":48,"value":840}," JSON",{"type":42,"tag":203,"props":842,"children":843},{"style":478},[844],{"type":48,"value":100},{"type":42,"tag":203,"props":846,"children":847},{"style":588},[848],{"type":48,"value":849},"stringify",{"type":42,"tag":203,"props":851,"children":852},{"style":472},[853],{"type":48,"value":596},{"type":42,"tag":203,"props":855,"children":856},{"style":478},[857],{"type":48,"value":858},"{\n",{"type":42,"tag":203,"props":860,"children":861},{"class":205,"line":305},[862,867,871,875,880,884],{"type":42,"tag":203,"props":863,"children":864},{"style":707},[865],{"type":48,"value":866},"        displayName",{"type":42,"tag":203,"props":868,"children":869},{"style":478},[870],{"type":48,"value":616},{"type":42,"tag":203,"props":872,"children":873},{"style":478},[874],{"type":48,"value":569},{"type":42,"tag":203,"props":876,"children":877},{"style":572},[878],{"type":48,"value":879},"product-docs",{"type":42,"tag":203,"props":881,"children":882},{"style":478},[883],{"type":48,"value":580},{"type":42,"tag":203,"props":885,"children":886},{"style":478},[887],{"type":48,"value":732},{"type":42,"tag":203,"props":889,"children":890},{"class":205,"line":314},[891,896,900,904,909,913],{"type":42,"tag":203,"props":892,"children":893},{"style":707},[894],{"type":48,"value":895},"        description",{"type":42,"tag":203,"props":897,"children":898},{"style":478},[899],{"type":48,"value":616},{"type":42,"tag":203,"props":901,"children":902},{"style":478},[903],{"type":48,"value":569},{"type":42,"tag":203,"props":905,"children":906},{"style":572},[907],{"type":48,"value":908},"Product documentation for customer support agents",{"type":42,"tag":203,"props":910,"children":911},{"style":478},[912],{"type":48,"value":580},{"type":42,"tag":203,"props":914,"children":915},{"style":478},[916],{"type":48,"value":732},{"type":42,"tag":203,"props":918,"children":919},{"class":205,"line":323},[920,925,929],{"type":42,"tag":203,"props":921,"children":922},{"style":478},[923],{"type":48,"value":924},"    }",{"type":42,"tag":203,"props":926,"children":927},{"style":472},[928],{"type":48,"value":636},{"type":42,"tag":203,"props":930,"children":931},{"style":478},[932],{"type":48,"value":732},{"type":42,"tag":203,"props":934,"children":935},{"class":205,"line":331},[936,940,944],{"type":42,"tag":203,"props":937,"children":938},{"style":478},[939],{"type":48,"value":611},{"type":42,"tag":203,"props":941,"children":942},{"style":472},[943],{"type":48,"value":636},{"type":42,"tag":203,"props":945,"children":946},{"style":478},[947],{"type":48,"value":508},{"type":42,"tag":203,"props":949,"children":950},{"class":205,"line":340},[951],{"type":42,"tag":203,"props":952,"children":953},{"emptyLinePlaceholder":219},[954],{"type":48,"value":222},{"type":42,"tag":203,"props":956,"children":957},{"class":205,"line":348},[958,962,967,971,976,980,985,989,994,998,1002,1006,1010,1014],{"type":42,"tag":203,"props":959,"children":960},{"style":466},[961],{"type":48,"value":469},{"type":42,"tag":203,"props":963,"children":964},{"style":472},[965],{"type":48,"value":966}," operationUrl ",{"type":42,"tag":203,"props":968,"children":969},{"style":478},[970],{"type":48,"value":481},{"type":42,"tag":203,"props":972,"children":973},{"style":472},[974],{"type":48,"value":975}," res",{"type":42,"tag":203,"props":977,"children":978},{"style":478},[979],{"type":48,"value":100},{"type":42,"tag":203,"props":981,"children":982},{"style":472},[983],{"type":48,"value":984},"headers",{"type":42,"tag":203,"props":986,"children":987},{"style":478},[988],{"type":48,"value":100},{"type":42,"tag":203,"props":990,"children":991},{"style":588},[992],{"type":48,"value":993},"get",{"type":42,"tag":203,"props":995,"children":996},{"style":472},[997],{"type":48,"value":596},{"type":42,"tag":203,"props":999,"children":1000},{"style":478},[1001],{"type":48,"value":580},{"type":42,"tag":203,"props":1003,"children":1004},{"style":572},[1005],{"type":48,"value":175},{"type":42,"tag":203,"props":1007,"children":1008},{"style":478},[1009],{"type":48,"value":580},{"type":42,"tag":203,"props":1011,"children":1012},{"style":472},[1013],{"type":48,"value":636},{"type":42,"tag":203,"props":1015,"children":1016},{"style":478},[1017],{"type":48,"value":508},{"type":42,"tag":203,"props":1019,"children":1020},{"class":205,"line":357},[1021],{"type":42,"tag":203,"props":1022,"children":1023},{"emptyLinePlaceholder":219},[1024],{"type":48,"value":222},{"type":42,"tag":203,"props":1026,"children":1027},{"class":205,"line":366},[1028,1033,1038],{"type":42,"tag":203,"props":1029,"children":1030},{"style":466},[1031],{"type":48,"value":1032},"let",{"type":42,"tag":203,"props":1034,"children":1035},{"style":472},[1036],{"type":48,"value":1037}," kbId",{"type":42,"tag":203,"props":1039,"children":1040},{"style":478},[1041],{"type":48,"value":508},{"type":42,"tag":203,"props":1043,"children":1044},{"class":205,"line":375},[1045,1050,1055,1061,1066],{"type":42,"tag":203,"props":1046,"children":1047},{"style":666},[1048],{"type":48,"value":1049},"while",{"type":42,"tag":203,"props":1051,"children":1052},{"style":472},[1053],{"type":48,"value":1054}," (",{"type":42,"tag":203,"props":1056,"children":1058},{"style":1057},"--shiki-light:#FF5370;--shiki-default:#FF9CAC;--shiki-dark:#FF9CAC",[1059],{"type":48,"value":1060},"true",{"type":42,"tag":203,"props":1062,"children":1063},{"style":472},[1064],{"type":48,"value":1065},") ",{"type":42,"tag":203,"props":1067,"children":1068},{"style":478},[1069],{"type":48,"value":858},{"type":42,"tag":203,"props":1071,"children":1072},{"class":205,"line":384},[1073,1078,1083,1088,1092,1096,1100,1105,1109],{"type":42,"tag":203,"props":1074,"children":1075},{"style":466},[1076],{"type":48,"value":1077},"    const",{"type":42,"tag":203,"props":1079,"children":1080},{"style":472},[1081],{"type":48,"value":1082}," kb",{"type":42,"tag":203,"props":1084,"children":1085},{"style":478},[1086],{"type":48,"value":1087}," =",{"type":42,"tag":203,"props":1089,"children":1090},{"style":666},[1091],{"type":48,"value":669},{"type":42,"tag":203,"props":1093,"children":1094},{"style":588},[1095],{"type":48,"value":674},{"type":42,"tag":203,"props":1097,"children":1098},{"style":707},[1099],{"type":48,"value":596},{"type":42,"tag":203,"props":1101,"children":1102},{"style":472},[1103],{"type":48,"value":1104},"operationUrl",{"type":42,"tag":203,"props":1106,"children":1107},{"style":478},[1108],{"type":48,"value":696},{"type":42,"tag":203,"props":1110,"children":1111},{"style":478},[1112],{"type":48,"value":701},{"type":42,"tag":203,"props":1114,"children":1115},{"class":205,"line":393},[1116,1121,1125,1130,1134,1138,1142,1146,1150],{"type":42,"tag":203,"props":1117,"children":1118},{"style":707},[1119],{"type":48,"value":1120},"        headers",{"type":42,"tag":203,"props":1122,"children":1123},{"style":478},[1124],{"type":48,"value":616},{"type":42,"tag":203,"props":1126,"children":1127},{"style":478},[1128],{"type":48,"value":1129}," {",{"type":42,"tag":203,"props":1131,"children":1132},{"style":478},[1133],{"type":48,"value":569},{"type":42,"tag":203,"props":1135,"children":1136},{"style":707},[1137],{"type":48,"value":761},{"type":42,"tag":203,"props":1139,"children":1140},{"style":478},[1141],{"type":48,"value":580},{"type":42,"tag":203,"props":1143,"children":1144},{"style":478},[1145],{"type":48,"value":616},{"type":42,"tag":203,"props":1147,"children":1148},{"style":472},[1149],{"type":48,"value":774},{"type":42,"tag":203,"props":1151,"children":1152},{"style":478},[1153],{"type":48,"value":1154}," },\n",{"type":42,"tag":203,"props":1156,"children":1157},{"class":205,"line":402},[1158,1162,1166,1170,1175,1179,1185,1190,1195,1199,1204,1209],{"type":42,"tag":203,"props":1159,"children":1160},{"style":478},[1161],{"type":48,"value":924},{"type":42,"tag":203,"props":1163,"children":1164},{"style":707},[1165],{"type":48,"value":636},{"type":42,"tag":203,"props":1167,"children":1168},{"style":478},[1169],{"type":48,"value":100},{"type":42,"tag":203,"props":1171,"children":1172},{"style":588},[1173],{"type":48,"value":1174},"then",{"type":42,"tag":203,"props":1176,"children":1177},{"style":707},[1178],{"type":48,"value":596},{"type":42,"tag":203,"props":1180,"children":1182},{"style":1181},"--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#EEFFFF;--shiki-default-font-style:italic;--shiki-dark:#BABED8;--shiki-dark-font-style:italic",[1183],{"type":48,"value":1184},"r",{"type":42,"tag":203,"props":1186,"children":1187},{"style":466},[1188],{"type":48,"value":1189}," =>",{"type":42,"tag":203,"props":1191,"children":1192},{"style":472},[1193],{"type":48,"value":1194}," r",{"type":42,"tag":203,"props":1196,"children":1197},{"style":478},[1198],{"type":48,"value":100},{"type":42,"tag":203,"props":1200,"children":1201},{"style":588},[1202],{"type":48,"value":1203},"json",{"type":42,"tag":203,"props":1205,"children":1206},{"style":707},[1207],{"type":48,"value":1208},"())",{"type":42,"tag":203,"props":1210,"children":1211},{"style":478},[1212],{"type":48,"value":508},{"type":42,"tag":203,"props":1214,"children":1215},{"class":205,"line":411},[1216,1221,1225,1230,1234,1239,1244,1248,1253,1257,1261,1266,1270,1274,1278,1282,1287,1292,1297,1301],{"type":42,"tag":203,"props":1217,"children":1218},{"style":666},[1219],{"type":48,"value":1220},"    if",{"type":42,"tag":203,"props":1222,"children":1223},{"style":707},[1224],{"type":48,"value":1054},{"type":42,"tag":203,"props":1226,"children":1227},{"style":472},[1228],{"type":48,"value":1229},"kb",{"type":42,"tag":203,"props":1231,"children":1232},{"style":478},[1233],{"type":48,"value":100},{"type":42,"tag":203,"props":1235,"children":1236},{"style":472},[1237],{"type":48,"value":1238},"status",{"type":42,"tag":203,"props":1240,"children":1241},{"style":478},[1242],{"type":48,"value":1243}," ===",{"type":42,"tag":203,"props":1245,"children":1246},{"style":478},[1247],{"type":48,"value":569},{"type":42,"tag":203,"props":1249,"children":1250},{"style":572},[1251],{"type":48,"value":1252},"ACTIVE",{"type":42,"tag":203,"props":1254,"children":1255},{"style":478},[1256],{"type":48,"value":580},{"type":42,"tag":203,"props":1258,"children":1259},{"style":707},[1260],{"type":48,"value":1065},{"type":42,"tag":203,"props":1262,"children":1263},{"style":478},[1264],{"type":48,"value":1265},"{",{"type":42,"tag":203,"props":1267,"children":1268},{"style":472},[1269],{"type":48,"value":1037},{"type":42,"tag":203,"props":1271,"children":1272},{"style":478},[1273],{"type":48,"value":1087},{"type":42,"tag":203,"props":1275,"children":1276},{"style":472},[1277],{"type":48,"value":1082},{"type":42,"tag":203,"props":1279,"children":1280},{"style":478},[1281],{"type":48,"value":100},{"type":42,"tag":203,"props":1283,"children":1284},{"style":472},[1285],{"type":48,"value":1286},"id",{"type":42,"tag":203,"props":1288,"children":1289},{"style":478},[1290],{"type":48,"value":1291},";",{"type":42,"tag":203,"props":1293,"children":1294},{"style":666},[1295],{"type":48,"value":1296}," break",{"type":42,"tag":203,"props":1298,"children":1299},{"style":478},[1300],{"type":48,"value":1291},{"type":42,"tag":203,"props":1302,"children":1303},{"style":478},[1304],{"type":48,"value":1305}," }\n",{"type":42,"tag":203,"props":1307,"children":1308},{"class":205,"line":420},[1309,1313,1317,1321,1325,1329,1333,1337,1342,1346,1350,1355,1360,1365,1369,1373,1378,1382,1386],{"type":42,"tag":203,"props":1310,"children":1311},{"style":666},[1312],{"type":48,"value":1220},{"type":42,"tag":203,"props":1314,"children":1315},{"style":707},[1316],{"type":48,"value":1054},{"type":42,"tag":203,"props":1318,"children":1319},{"style":472},[1320],{"type":48,"value":1229},{"type":42,"tag":203,"props":1322,"children":1323},{"style":478},[1324],{"type":48,"value":100},{"type":42,"tag":203,"props":1326,"children":1327},{"style":472},[1328],{"type":48,"value":1238},{"type":42,"tag":203,"props":1330,"children":1331},{"style":478},[1332],{"type":48,"value":1243},{"type":42,"tag":203,"props":1334,"children":1335},{"style":478},[1336],{"type":48,"value":569},{"type":42,"tag":203,"props":1338,"children":1339},{"style":572},[1340],{"type":48,"value":1341},"FAILED",{"type":42,"tag":203,"props":1343,"children":1344},{"style":478},[1345],{"type":48,"value":580},{"type":42,"tag":203,"props":1347,"children":1348},{"style":707},[1349],{"type":48,"value":1065},{"type":42,"tag":203,"props":1351,"children":1352},{"style":666},[1353],{"type":48,"value":1354},"throw",{"type":42,"tag":203,"props":1356,"children":1357},{"style":478},[1358],{"type":48,"value":1359}," new",{"type":42,"tag":203,"props":1361,"children":1362},{"style":588},[1363],{"type":48,"value":1364}," Error",{"type":42,"tag":203,"props":1366,"children":1367},{"style":707},[1368],{"type":48,"value":596},{"type":42,"tag":203,"props":1370,"children":1371},{"style":478},[1372],{"type":48,"value":580},{"type":42,"tag":203,"props":1374,"children":1375},{"style":572},[1376],{"type":48,"value":1377},"Knowledge Base creation failed",{"type":42,"tag":203,"props":1379,"children":1380},{"style":478},[1381],{"type":48,"value":580},{"type":42,"tag":203,"props":1383,"children":1384},{"style":707},[1385],{"type":48,"value":636},{"type":42,"tag":203,"props":1387,"children":1388},{"style":478},[1389],{"type":48,"value":508},{"type":42,"tag":203,"props":1391,"children":1392},{"class":205,"line":429},[1393,1398,1402,1408,1412,1416,1420,1425,1429,1433,1437,1443,1448],{"type":42,"tag":203,"props":1394,"children":1395},{"style":666},[1396],{"type":48,"value":1397},"    await",{"type":42,"tag":203,"props":1399,"children":1400},{"style":478},[1401],{"type":48,"value":1359},{"type":42,"tag":203,"props":1403,"children":1405},{"style":1404},"--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B",[1406],{"type":48,"value":1407}," Promise",{"type":42,"tag":203,"props":1409,"children":1410},{"style":707},[1411],{"type":48,"value":596},{"type":42,"tag":203,"props":1413,"children":1414},{"style":1181},[1415],{"type":48,"value":1184},{"type":42,"tag":203,"props":1417,"children":1418},{"style":466},[1419],{"type":48,"value":1189},{"type":42,"tag":203,"props":1421,"children":1422},{"style":588},[1423],{"type":48,"value":1424}," setTimeout",{"type":42,"tag":203,"props":1426,"children":1427},{"style":707},[1428],{"type":48,"value":596},{"type":42,"tag":203,"props":1430,"children":1431},{"style":472},[1432],{"type":48,"value":1184},{"type":42,"tag":203,"props":1434,"children":1435},{"style":478},[1436],{"type":48,"value":696},{"type":42,"tag":203,"props":1438,"children":1440},{"style":1439},"--shiki-light:#F76D47;--shiki-default:#F78C6C;--shiki-dark:#F78C6C",[1441],{"type":48,"value":1442}," 2000",{"type":42,"tag":203,"props":1444,"children":1445},{"style":707},[1446],{"type":48,"value":1447},"))",{"type":42,"tag":203,"props":1449,"children":1450},{"style":478},[1451],{"type":48,"value":508},{"type":42,"tag":203,"props":1453,"children":1454},{"class":205,"line":437},[1455],{"type":42,"tag":203,"props":1456,"children":1457},{"style":478},[1458],{"type":48,"value":1459},"}\n",{"type":42,"tag":159,"props":1461,"children":1463},{"id":1462},"step-2-add-a-knowledge-source",[1464],{"type":48,"value":1465},"Step 2 — Add a Knowledge Source",{"type":42,"tag":51,"props":1467,"children":1468},{},[1469,1471,1476,1478,1483,1485,1490],{"type":48,"value":1470},"Three source types: ",{"type":42,"tag":78,"props":1472,"children":1473},{},[1474],{"type":48,"value":1475},"Web",{"type":48,"value":1477}," (crawl a URL), ",{"type":42,"tag":78,"props":1479,"children":1480},{},[1481],{"type":48,"value":1482},"File",{"type":48,"value":1484}," (upload PDF\u002FCSV\u002FMarkdown\u002Ftext), ",{"type":42,"tag":78,"props":1486,"children":1487},{},[1488],{"type":48,"value":1489},"Text",{"type":48,"value":1491}," (inline raw text).",{"type":42,"tag":1493,"props":1494,"children":1496},"h4",{"id":1495},"web-source",[1497],{"type":48,"value":1498},"Web source",{"type":42,"tag":57,"props":1500,"children":1502},{"className":195,"code":1501,"language":197,"meta":66,"style":66},"knowledge = requests.post(\n    f\"https:\u002F\u002Fknowledge.twilio.com\u002Fv1\u002FKnowledgeBases\u002F{kb_id}\u002FKnowledge\",\n    auth=(account_sid, auth_token),\n    json={\n        \"name\": \"Product Documentation\",\n        \"description\": \"Public product docs\",\n        \"source\": {\n            \"type\": \"Web\",\n            \"url\": \"https:\u002F\u002Fdocs.example.com\",\n            \"crawlDepth\": 3,           # 1–10, default 2\n            \"crawlPeriod\": \"WEEKLY\"    # WEEKLY | BIWEEKLY | MONTHLY | NEVER\n        }\n    }\n).json()\n\nknowledge_id = knowledge[\"id\"]\n",[1503],{"type":42,"tag":64,"props":1504,"children":1505},{"__ignoreMap":66},[1506,1514,1522,1529,1536,1544,1552,1560,1568,1576,1584,1592,1600,1607,1615,1622],{"type":42,"tag":203,"props":1507,"children":1508},{"class":205,"line":206},[1509],{"type":42,"tag":203,"props":1510,"children":1511},{},[1512],{"type":48,"value":1513},"knowledge = requests.post(\n",{"type":42,"tag":203,"props":1515,"children":1516},{"class":205,"line":215},[1517],{"type":42,"tag":203,"props":1518,"children":1519},{},[1520],{"type":48,"value":1521},"    f\"https:\u002F\u002Fknowledge.twilio.com\u002Fv1\u002FKnowledgeBases\u002F{kb_id}\u002FKnowledge\",\n",{"type":42,"tag":203,"props":1523,"children":1524},{"class":205,"line":225},[1525],{"type":42,"tag":203,"props":1526,"children":1527},{},[1528],{"type":48,"value":275},{"type":42,"tag":203,"props":1530,"children":1531},{"class":205,"line":234},[1532],{"type":42,"tag":203,"props":1533,"children":1534},{},[1535],{"type":48,"value":284},{"type":42,"tag":203,"props":1537,"children":1538},{"class":205,"line":243},[1539],{"type":42,"tag":203,"props":1540,"children":1541},{},[1542],{"type":48,"value":1543},"        \"name\": \"Product Documentation\",\n",{"type":42,"tag":203,"props":1545,"children":1546},{"class":205,"line":251},[1547],{"type":42,"tag":203,"props":1548,"children":1549},{},[1550],{"type":48,"value":1551},"        \"description\": \"Public product docs\",\n",{"type":42,"tag":203,"props":1553,"children":1554},{"class":205,"line":260},[1555],{"type":42,"tag":203,"props":1556,"children":1557},{},[1558],{"type":48,"value":1559},"        \"source\": {\n",{"type":42,"tag":203,"props":1561,"children":1562},{"class":205,"line":269},[1563],{"type":42,"tag":203,"props":1564,"children":1565},{},[1566],{"type":48,"value":1567},"            \"type\": \"Web\",\n",{"type":42,"tag":203,"props":1569,"children":1570},{"class":205,"line":278},[1571],{"type":42,"tag":203,"props":1572,"children":1573},{},[1574],{"type":48,"value":1575},"            \"url\": \"https:\u002F\u002Fdocs.example.com\",\n",{"type":42,"tag":203,"props":1577,"children":1578},{"class":205,"line":287},[1579],{"type":42,"tag":203,"props":1580,"children":1581},{},[1582],{"type":48,"value":1583},"            \"crawlDepth\": 3,           # 1–10, default 2\n",{"type":42,"tag":203,"props":1585,"children":1586},{"class":205,"line":296},[1587],{"type":42,"tag":203,"props":1588,"children":1589},{},[1590],{"type":48,"value":1591},"            \"crawlPeriod\": \"WEEKLY\"    # WEEKLY | BIWEEKLY | MONTHLY | NEVER\n",{"type":42,"tag":203,"props":1593,"children":1594},{"class":205,"line":305},[1595],{"type":42,"tag":203,"props":1596,"children":1597},{},[1598],{"type":48,"value":1599},"        }\n",{"type":42,"tag":203,"props":1601,"children":1602},{"class":205,"line":314},[1603],{"type":42,"tag":203,"props":1604,"children":1605},{},[1606],{"type":48,"value":311},{"type":42,"tag":203,"props":1608,"children":1609},{"class":205,"line":323},[1610],{"type":42,"tag":203,"props":1611,"children":1612},{},[1613],{"type":48,"value":1614},").json()\n",{"type":42,"tag":203,"props":1616,"children":1617},{"class":205,"line":331},[1618],{"type":42,"tag":203,"props":1619,"children":1620},{"emptyLinePlaceholder":219},[1621],{"type":48,"value":222},{"type":42,"tag":203,"props":1623,"children":1624},{"class":205,"line":340},[1625],{"type":42,"tag":203,"props":1626,"children":1627},{},[1628],{"type":48,"value":1629},"knowledge_id = knowledge[\"id\"]\n",{"type":42,"tag":1493,"props":1631,"children":1633},{"id":1632},"file-source-pdf-csv-markdown-tsv-plain-text-max-16mb",[1634],{"type":48,"value":1635},"File source (PDF, CSV, Markdown, TSV, plain text — max 16MB)",{"type":42,"tag":57,"props":1637,"children":1639},{"className":195,"code":1638,"language":197,"meta":66,"style":66},"# Step 1: Create the source — returns a presigned upload URL\nknowledge = requests.post(\n    f\"https:\u002F\u002Fknowledge.twilio.com\u002Fv1\u002FKnowledgeBases\u002F{kb_id}\u002FKnowledge\",\n    auth=(account_sid, auth_token),\n    json={\n        \"name\": \"Company Handbook\",\n        \"source\": {\n            \"type\": \"File\",\n            \"fileName\": \"handbook.pdf\",\n            \"fileSize\": 2048576,\n            \"mimeType\": \"application\u002Fpdf\"\n        }\n    }\n).json()\n\nknowledge_id = knowledge[\"id\"]\nupload_url = knowledge[\"source\"][\"importUrl\"]   # presigned S3 URL\n\n# Step 2: PUT file to presigned URL — no auth header, URL is already signed\nwith open(\"handbook.pdf\", \"rb\") as f:\n    requests.put(upload_url, data=f, headers={\"Content-Type\": \"application\u002Fpdf\"})\n",[1640],{"type":42,"tag":64,"props":1641,"children":1642},{"__ignoreMap":66},[1643,1651,1658,1665,1672,1679,1687,1694,1702,1710,1718,1726,1733,1740,1747,1754,1761,1769,1776,1784,1792],{"type":42,"tag":203,"props":1644,"children":1645},{"class":205,"line":206},[1646],{"type":42,"tag":203,"props":1647,"children":1648},{},[1649],{"type":48,"value":1650},"# Step 1: Create the source — returns a presigned upload URL\n",{"type":42,"tag":203,"props":1652,"children":1653},{"class":205,"line":215},[1654],{"type":42,"tag":203,"props":1655,"children":1656},{},[1657],{"type":48,"value":1513},{"type":42,"tag":203,"props":1659,"children":1660},{"class":205,"line":225},[1661],{"type":42,"tag":203,"props":1662,"children":1663},{},[1664],{"type":48,"value":1521},{"type":42,"tag":203,"props":1666,"children":1667},{"class":205,"line":234},[1668],{"type":42,"tag":203,"props":1669,"children":1670},{},[1671],{"type":48,"value":275},{"type":42,"tag":203,"props":1673,"children":1674},{"class":205,"line":243},[1675],{"type":42,"tag":203,"props":1676,"children":1677},{},[1678],{"type":48,"value":284},{"type":42,"tag":203,"props":1680,"children":1681},{"class":205,"line":251},[1682],{"type":42,"tag":203,"props":1683,"children":1684},{},[1685],{"type":48,"value":1686},"        \"name\": \"Company Handbook\",\n",{"type":42,"tag":203,"props":1688,"children":1689},{"class":205,"line":260},[1690],{"type":42,"tag":203,"props":1691,"children":1692},{},[1693],{"type":48,"value":1559},{"type":42,"tag":203,"props":1695,"children":1696},{"class":205,"line":269},[1697],{"type":42,"tag":203,"props":1698,"children":1699},{},[1700],{"type":48,"value":1701},"            \"type\": \"File\",\n",{"type":42,"tag":203,"props":1703,"children":1704},{"class":205,"line":278},[1705],{"type":42,"tag":203,"props":1706,"children":1707},{},[1708],{"type":48,"value":1709},"            \"fileName\": \"handbook.pdf\",\n",{"type":42,"tag":203,"props":1711,"children":1712},{"class":205,"line":287},[1713],{"type":42,"tag":203,"props":1714,"children":1715},{},[1716],{"type":48,"value":1717},"            \"fileSize\": 2048576,\n",{"type":42,"tag":203,"props":1719,"children":1720},{"class":205,"line":296},[1721],{"type":42,"tag":203,"props":1722,"children":1723},{},[1724],{"type":48,"value":1725},"            \"mimeType\": \"application\u002Fpdf\"\n",{"type":42,"tag":203,"props":1727,"children":1728},{"class":205,"line":305},[1729],{"type":42,"tag":203,"props":1730,"children":1731},{},[1732],{"type":48,"value":1599},{"type":42,"tag":203,"props":1734,"children":1735},{"class":205,"line":314},[1736],{"type":42,"tag":203,"props":1737,"children":1738},{},[1739],{"type":48,"value":311},{"type":42,"tag":203,"props":1741,"children":1742},{"class":205,"line":323},[1743],{"type":42,"tag":203,"props":1744,"children":1745},{},[1746],{"type":48,"value":1614},{"type":42,"tag":203,"props":1748,"children":1749},{"class":205,"line":331},[1750],{"type":42,"tag":203,"props":1751,"children":1752},{"emptyLinePlaceholder":219},[1753],{"type":48,"value":222},{"type":42,"tag":203,"props":1755,"children":1756},{"class":205,"line":340},[1757],{"type":42,"tag":203,"props":1758,"children":1759},{},[1760],{"type":48,"value":1629},{"type":42,"tag":203,"props":1762,"children":1763},{"class":205,"line":348},[1764],{"type":42,"tag":203,"props":1765,"children":1766},{},[1767],{"type":48,"value":1768},"upload_url = knowledge[\"source\"][\"importUrl\"]   # presigned S3 URL\n",{"type":42,"tag":203,"props":1770,"children":1771},{"class":205,"line":357},[1772],{"type":42,"tag":203,"props":1773,"children":1774},{"emptyLinePlaceholder":219},[1775],{"type":48,"value":222},{"type":42,"tag":203,"props":1777,"children":1778},{"class":205,"line":366},[1779],{"type":42,"tag":203,"props":1780,"children":1781},{},[1782],{"type":48,"value":1783},"# Step 2: PUT file to presigned URL — no auth header, URL is already signed\n",{"type":42,"tag":203,"props":1785,"children":1786},{"class":205,"line":375},[1787],{"type":42,"tag":203,"props":1788,"children":1789},{},[1790],{"type":48,"value":1791},"with open(\"handbook.pdf\", \"rb\") as f:\n",{"type":42,"tag":203,"props":1793,"children":1794},{"class":205,"line":384},[1795],{"type":42,"tag":203,"props":1796,"children":1797},{},[1798],{"type":48,"value":1799},"    requests.put(upload_url, data=f, headers={\"Content-Type\": \"application\u002Fpdf\"})\n",{"type":42,"tag":1493,"props":1801,"children":1803},{"id":1802},"text-source-inline-content-max-185000-chars",[1804],{"type":48,"value":1805},"Text source (inline content, max 185,000 chars)",{"type":42,"tag":57,"props":1807,"children":1809},{"className":195,"code":1808,"language":197,"meta":66,"style":66},"knowledge = requests.post(\n    f\"https:\u002F\u002Fknowledge.twilio.com\u002Fv1\u002FKnowledgeBases\u002F{kb_id}\u002FKnowledge\",\n    auth=(account_sid, auth_token),\n    json={\n        \"name\": \"Refund Policy\",\n        \"source\": {\n            \"type\": \"Text\",\n            \"content\": \"Our refund policy: customers may return items within 30 days...\"\n        }\n    }\n).json()\n",[1810],{"type":42,"tag":64,"props":1811,"children":1812},{"__ignoreMap":66},[1813,1820,1827,1834,1841,1849,1856,1864,1872,1879,1886],{"type":42,"tag":203,"props":1814,"children":1815},{"class":205,"line":206},[1816],{"type":42,"tag":203,"props":1817,"children":1818},{},[1819],{"type":48,"value":1513},{"type":42,"tag":203,"props":1821,"children":1822},{"class":205,"line":215},[1823],{"type":42,"tag":203,"props":1824,"children":1825},{},[1826],{"type":48,"value":1521},{"type":42,"tag":203,"props":1828,"children":1829},{"class":205,"line":225},[1830],{"type":42,"tag":203,"props":1831,"children":1832},{},[1833],{"type":48,"value":275},{"type":42,"tag":203,"props":1835,"children":1836},{"class":205,"line":234},[1837],{"type":42,"tag":203,"props":1838,"children":1839},{},[1840],{"type":48,"value":284},{"type":42,"tag":203,"props":1842,"children":1843},{"class":205,"line":243},[1844],{"type":42,"tag":203,"props":1845,"children":1846},{},[1847],{"type":48,"value":1848},"        \"name\": \"Refund Policy\",\n",{"type":42,"tag":203,"props":1850,"children":1851},{"class":205,"line":251},[1852],{"type":42,"tag":203,"props":1853,"children":1854},{},[1855],{"type":48,"value":1559},{"type":42,"tag":203,"props":1857,"children":1858},{"class":205,"line":260},[1859],{"type":42,"tag":203,"props":1860,"children":1861},{},[1862],{"type":48,"value":1863},"            \"type\": \"Text\",\n",{"type":42,"tag":203,"props":1865,"children":1866},{"class":205,"line":269},[1867],{"type":42,"tag":203,"props":1868,"children":1869},{},[1870],{"type":48,"value":1871},"            \"content\": \"Our refund policy: customers may return items within 30 days...\"\n",{"type":42,"tag":203,"props":1873,"children":1874},{"class":205,"line":278},[1875],{"type":42,"tag":203,"props":1876,"children":1877},{},[1878],{"type":48,"value":1599},{"type":42,"tag":203,"props":1880,"children":1881},{"class":205,"line":287},[1882],{"type":42,"tag":203,"props":1883,"children":1884},{},[1885],{"type":48,"value":311},{"type":42,"tag":203,"props":1887,"children":1888},{"class":205,"line":296},[1889],{"type":42,"tag":203,"props":1890,"children":1891},{},[1892],{"type":48,"value":1614},{"type":42,"tag":159,"props":1894,"children":1896},{"id":1895},"step-3-wait-for-processing",[1897],{"type":48,"value":1898},"Step 3 — Wait for Processing",{"type":42,"tag":51,"props":1900,"children":1901},{},[1902,1904,1909,1911,1917],{"type":48,"value":1903},"Knowledge sources are processed asynchronously. Poll until ",{"type":42,"tag":64,"props":1905,"children":1907},{"className":1906},[],[1908],{"type":48,"value":1238},{"type":48,"value":1910}," is ",{"type":42,"tag":64,"props":1912,"children":1914},{"className":1913},[],[1915],{"type":48,"value":1916},"COMPLETED",{"type":48,"value":100},{"type":42,"tag":57,"props":1919,"children":1921},{"className":195,"code":1920,"language":197,"meta":66,"style":66},"def wait_for_knowledge(kb_id, knowledge_id):\n    while True:\n        k = requests.get(\n            f\"https:\u002F\u002Fknowledge.twilio.com\u002Fv1\u002FKnowledgeBases\u002F{kb_id}\u002FKnowledge\u002F{knowledge_id}\",\n            auth=(account_sid, auth_token)\n        ).json()\n        if k[\"status\"] == \"COMPLETED\":\n            return k\n        if k[\"status\"] == \"FAILED\":\n            raise Exception(f\"Knowledge processing failed: {k}\")\n        time.sleep(3)\n\nwait_for_knowledge(kb_id, knowledge_id)\n",[1922],{"type":42,"tag":64,"props":1923,"children":1924},{"__ignoreMap":66},[1925,1933,1941,1949,1957,1965,1973,1981,1989,1997,2005,2013,2020],{"type":42,"tag":203,"props":1926,"children":1927},{"class":205,"line":206},[1928],{"type":42,"tag":203,"props":1929,"children":1930},{},[1931],{"type":48,"value":1932},"def wait_for_knowledge(kb_id, knowledge_id):\n",{"type":42,"tag":203,"props":1934,"children":1935},{"class":205,"line":215},[1936],{"type":42,"tag":203,"props":1937,"children":1938},{},[1939],{"type":48,"value":1940},"    while True:\n",{"type":42,"tag":203,"props":1942,"children":1943},{"class":205,"line":225},[1944],{"type":42,"tag":203,"props":1945,"children":1946},{},[1947],{"type":48,"value":1948},"        k = requests.get(\n",{"type":42,"tag":203,"props":1950,"children":1951},{"class":205,"line":234},[1952],{"type":42,"tag":203,"props":1953,"children":1954},{},[1955],{"type":48,"value":1956},"            f\"https:\u002F\u002Fknowledge.twilio.com\u002Fv1\u002FKnowledgeBases\u002F{kb_id}\u002FKnowledge\u002F{knowledge_id}\",\n",{"type":42,"tag":203,"props":1958,"children":1959},{"class":205,"line":243},[1960],{"type":42,"tag":203,"props":1961,"children":1962},{},[1963],{"type":48,"value":1964},"            auth=(account_sid, auth_token)\n",{"type":42,"tag":203,"props":1966,"children":1967},{"class":205,"line":251},[1968],{"type":42,"tag":203,"props":1969,"children":1970},{},[1971],{"type":48,"value":1972},"        ).json()\n",{"type":42,"tag":203,"props":1974,"children":1975},{"class":205,"line":260},[1976],{"type":42,"tag":203,"props":1977,"children":1978},{},[1979],{"type":48,"value":1980},"        if k[\"status\"] == \"COMPLETED\":\n",{"type":42,"tag":203,"props":1982,"children":1983},{"class":205,"line":269},[1984],{"type":42,"tag":203,"props":1985,"children":1986},{},[1987],{"type":48,"value":1988},"            return k\n",{"type":42,"tag":203,"props":1990,"children":1991},{"class":205,"line":278},[1992],{"type":42,"tag":203,"props":1993,"children":1994},{},[1995],{"type":48,"value":1996},"        if k[\"status\"] == \"FAILED\":\n",{"type":42,"tag":203,"props":1998,"children":1999},{"class":205,"line":287},[2000],{"type":42,"tag":203,"props":2001,"children":2002},{},[2003],{"type":48,"value":2004},"            raise Exception(f\"Knowledge processing failed: {k}\")\n",{"type":42,"tag":203,"props":2006,"children":2007},{"class":205,"line":296},[2008],{"type":42,"tag":203,"props":2009,"children":2010},{},[2011],{"type":48,"value":2012},"        time.sleep(3)\n",{"type":42,"tag":203,"props":2014,"children":2015},{"class":205,"line":305},[2016],{"type":42,"tag":203,"props":2017,"children":2018},{"emptyLinePlaceholder":219},[2019],{"type":48,"value":222},{"type":42,"tag":203,"props":2021,"children":2022},{"class":205,"line":314},[2023],{"type":42,"tag":203,"props":2024,"children":2025},{},[2026],{"type":48,"value":2027},"wait_for_knowledge(kb_id, knowledge_id)\n",{"type":42,"tag":51,"props":2029,"children":2030},{},[2031,2033,2039,2041,2047,2048,2054,2055,2060,2062],{"type":48,"value":2032},"Statuses: ",{"type":42,"tag":64,"props":2034,"children":2036},{"className":2035},[],[2037],{"type":48,"value":2038},"SCHEDULED",{"type":48,"value":2040}," → ",{"type":42,"tag":64,"props":2042,"children":2044},{"className":2043},[],[2045],{"type":48,"value":2046},"QUEUED",{"type":48,"value":2040},{"type":42,"tag":64,"props":2049,"children":2051},{"className":2050},[],[2052],{"type":48,"value":2053},"PROCESSING",{"type":48,"value":2040},{"type":42,"tag":64,"props":2056,"children":2058},{"className":2057},[],[2059],{"type":48,"value":1916},{"type":48,"value":2061}," \u002F ",{"type":42,"tag":64,"props":2063,"children":2065},{"className":2064},[],[2066],{"type":48,"value":1341},{"type":42,"tag":159,"props":2068,"children":2070},{"id":2069},"step-4-search-and-inject-into-llm",[2071],{"type":48,"value":2072},"Step 4 — Search and Inject into LLM",{"type":42,"tag":51,"props":2074,"children":2075},{},[2076],{"type":42,"tag":78,"props":2077,"children":2078},{},[2079],{"type":48,"value":192},{"type":42,"tag":57,"props":2081,"children":2083},{"className":195,"code":2082,"language":197,"meta":66,"style":66},"results = requests.post(\n    f\"https:\u002F\u002Fknowledge.twilio.com\u002Fv1\u002FKnowledgeBases\u002F{kb_id}\u002FSearch\",\n    auth=(account_sid, auth_token),\n    json={\n        \"query\": \"How do I reset my password?\",\n        \"top\": 5,                              # max 20\n        \"knowledgeIds\": [knowledge_id]         # optional — search specific sources\n    }\n).json()\n\nchunks = \"\\n\\n\".join(c[\"content\"] for c in results.get(\"chunks\", []))\n\nsystem_prompt = f\"\"\"You are a helpful support agent.\n\nRelevant knowledge:\n{chunks}\n\nAnswer the customer's question using only the above content.\"\"\"\n",[2084],{"type":42,"tag":64,"props":2085,"children":2086},{"__ignoreMap":66},[2087,2095,2103,2110,2117,2125,2133,2141,2148,2155,2162,2170,2177,2185,2192,2200,2208,2215],{"type":42,"tag":203,"props":2088,"children":2089},{"class":205,"line":206},[2090],{"type":42,"tag":203,"props":2091,"children":2092},{},[2093],{"type":48,"value":2094},"results = requests.post(\n",{"type":42,"tag":203,"props":2096,"children":2097},{"class":205,"line":215},[2098],{"type":42,"tag":203,"props":2099,"children":2100},{},[2101],{"type":48,"value":2102},"    f\"https:\u002F\u002Fknowledge.twilio.com\u002Fv1\u002FKnowledgeBases\u002F{kb_id}\u002FSearch\",\n",{"type":42,"tag":203,"props":2104,"children":2105},{"class":205,"line":225},[2106],{"type":42,"tag":203,"props":2107,"children":2108},{},[2109],{"type":48,"value":275},{"type":42,"tag":203,"props":2111,"children":2112},{"class":205,"line":234},[2113],{"type":42,"tag":203,"props":2114,"children":2115},{},[2116],{"type":48,"value":284},{"type":42,"tag":203,"props":2118,"children":2119},{"class":205,"line":243},[2120],{"type":42,"tag":203,"props":2121,"children":2122},{},[2123],{"type":48,"value":2124},"        \"query\": \"How do I reset my password?\",\n",{"type":42,"tag":203,"props":2126,"children":2127},{"class":205,"line":251},[2128],{"type":42,"tag":203,"props":2129,"children":2130},{},[2131],{"type":48,"value":2132},"        \"top\": 5,                              # max 20\n",{"type":42,"tag":203,"props":2134,"children":2135},{"class":205,"line":260},[2136],{"type":42,"tag":203,"props":2137,"children":2138},{},[2139],{"type":48,"value":2140},"        \"knowledgeIds\": [knowledge_id]         # optional — search specific sources\n",{"type":42,"tag":203,"props":2142,"children":2143},{"class":205,"line":269},[2144],{"type":42,"tag":203,"props":2145,"children":2146},{},[2147],{"type":48,"value":311},{"type":42,"tag":203,"props":2149,"children":2150},{"class":205,"line":278},[2151],{"type":42,"tag":203,"props":2152,"children":2153},{},[2154],{"type":48,"value":1614},{"type":42,"tag":203,"props":2156,"children":2157},{"class":205,"line":287},[2158],{"type":42,"tag":203,"props":2159,"children":2160},{"emptyLinePlaceholder":219},[2161],{"type":48,"value":222},{"type":42,"tag":203,"props":2163,"children":2164},{"class":205,"line":296},[2165],{"type":42,"tag":203,"props":2166,"children":2167},{},[2168],{"type":48,"value":2169},"chunks = \"\\n\\n\".join(c[\"content\"] for c in results.get(\"chunks\", []))\n",{"type":42,"tag":203,"props":2171,"children":2172},{"class":205,"line":305},[2173],{"type":42,"tag":203,"props":2174,"children":2175},{"emptyLinePlaceholder":219},[2176],{"type":48,"value":222},{"type":42,"tag":203,"props":2178,"children":2179},{"class":205,"line":314},[2180],{"type":42,"tag":203,"props":2181,"children":2182},{},[2183],{"type":48,"value":2184},"system_prompt = f\"\"\"You are a helpful support agent.\n",{"type":42,"tag":203,"props":2186,"children":2187},{"class":205,"line":323},[2188],{"type":42,"tag":203,"props":2189,"children":2190},{"emptyLinePlaceholder":219},[2191],{"type":48,"value":222},{"type":42,"tag":203,"props":2193,"children":2194},{"class":205,"line":331},[2195],{"type":42,"tag":203,"props":2196,"children":2197},{},[2198],{"type":48,"value":2199},"Relevant knowledge:\n",{"type":42,"tag":203,"props":2201,"children":2202},{"class":205,"line":340},[2203],{"type":42,"tag":203,"props":2204,"children":2205},{},[2206],{"type":48,"value":2207},"{chunks}\n",{"type":42,"tag":203,"props":2209,"children":2210},{"class":205,"line":348},[2211],{"type":42,"tag":203,"props":2212,"children":2213},{"emptyLinePlaceholder":219},[2214],{"type":48,"value":222},{"type":42,"tag":203,"props":2216,"children":2217},{"class":205,"line":357},[2218],{"type":42,"tag":203,"props":2219,"children":2220},{},[2221],{"type":48,"value":2222},"Answer the customer's question using only the above content.\"\"\"\n",{"type":42,"tag":51,"props":2224,"children":2225},{},[2226],{"type":42,"tag":78,"props":2227,"children":2228},{},[2229],{"type":48,"value":451},{"type":42,"tag":57,"props":2231,"children":2233},{"className":454,"code":2232,"language":456,"meta":66,"style":66},"const results = await fetch(\n    `https:\u002F\u002Fknowledge.twilio.com\u002Fv1\u002FKnowledgeBases\u002F${kbId}\u002FSearch`,\n    {\n        method: \"POST\",\n        headers: {\n            \"Authorization\": authHeader,\n            \"Content-Type\": \"application\u002Fjson\",\n        },\n        body: JSON.stringify({\n            query: userMessage,\n            top: 5,\n            knowledgeIds: [knowledgeId],\n        }),\n    }\n).then(r => r.json());\n\nconst chunks = results.chunks.map(c => c.content).join(\"\\n\\n\");\nconst systemPrompt = `You are a helpful support agent.\\n\\nRelevant knowledge:\\n${chunks}`;\n",[2234],{"type":42,"tag":64,"props":2235,"children":2236},{"__ignoreMap":66},[2237,2266,2306,2314,2342,2357,2385,2420,2428,2460,2481,2502,2523,2539,2546,2593,2600,2700],{"type":42,"tag":203,"props":2238,"children":2239},{"class":205,"line":206},[2240,2244,2249,2253,2257,2261],{"type":42,"tag":203,"props":2241,"children":2242},{"style":466},[2243],{"type":48,"value":469},{"type":42,"tag":203,"props":2245,"children":2246},{"style":472},[2247],{"type":48,"value":2248}," results ",{"type":42,"tag":203,"props":2250,"children":2251},{"style":478},[2252],{"type":48,"value":481},{"type":42,"tag":203,"props":2254,"children":2255},{"style":666},[2256],{"type":48,"value":669},{"type":42,"tag":203,"props":2258,"children":2259},{"style":588},[2260],{"type":48,"value":674},{"type":42,"tag":203,"props":2262,"children":2263},{"style":472},[2264],{"type":48,"value":2265},"(\n",{"type":42,"tag":203,"props":2267,"children":2268},{"class":205,"line":215},[2269,2274,2279,2283,2288,2292,2297,2302],{"type":42,"tag":203,"props":2270,"children":2271},{"style":478},[2272],{"type":48,"value":2273},"    `",{"type":42,"tag":203,"props":2275,"children":2276},{"style":572},[2277],{"type":48,"value":2278},"https:\u002F\u002Fknowledge.twilio.com\u002Fv1\u002FKnowledgeBases\u002F",{"type":42,"tag":203,"props":2280,"children":2281},{"style":478},[2282],{"type":48,"value":621},{"type":42,"tag":203,"props":2284,"children":2285},{"style":472},[2286],{"type":48,"value":2287},"kbId",{"type":42,"tag":203,"props":2289,"children":2290},{"style":478},[2291],{"type":48,"value":611},{"type":42,"tag":203,"props":2293,"children":2294},{"style":572},[2295],{"type":48,"value":2296},"\u002FSearch",{"type":42,"tag":203,"props":2298,"children":2299},{"style":478},[2300],{"type":48,"value":2301},"`",{"type":42,"tag":203,"props":2303,"children":2304},{"style":478},[2305],{"type":48,"value":732},{"type":42,"tag":203,"props":2307,"children":2308},{"class":205,"line":225},[2309],{"type":42,"tag":203,"props":2310,"children":2311},{"style":478},[2312],{"type":48,"value":2313},"    {\n",{"type":42,"tag":203,"props":2315,"children":2316},{"class":205,"line":234},[2317,2322,2326,2330,2334,2338],{"type":42,"tag":203,"props":2318,"children":2319},{"style":707},[2320],{"type":48,"value":2321},"        method",{"type":42,"tag":203,"props":2323,"children":2324},{"style":478},[2325],{"type":48,"value":616},{"type":42,"tag":203,"props":2327,"children":2328},{"style":478},[2329],{"type":48,"value":569},{"type":42,"tag":203,"props":2331,"children":2332},{"style":572},[2333],{"type":48,"value":723},{"type":42,"tag":203,"props":2335,"children":2336},{"style":478},[2337],{"type":48,"value":580},{"type":42,"tag":203,"props":2339,"children":2340},{"style":478},[2341],{"type":48,"value":732},{"type":42,"tag":203,"props":2343,"children":2344},{"class":205,"line":243},[2345,2349,2353],{"type":42,"tag":203,"props":2346,"children":2347},{"style":707},[2348],{"type":48,"value":1120},{"type":42,"tag":203,"props":2350,"children":2351},{"style":478},[2352],{"type":48,"value":616},{"type":42,"tag":203,"props":2354,"children":2355},{"style":478},[2356],{"type":48,"value":701},{"type":42,"tag":203,"props":2358,"children":2359},{"class":205,"line":251},[2360,2365,2369,2373,2377,2381],{"type":42,"tag":203,"props":2361,"children":2362},{"style":478},[2363],{"type":48,"value":2364},"            \"",{"type":42,"tag":203,"props":2366,"children":2367},{"style":707},[2368],{"type":48,"value":761},{"type":42,"tag":203,"props":2370,"children":2371},{"style":478},[2372],{"type":48,"value":580},{"type":42,"tag":203,"props":2374,"children":2375},{"style":478},[2376],{"type":48,"value":616},{"type":42,"tag":203,"props":2378,"children":2379},{"style":472},[2380],{"type":48,"value":774},{"type":42,"tag":203,"props":2382,"children":2383},{"style":478},[2384],{"type":48,"value":732},{"type":42,"tag":203,"props":2386,"children":2387},{"class":205,"line":260},[2388,2392,2396,2400,2404,2408,2412,2416],{"type":42,"tag":203,"props":2389,"children":2390},{"style":478},[2391],{"type":48,"value":2364},{"type":42,"tag":203,"props":2393,"children":2394},{"style":707},[2395],{"type":48,"value":790},{"type":42,"tag":203,"props":2397,"children":2398},{"style":478},[2399],{"type":48,"value":580},{"type":42,"tag":203,"props":2401,"children":2402},{"style":478},[2403],{"type":48,"value":616},{"type":42,"tag":203,"props":2405,"children":2406},{"style":478},[2407],{"type":48,"value":569},{"type":42,"tag":203,"props":2409,"children":2410},{"style":572},[2411],{"type":48,"value":807},{"type":42,"tag":203,"props":2413,"children":2414},{"style":478},[2415],{"type":48,"value":580},{"type":42,"tag":203,"props":2417,"children":2418},{"style":478},[2419],{"type":48,"value":732},{"type":42,"tag":203,"props":2421,"children":2422},{"class":205,"line":269},[2423],{"type":42,"tag":203,"props":2424,"children":2425},{"style":478},[2426],{"type":48,"value":2427},"        },\n",{"type":42,"tag":203,"props":2429,"children":2430},{"class":205,"line":278},[2431,2436,2440,2444,2448,2452,2456],{"type":42,"tag":203,"props":2432,"children":2433},{"style":707},[2434],{"type":48,"value":2435},"        body",{"type":42,"tag":203,"props":2437,"children":2438},{"style":478},[2439],{"type":48,"value":616},{"type":42,"tag":203,"props":2441,"children":2442},{"style":472},[2443],{"type":48,"value":840},{"type":42,"tag":203,"props":2445,"children":2446},{"style":478},[2447],{"type":48,"value":100},{"type":42,"tag":203,"props":2449,"children":2450},{"style":588},[2451],{"type":48,"value":849},{"type":42,"tag":203,"props":2453,"children":2454},{"style":472},[2455],{"type":48,"value":596},{"type":42,"tag":203,"props":2457,"children":2458},{"style":478},[2459],{"type":48,"value":858},{"type":42,"tag":203,"props":2461,"children":2462},{"class":205,"line":287},[2463,2468,2472,2477],{"type":42,"tag":203,"props":2464,"children":2465},{"style":707},[2466],{"type":48,"value":2467},"            query",{"type":42,"tag":203,"props":2469,"children":2470},{"style":478},[2471],{"type":48,"value":616},{"type":42,"tag":203,"props":2473,"children":2474},{"style":472},[2475],{"type":48,"value":2476}," userMessage",{"type":42,"tag":203,"props":2478,"children":2479},{"style":478},[2480],{"type":48,"value":732},{"type":42,"tag":203,"props":2482,"children":2483},{"class":205,"line":296},[2484,2489,2493,2498],{"type":42,"tag":203,"props":2485,"children":2486},{"style":707},[2487],{"type":48,"value":2488},"            top",{"type":42,"tag":203,"props":2490,"children":2491},{"style":478},[2492],{"type":48,"value":616},{"type":42,"tag":203,"props":2494,"children":2495},{"style":1439},[2496],{"type":48,"value":2497}," 5",{"type":42,"tag":203,"props":2499,"children":2500},{"style":478},[2501],{"type":48,"value":732},{"type":42,"tag":203,"props":2503,"children":2504},{"class":205,"line":305},[2505,2510,2514,2519],{"type":42,"tag":203,"props":2506,"children":2507},{"style":707},[2508],{"type":48,"value":2509},"            knowledgeIds",{"type":42,"tag":203,"props":2511,"children":2512},{"style":478},[2513],{"type":48,"value":616},{"type":42,"tag":203,"props":2515,"children":2516},{"style":472},[2517],{"type":48,"value":2518}," [knowledgeId]",{"type":42,"tag":203,"props":2520,"children":2521},{"style":478},[2522],{"type":48,"value":732},{"type":42,"tag":203,"props":2524,"children":2525},{"class":205,"line":314},[2526,2531,2535],{"type":42,"tag":203,"props":2527,"children":2528},{"style":478},[2529],{"type":48,"value":2530},"        }",{"type":42,"tag":203,"props":2532,"children":2533},{"style":472},[2534],{"type":48,"value":636},{"type":42,"tag":203,"props":2536,"children":2537},{"style":478},[2538],{"type":48,"value":732},{"type":42,"tag":203,"props":2540,"children":2541},{"class":205,"line":323},[2542],{"type":42,"tag":203,"props":2543,"children":2544},{"style":478},[2545],{"type":48,"value":311},{"type":42,"tag":203,"props":2547,"children":2548},{"class":205,"line":331},[2549,2553,2557,2561,2565,2569,2573,2577,2581,2585,2589],{"type":42,"tag":203,"props":2550,"children":2551},{"style":472},[2552],{"type":48,"value":636},{"type":42,"tag":203,"props":2554,"children":2555},{"style":478},[2556],{"type":48,"value":100},{"type":42,"tag":203,"props":2558,"children":2559},{"style":588},[2560],{"type":48,"value":1174},{"type":42,"tag":203,"props":2562,"children":2563},{"style":472},[2564],{"type":48,"value":596},{"type":42,"tag":203,"props":2566,"children":2567},{"style":1181},[2568],{"type":48,"value":1184},{"type":42,"tag":203,"props":2570,"children":2571},{"style":466},[2572],{"type":48,"value":1189},{"type":42,"tag":203,"props":2574,"children":2575},{"style":472},[2576],{"type":48,"value":1194},{"type":42,"tag":203,"props":2578,"children":2579},{"style":478},[2580],{"type":48,"value":100},{"type":42,"tag":203,"props":2582,"children":2583},{"style":588},[2584],{"type":48,"value":1203},{"type":42,"tag":203,"props":2586,"children":2587},{"style":472},[2588],{"type":48,"value":1208},{"type":42,"tag":203,"props":2590,"children":2591},{"style":478},[2592],{"type":48,"value":508},{"type":42,"tag":203,"props":2594,"children":2595},{"class":205,"line":340},[2596],{"type":42,"tag":203,"props":2597,"children":2598},{"emptyLinePlaceholder":219},[2599],{"type":48,"value":222},{"type":42,"tag":203,"props":2601,"children":2602},{"class":205,"line":348},[2603,2607,2612,2616,2621,2625,2630,2634,2639,2643,2648,2652,2657,2661,2666,2670,2675,2679,2683,2688,2692,2696],{"type":42,"tag":203,"props":2604,"children":2605},{"style":466},[2606],{"type":48,"value":469},{"type":42,"tag":203,"props":2608,"children":2609},{"style":472},[2610],{"type":48,"value":2611}," chunks ",{"type":42,"tag":203,"props":2613,"children":2614},{"style":478},[2615],{"type":48,"value":481},{"type":42,"tag":203,"props":2617,"children":2618},{"style":472},[2619],{"type":48,"value":2620}," results",{"type":42,"tag":203,"props":2622,"children":2623},{"style":478},[2624],{"type":48,"value":100},{"type":42,"tag":203,"props":2626,"children":2627},{"style":472},[2628],{"type":48,"value":2629},"chunks",{"type":42,"tag":203,"props":2631,"children":2632},{"style":478},[2633],{"type":48,"value":100},{"type":42,"tag":203,"props":2635,"children":2636},{"style":588},[2637],{"type":48,"value":2638},"map",{"type":42,"tag":203,"props":2640,"children":2641},{"style":472},[2642],{"type":48,"value":596},{"type":42,"tag":203,"props":2644,"children":2645},{"style":1181},[2646],{"type":48,"value":2647},"c",{"type":42,"tag":203,"props":2649,"children":2650},{"style":466},[2651],{"type":48,"value":1189},{"type":42,"tag":203,"props":2653,"children":2654},{"style":472},[2655],{"type":48,"value":2656}," c",{"type":42,"tag":203,"props":2658,"children":2659},{"style":478},[2660],{"type":48,"value":100},{"type":42,"tag":203,"props":2662,"children":2663},{"style":472},[2664],{"type":48,"value":2665},"content)",{"type":42,"tag":203,"props":2667,"children":2668},{"style":478},[2669],{"type":48,"value":100},{"type":42,"tag":203,"props":2671,"children":2672},{"style":588},[2673],{"type":48,"value":2674},"join",{"type":42,"tag":203,"props":2676,"children":2677},{"style":472},[2678],{"type":48,"value":596},{"type":42,"tag":203,"props":2680,"children":2681},{"style":478},[2682],{"type":48,"value":580},{"type":42,"tag":203,"props":2684,"children":2685},{"style":472},[2686],{"type":48,"value":2687},"\\n\\n",{"type":42,"tag":203,"props":2689,"children":2690},{"style":478},[2691],{"type":48,"value":580},{"type":42,"tag":203,"props":2693,"children":2694},{"style":472},[2695],{"type":48,"value":636},{"type":42,"tag":203,"props":2697,"children":2698},{"style":478},[2699],{"type":48,"value":508},{"type":42,"tag":203,"props":2701,"children":2702},{"class":205,"line":357},[2703,2707,2712,2716,2721,2726,2730,2735,2740,2744,2748,2752],{"type":42,"tag":203,"props":2704,"children":2705},{"style":466},[2706],{"type":48,"value":469},{"type":42,"tag":203,"props":2708,"children":2709},{"style":472},[2710],{"type":48,"value":2711}," systemPrompt ",{"type":42,"tag":203,"props":2713,"children":2714},{"style":478},[2715],{"type":48,"value":481},{"type":42,"tag":203,"props":2717,"children":2718},{"style":478},[2719],{"type":48,"value":2720}," `",{"type":42,"tag":203,"props":2722,"children":2723},{"style":572},[2724],{"type":48,"value":2725},"You are a helpful support agent.",{"type":42,"tag":203,"props":2727,"children":2728},{"style":472},[2729],{"type":48,"value":2687},{"type":42,"tag":203,"props":2731,"children":2732},{"style":572},[2733],{"type":48,"value":2734},"Relevant knowledge:",{"type":42,"tag":203,"props":2736,"children":2737},{"style":472},[2738],{"type":48,"value":2739},"\\n",{"type":42,"tag":203,"props":2741,"children":2742},{"style":478},[2743],{"type":48,"value":621},{"type":42,"tag":203,"props":2745,"children":2746},{"style":472},[2747],{"type":48,"value":2629},{"type":42,"tag":203,"props":2749,"children":2750},{"style":478},[2751],{"type":48,"value":631},{"type":42,"tag":203,"props":2753,"children":2754},{"style":478},[2755],{"type":48,"value":508},{"type":42,"tag":102,"props":2757,"children":2758},{},[],{"type":42,"tag":43,"props":2760,"children":2762},{"id":2761},"key-patterns",[2763],{"type":48,"value":2764},"Key Patterns",{"type":42,"tag":159,"props":2766,"children":2768},{"id":2767},"combine-enterprise-knowledge-with-conversation-memory-recall",[2769],{"type":48,"value":2770},"Combine Enterprise Knowledge with Conversation Memory Recall",{"type":42,"tag":51,"props":2772,"children":2773},{},[2774],{"type":48,"value":2775},"For the best agent responses, combine both: Enterprise Knowledge for company content, Recall for individual customer history.",{"type":42,"tag":51,"props":2777,"children":2778},{},[2779],{"type":42,"tag":78,"props":2780,"children":2781},{},[2782],{"type":48,"value":192},{"type":42,"tag":57,"props":2784,"children":2786},{"className":195,"code":2785,"language":197,"meta":66,"style":66},"# Run both in parallel\nrecall_res = requests.post(\n    f\"https:\u002F\u002Fmemory.twilio.com\u002Fv1\u002FServices\u002F{MEMORY_STORE_SID}\u002FProfiles\u002F{profile_id}\u002FRecall\",\n    auth=(account_sid, auth_token),\n    json={\"query\": user_query, \"observationsLimit\": 5}\n)\nsearch_res = requests.post(\n    f\"https:\u002F\u002Fknowledge.twilio.com\u002Fv1\u002FKnowledgeBases\u002F{KB_ID}\u002FSearch\",\n    auth=(account_sid, auth_token),\n    json={\"query\": user_query, \"top\": 3}\n)\n\ncustomer_history = \"\\n\".join(o[\"content\"] for o in recall_res.json().get(\"observations\", []))\nknowledge_chunks = \"\\n\\n\".join(c[\"content\"] for c in search_res.json().get(\"chunks\", []))\n\nsystem_prompt = f\"\"\"Customer history:\n{customer_history}\n\nRelevant documentation:\n{knowledge_chunks}\"\"\"\n",[2787],{"type":42,"tag":64,"props":2788,"children":2789},{"__ignoreMap":66},[2790,2798,2806,2814,2821,2829,2836,2844,2852,2859,2867,2874,2881,2889,2897,2904,2912,2920,2927,2935],{"type":42,"tag":203,"props":2791,"children":2792},{"class":205,"line":206},[2793],{"type":42,"tag":203,"props":2794,"children":2795},{},[2796],{"type":48,"value":2797},"# Run both in parallel\n",{"type":42,"tag":203,"props":2799,"children":2800},{"class":205,"line":215},[2801],{"type":42,"tag":203,"props":2802,"children":2803},{},[2804],{"type":48,"value":2805},"recall_res = requests.post(\n",{"type":42,"tag":203,"props":2807,"children":2808},{"class":205,"line":225},[2809],{"type":42,"tag":203,"props":2810,"children":2811},{},[2812],{"type":48,"value":2813},"    f\"https:\u002F\u002Fmemory.twilio.com\u002Fv1\u002FServices\u002F{MEMORY_STORE_SID}\u002FProfiles\u002F{profile_id}\u002FRecall\",\n",{"type":42,"tag":203,"props":2815,"children":2816},{"class":205,"line":234},[2817],{"type":42,"tag":203,"props":2818,"children":2819},{},[2820],{"type":48,"value":275},{"type":42,"tag":203,"props":2822,"children":2823},{"class":205,"line":243},[2824],{"type":42,"tag":203,"props":2825,"children":2826},{},[2827],{"type":48,"value":2828},"    json={\"query\": user_query, \"observationsLimit\": 5}\n",{"type":42,"tag":203,"props":2830,"children":2831},{"class":205,"line":251},[2832],{"type":42,"tag":203,"props":2833,"children":2834},{},[2835],{"type":48,"value":320},{"type":42,"tag":203,"props":2837,"children":2838},{"class":205,"line":260},[2839],{"type":42,"tag":203,"props":2840,"children":2841},{},[2842],{"type":48,"value":2843},"search_res = requests.post(\n",{"type":42,"tag":203,"props":2845,"children":2846},{"class":205,"line":269},[2847],{"type":42,"tag":203,"props":2848,"children":2849},{},[2850],{"type":48,"value":2851},"    f\"https:\u002F\u002Fknowledge.twilio.com\u002Fv1\u002FKnowledgeBases\u002F{KB_ID}\u002FSearch\",\n",{"type":42,"tag":203,"props":2853,"children":2854},{"class":205,"line":278},[2855],{"type":42,"tag":203,"props":2856,"children":2857},{},[2858],{"type":48,"value":275},{"type":42,"tag":203,"props":2860,"children":2861},{"class":205,"line":287},[2862],{"type":42,"tag":203,"props":2863,"children":2864},{},[2865],{"type":48,"value":2866},"    json={\"query\": user_query, \"top\": 3}\n",{"type":42,"tag":203,"props":2868,"children":2869},{"class":205,"line":296},[2870],{"type":42,"tag":203,"props":2871,"children":2872},{},[2873],{"type":48,"value":320},{"type":42,"tag":203,"props":2875,"children":2876},{"class":205,"line":305},[2877],{"type":42,"tag":203,"props":2878,"children":2879},{"emptyLinePlaceholder":219},[2880],{"type":48,"value":222},{"type":42,"tag":203,"props":2882,"children":2883},{"class":205,"line":314},[2884],{"type":42,"tag":203,"props":2885,"children":2886},{},[2887],{"type":48,"value":2888},"customer_history = \"\\n\".join(o[\"content\"] for o in recall_res.json().get(\"observations\", []))\n",{"type":42,"tag":203,"props":2890,"children":2891},{"class":205,"line":323},[2892],{"type":42,"tag":203,"props":2893,"children":2894},{},[2895],{"type":48,"value":2896},"knowledge_chunks = \"\\n\\n\".join(c[\"content\"] for c in search_res.json().get(\"chunks\", []))\n",{"type":42,"tag":203,"props":2898,"children":2899},{"class":205,"line":331},[2900],{"type":42,"tag":203,"props":2901,"children":2902},{"emptyLinePlaceholder":219},[2903],{"type":48,"value":222},{"type":42,"tag":203,"props":2905,"children":2906},{"class":205,"line":340},[2907],{"type":42,"tag":203,"props":2908,"children":2909},{},[2910],{"type":48,"value":2911},"system_prompt = f\"\"\"Customer history:\n",{"type":42,"tag":203,"props":2913,"children":2914},{"class":205,"line":348},[2915],{"type":42,"tag":203,"props":2916,"children":2917},{},[2918],{"type":48,"value":2919},"{customer_history}\n",{"type":42,"tag":203,"props":2921,"children":2922},{"class":205,"line":357},[2923],{"type":42,"tag":203,"props":2924,"children":2925},{"emptyLinePlaceholder":219},[2926],{"type":48,"value":222},{"type":42,"tag":203,"props":2928,"children":2929},{"class":205,"line":366},[2930],{"type":42,"tag":203,"props":2931,"children":2932},{},[2933],{"type":48,"value":2934},"Relevant documentation:\n",{"type":42,"tag":203,"props":2936,"children":2937},{"class":205,"line":375},[2938],{"type":42,"tag":203,"props":2939,"children":2940},{},[2941],{"type":48,"value":2942},"{knowledge_chunks}\"\"\"\n",{"type":42,"tag":159,"props":2944,"children":2946},{"id":2945},"refresh-stale-web-sources",[2947],{"type":48,"value":2948},"Refresh Stale Web Sources",{"type":42,"tag":51,"props":2950,"children":2951},{},[2952],{"type":48,"value":2953},"Re-crawl a web source without changing its config:",{"type":42,"tag":57,"props":2955,"children":2957},{"className":195,"code":2956,"language":197,"meta":66,"style":66},"requests.patch(\n    f\"https:\u002F\u002Fknowledge.twilio.com\u002Fv1\u002FKnowledgeBases\u002F{kb_id}\u002FKnowledge\u002F{knowledge_id}?refresh=true\",\n    auth=(account_sid, auth_token),\n    json={}\n)\n# Returns 202 — source re-queued for processing\n",[2958],{"type":42,"tag":64,"props":2959,"children":2960},{"__ignoreMap":66},[2961,2969,2977,2984,2992,2999],{"type":42,"tag":203,"props":2962,"children":2963},{"class":205,"line":206},[2964],{"type":42,"tag":203,"props":2965,"children":2966},{},[2967],{"type":48,"value":2968},"requests.patch(\n",{"type":42,"tag":203,"props":2970,"children":2971},{"class":205,"line":215},[2972],{"type":42,"tag":203,"props":2973,"children":2974},{},[2975],{"type":48,"value":2976},"    f\"https:\u002F\u002Fknowledge.twilio.com\u002Fv1\u002FKnowledgeBases\u002F{kb_id}\u002FKnowledge\u002F{knowledge_id}?refresh=true\",\n",{"type":42,"tag":203,"props":2978,"children":2979},{"class":205,"line":225},[2980],{"type":42,"tag":203,"props":2981,"children":2982},{},[2983],{"type":48,"value":275},{"type":42,"tag":203,"props":2985,"children":2986},{"class":205,"line":234},[2987],{"type":42,"tag":203,"props":2988,"children":2989},{},[2990],{"type":48,"value":2991},"    json={}\n",{"type":42,"tag":203,"props":2993,"children":2994},{"class":205,"line":243},[2995],{"type":42,"tag":203,"props":2996,"children":2997},{},[2998],{"type":48,"value":320},{"type":42,"tag":203,"props":3000,"children":3001},{"class":205,"line":251},[3002],{"type":42,"tag":203,"props":3003,"children":3004},{},[3005],{"type":48,"value":3006},"# Returns 202 — source re-queued for processing\n",{"type":42,"tag":159,"props":3008,"children":3010},{"id":3009},"filter-search-to-specific-sources",[3011],{"type":48,"value":3012},"Filter Search to Specific Sources",{"type":42,"tag":51,"props":3014,"children":3015},{},[3016],{"type":48,"value":3017},"When your knowledge base has multiple sources (scripts, FAQs, policies), target search to the relevant one:",{"type":42,"tag":57,"props":3019,"children":3021},{"className":195,"code":3020,"language":197,"meta":66,"style":66},"results = requests.post(\n    f\"https:\u002F\u002Fknowledge.twilio.com\u002Fv1\u002FKnowledgeBases\u002F{kb_id}\u002FSearch\",\n    auth=(account_sid, auth_token),\n    json={\n        \"query\": \"cancellation policy\",\n        \"top\": 5,\n        \"knowledgeIds\": [policy_knowledge_id]\n    }\n).json()\n",[3022],{"type":42,"tag":64,"props":3023,"children":3024},{"__ignoreMap":66},[3025,3032,3039,3046,3053,3061,3069,3077,3084],{"type":42,"tag":203,"props":3026,"children":3027},{"class":205,"line":206},[3028],{"type":42,"tag":203,"props":3029,"children":3030},{},[3031],{"type":48,"value":2094},{"type":42,"tag":203,"props":3033,"children":3034},{"class":205,"line":215},[3035],{"type":42,"tag":203,"props":3036,"children":3037},{},[3038],{"type":48,"value":2102},{"type":42,"tag":203,"props":3040,"children":3041},{"class":205,"line":225},[3042],{"type":42,"tag":203,"props":3043,"children":3044},{},[3045],{"type":48,"value":275},{"type":42,"tag":203,"props":3047,"children":3048},{"class":205,"line":234},[3049],{"type":42,"tag":203,"props":3050,"children":3051},{},[3052],{"type":48,"value":284},{"type":42,"tag":203,"props":3054,"children":3055},{"class":205,"line":243},[3056],{"type":42,"tag":203,"props":3057,"children":3058},{},[3059],{"type":48,"value":3060},"        \"query\": \"cancellation policy\",\n",{"type":42,"tag":203,"props":3062,"children":3063},{"class":205,"line":251},[3064],{"type":42,"tag":203,"props":3065,"children":3066},{},[3067],{"type":48,"value":3068},"        \"top\": 5,\n",{"type":42,"tag":203,"props":3070,"children":3071},{"class":205,"line":260},[3072],{"type":42,"tag":203,"props":3073,"children":3074},{},[3075],{"type":48,"value":3076},"        \"knowledgeIds\": [policy_knowledge_id]\n",{"type":42,"tag":203,"props":3078,"children":3079},{"class":205,"line":269},[3080],{"type":42,"tag":203,"props":3081,"children":3082},{},[3083],{"type":48,"value":311},{"type":42,"tag":203,"props":3085,"children":3086},{"class":205,"line":278},[3087],{"type":42,"tag":203,"props":3088,"children":3089},{},[3090],{"type":48,"value":1614},{"type":42,"tag":51,"props":3092,"children":3093},{},[3094,3096,3102],{"type":48,"value":3095},"Omit ",{"type":42,"tag":64,"props":3097,"children":3099},{"className":3098},[],[3100],{"type":48,"value":3101},"knowledgeIds",{"type":48,"value":3103}," to search across all sources in the knowledge base.",{"type":42,"tag":159,"props":3105,"children":3107},{"id":3106},"inspect-processed-chunks",[3108],{"type":48,"value":3109},"Inspect Processed Chunks",{"type":42,"tag":51,"props":3111,"children":3112},{},[3113],{"type":48,"value":3114},"To audit what got indexed from a source:",{"type":42,"tag":57,"props":3116,"children":3118},{"className":195,"code":3117,"language":197,"meta":66,"style":66},"chunks = requests.get(\n    f\"https:\u002F\u002Fknowledge.twilio.com\u002Fv1\u002FKnowledgeBases\u002F{kb_id}\u002FKnowledge\u002F{knowledge_id}\u002FChunks\",\n    auth=(account_sid, auth_token),\n    params={\"pageSize\": 50}\n).json()\n\nfor chunk in chunks[\"chunks\"]:\n    print(chunk[\"content\"][:100])\n",[3119],{"type":42,"tag":64,"props":3120,"children":3121},{"__ignoreMap":66},[3122,3130,3138,3145,3153,3160,3167,3175],{"type":42,"tag":203,"props":3123,"children":3124},{"class":205,"line":206},[3125],{"type":42,"tag":203,"props":3126,"children":3127},{},[3128],{"type":48,"value":3129},"chunks = requests.get(\n",{"type":42,"tag":203,"props":3131,"children":3132},{"class":205,"line":215},[3133],{"type":42,"tag":203,"props":3134,"children":3135},{},[3136],{"type":48,"value":3137},"    f\"https:\u002F\u002Fknowledge.twilio.com\u002Fv1\u002FKnowledgeBases\u002F{kb_id}\u002FKnowledge\u002F{knowledge_id}\u002FChunks\",\n",{"type":42,"tag":203,"props":3139,"children":3140},{"class":205,"line":225},[3141],{"type":42,"tag":203,"props":3142,"children":3143},{},[3144],{"type":48,"value":275},{"type":42,"tag":203,"props":3146,"children":3147},{"class":205,"line":234},[3148],{"type":42,"tag":203,"props":3149,"children":3150},{},[3151],{"type":48,"value":3152},"    params={\"pageSize\": 50}\n",{"type":42,"tag":203,"props":3154,"children":3155},{"class":205,"line":243},[3156],{"type":42,"tag":203,"props":3157,"children":3158},{},[3159],{"type":48,"value":1614},{"type":42,"tag":203,"props":3161,"children":3162},{"class":205,"line":251},[3163],{"type":42,"tag":203,"props":3164,"children":3165},{"emptyLinePlaceholder":219},[3166],{"type":48,"value":222},{"type":42,"tag":203,"props":3168,"children":3169},{"class":205,"line":260},[3170],{"type":42,"tag":203,"props":3171,"children":3172},{},[3173],{"type":48,"value":3174},"for chunk in chunks[\"chunks\"]:\n",{"type":42,"tag":203,"props":3176,"children":3177},{"class":205,"line":269},[3178],{"type":42,"tag":203,"props":3179,"children":3180},{},[3181],{"type":48,"value":3182},"    print(chunk[\"content\"][:100])\n",{"type":42,"tag":102,"props":3184,"children":3185},{},[],{"type":42,"tag":43,"props":3187,"children":3189},{"id":3188},"cannot",[3190],{"type":48,"value":3191},"CANNOT",{"type":42,"tag":112,"props":3193,"children":3194},{},[3195,3217,3243,3260,3277,3287,3304,3314,3323,3340,3363,3381],{"type":42,"tag":116,"props":3196,"children":3197},{},[3198,3203,3205,3210,3211,3216],{"type":42,"tag":78,"props":3199,"children":3200},{},[3201],{"type":48,"value":3202},"Cannot add sources before Knowledge Base is active",{"type":48,"value":3204}," — Creation is async (returns 202). Poll ",{"type":42,"tag":64,"props":3206,"children":3208},{"className":3207},[],[3209],{"type":48,"value":175},{"type":48,"value":177},{"type":42,"tag":64,"props":3212,"children":3214},{"className":3213},[],[3215],{"type":48,"value":183},{"type":48,"value":100},{"type":42,"tag":116,"props":3218,"children":3219},{},[3220,3225,3227,3233,3235,3241],{"type":42,"tag":78,"props":3221,"children":3222},{},[3223],{"type":48,"value":3224},"Cannot use one host for all operations",{"type":48,"value":3226}," — Management is on ",{"type":42,"tag":64,"props":3228,"children":3230},{"className":3229},[],[3231],{"type":48,"value":3232},"memory.twilio.com",{"type":48,"value":3234},"; sources and search are on ",{"type":42,"tag":64,"props":3236,"children":3238},{"className":3237},[],[3239],{"type":48,"value":3240},"knowledge.twilio.com",{"type":48,"value":3242},". Wrong host returns 404.",{"type":42,"tag":116,"props":3244,"children":3245},{},[3246,3251,3252,3258],{"type":42,"tag":78,"props":3247,"children":3248},{},[3249],{"type":48,"value":3250},"Cannot include auth header when uploading to presigned URL",{"type":48,"value":84},{"type":42,"tag":64,"props":3253,"children":3255},{"className":3254},[],[3256],{"type":48,"value":3257},"importUrl",{"type":48,"value":3259}," is already signed. Adding your auth header will fail.",{"type":42,"tag":116,"props":3261,"children":3262},{},[3263,3268,3269,3275],{"type":42,"tag":78,"props":3264,"children":3265},{},[3266],{"type":48,"value":3267},"Cannot use expired presigned URLs",{"type":48,"value":84},{"type":42,"tag":64,"props":3270,"children":3272},{"className":3271},[],[3273],{"type":48,"value":3274},"uploadExpiration",{"type":48,"value":3276}," is typically 1 hour. Upload promptly.",{"type":42,"tag":116,"props":3278,"children":3279},{},[3280,3285],{"type":42,"tag":78,"props":3281,"children":3282},{},[3283],{"type":48,"value":3284},"Cannot search before processing completes",{"type":48,"value":3286}," — Web crawl and file indexing are async (seconds to minutes). Poll status first.",{"type":42,"tag":116,"props":3288,"children":3289},{},[3290,3295,3296,3302],{"type":42,"tag":78,"props":3291,"children":3292},{},[3293],{"type":48,"value":3294},"Cannot use high crawl depth without performance impact",{"type":48,"value":84},{"type":42,"tag":64,"props":3297,"children":3299},{"className":3298},[],[3300],{"type":48,"value":3301},"crawlDepth",{"type":48,"value":3303}," 1–10, default 2. Higher depths dramatically increase processing time.",{"type":42,"tag":116,"props":3305,"children":3306},{},[3307,3312],{"type":42,"tag":78,"props":3308,"children":3309},{},[3310],{"type":48,"value":3311},"Cannot exceed 16MB per file upload",{"type":48,"value":3313}," — Hard limit",{"type":42,"tag":116,"props":3315,"children":3316},{},[3317,3322],{"type":42,"tag":78,"props":3318,"children":3319},{},[3320],{"type":48,"value":3321},"Cannot exceed 185,000 characters per text source",{"type":48,"value":3313},{"type":42,"tag":116,"props":3324,"children":3325},{},[3326,3331,3332,3338],{"type":42,"tag":78,"props":3327,"children":3328},{},[3329],{"type":48,"value":3330},"Cannot retrieve more than 20 search results per query",{"type":48,"value":84},{"type":42,"tag":64,"props":3333,"children":3335},{"className":3334},[],[3336],{"type":48,"value":3337},"top-K",{"type":48,"value":3339}," max is 20",{"type":42,"tag":116,"props":3341,"children":3342},{},[3343,3354,3356,3362],{"type":42,"tag":78,"props":3344,"children":3345},{},[3346,3348],{"type":48,"value":3347},"Cannot use spaces or underscores in ",{"type":42,"tag":64,"props":3349,"children":3351},{"className":3350},[],[3352],{"type":48,"value":3353},"displayName",{"type":48,"value":3355}," — Alphanumeric and hyphens only (",{"type":42,"tag":64,"props":3357,"children":3359},{"className":3358},[],[3360],{"type":48,"value":3361},"^[a-zA-Z0-9-]+$",{"type":48,"value":636},{"type":42,"tag":116,"props":3364,"children":3365},{},[3366,3371,3373,3379],{"type":42,"tag":78,"props":3367,"children":3368},{},[3369],{"type":48,"value":3370},"Cannot use Knowledge for customer-specific context",{"type":48,"value":3372}," — Knowledge is shared across all customers. Use ",{"type":42,"tag":64,"props":3374,"children":3376},{"className":3375},[],[3377],{"type":48,"value":3378},"twilio-customer-memory",{"type":48,"value":3380}," for per-customer context.",{"type":42,"tag":116,"props":3382,"children":3383},{},[3384,3389,3391,3396],{"type":42,"tag":78,"props":3385,"children":3386},{},[3387],{"type":48,"value":3388},"Cannot retry FAILED sources",{"type":48,"value":3390}," — Delete and recreate. No retry endpoint. Check chunk count after ",{"type":42,"tag":64,"props":3392,"children":3394},{"className":3393},[],[3395],{"type":48,"value":1916},{"type":48,"value":3397}," to verify extraction.",{"type":42,"tag":102,"props":3399,"children":3400},{},[],{"type":42,"tag":43,"props":3402,"children":3404},{"id":3403},"next-steps",[3405],{"type":48,"value":3406},"Next Steps",{"type":42,"tag":112,"props":3408,"children":3409},{},[3410,3427,3477,3492,3507],{"type":42,"tag":116,"props":3411,"children":3412},{},[3413,3418,3420,3425],{"type":42,"tag":78,"props":3414,"children":3415},{},[3416],{"type":48,"value":3417},"Per-customer context:",{"type":48,"value":3419}," ",{"type":42,"tag":64,"props":3421,"children":3423},{"className":3422},[],[3424],{"type":48,"value":3378},{"type":48,"value":3426}," — combine with Enterprise Knowledge for full agent context (company knowledge + individual customer history)",{"type":42,"tag":116,"props":3428,"children":3429},{},[3430,3435,3436,3442,3444],{"type":42,"tag":78,"props":3431,"children":3432},{},[3433],{"type":48,"value":3434},"Conversation Intelligence operators with enterprise context:",{"type":48,"value":3419},{"type":42,"tag":64,"props":3437,"children":3439},{"className":3438},[],[3440],{"type":48,"value":3441},"twilio-conversation-intelligence",{"type":48,"value":3443}," — feed Enterprise Knowledge chunks into Conversation Intelligence operators to give them business context. Examples:\n",{"type":42,"tag":112,"props":3445,"children":3446},{},[3447,3457,3467],{"type":42,"tag":116,"props":3448,"children":3449},{},[3450,3455],{"type":42,"tag":78,"props":3451,"children":3452},{},[3453],{"type":48,"value":3454},"Script Adherence:",{"type":48,"value":3456}," index your approved call scripts as a knowledge source; the operator can evaluate agent compliance against the retrieved script for the current conversation type",{"type":42,"tag":116,"props":3458,"children":3459},{},[3460,3465],{"type":42,"tag":78,"props":3461,"children":3462},{},[3463],{"type":48,"value":3464},"Custom upsell classifier:",{"type":48,"value":3466}," index product offers, pricing tiers, or eligibility rules; a custom classification operator can use retrieved offer details to detect upsell opportunities mid-conversation",{"type":42,"tag":116,"props":3468,"children":3469},{},[3470,3475],{"type":42,"tag":78,"props":3471,"children":3472},{},[3473],{"type":48,"value":3474},"Next Best Response:",{"type":48,"value":3476}," retrieved policy or FAQ chunks injected alongside the operator prompt improve suggestion quality",{"type":42,"tag":116,"props":3478,"children":3479},{},[3480,3485,3486],{"type":42,"tag":78,"props":3481,"children":3482},{},[3483],{"type":48,"value":3484},"Wire into a voice AI agent:",{"type":48,"value":3419},{"type":42,"tag":64,"props":3487,"children":3489},{"className":3488},[],[3490],{"type":48,"value":3491},"twilio-voice-conversation-relay",{"type":42,"tag":116,"props":3493,"children":3494},{},[3495,3500,3501],{"type":42,"tag":78,"props":3496,"children":3497},{},[3498],{"type":48,"value":3499},"TAC SDK integration:",{"type":48,"value":3419},{"type":42,"tag":64,"props":3502,"children":3504},{"className":3503},[],[3505],{"type":48,"value":3506},"twilio-agent-connect",{"type":42,"tag":116,"props":3508,"children":3509},{},[3510,3515,3516],{"type":42,"tag":78,"props":3511,"children":3512},{},[3513],{"type":48,"value":3514},"Debug integration issues:",{"type":48,"value":3419},{"type":42,"tag":64,"props":3517,"children":3519},{"className":3518},[],[3520],{"type":48,"value":3521},"twilio-debugging-observability",{"type":42,"tag":3523,"props":3524,"children":3525},"style",{},[3526],{"type":48,"value":3527},"html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"items":3529,"total":3648},[3530,3548,3562,3574,3594,3616,3636],{"slug":3531,"name":3531,"fn":3532,"description":3533,"org":3534,"tags":3535,"stars":25,"repoUrl":26,"updatedAt":27},"accessibility-and-inclusive-visualization","make data visualizations accessible","Make data visualizations accessible and inclusive. Use when the user needs chart or diagram accessibility guidance, text alternatives for complex visuals, color and contrast review, keyboard support, reduced-motion behavior for animation or parallax, or an accessibility QA workflow for exported figures, UML-like diagrams, and dashboards.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[3536,3539,3542,3545],{"name":3537,"slug":3538,"type":15},"Accessibility","accessibility",{"name":3540,"slug":3541,"type":15},"Charts","charts",{"name":3543,"slug":3544,"type":15},"Data Visualization","data-visualization",{"name":3546,"slug":3547,"type":15},"Design","design",{"slug":3549,"name":3549,"fn":3550,"description":3551,"org":3552,"tags":3553,"stars":25,"repoUrl":26,"updatedAt":3561},"agent-browser","automate browser interactions for agents","Browser automation CLI for AI agents. Use when the user needs to interact with websites, verify dev server output, test web apps, navigate pages, fill forms, click buttons, take screenshots, extract data, or automate any browser task. Also triggers when a dev server starts so you can verify it visually.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[3554,3555,3558],{"name":20,"slug":21,"type":15},{"name":3556,"slug":3557,"type":15},"Browser Automation","browser-automation",{"name":3559,"slug":3560,"type":15},"Testing","testing","2026-04-06T18:41:03.44016",{"slug":3563,"name":3563,"fn":3564,"description":3565,"org":3566,"tags":3567,"stars":25,"repoUrl":26,"updatedAt":3573},"agent-browser-verify","verify dev server output with automated browser","Automated browser verification for dev servers. Triggers when a dev server starts to run a visual gut-check with agent-browser — verifies the page loads, checks for console errors, validates key UI elements, and reports pass\u002Ffail before continuing.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[3568,3569,3572],{"name":3556,"slug":3557,"type":15},{"name":3570,"slug":3571,"type":15},"Local Development","local-development",{"name":3559,"slug":3560,"type":15},"2026-04-06T18:41:17.526867",{"slug":3575,"name":3575,"fn":3576,"description":3577,"org":3578,"tags":3579,"stars":25,"repoUrl":26,"updatedAt":3593},"agents-sdk","build AI agents on Cloudflare Workers","Build AI agents on Cloudflare Workers using the Agents SDK. Load when creating stateful agents, durable workflows, real-time WebSocket apps, scheduled tasks, MCP servers, or chat applications. Covers Agent class, state management, callable RPC, Workflows integration, and React hooks. Biases towards retrieval from Cloudflare docs over pre-trained knowledge.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[3580,3581,3584,3587,3590],{"name":20,"slug":21,"type":15},{"name":3582,"slug":3583,"type":15},"Cloudflare Workers","cloudflare-workers",{"name":3585,"slug":3586,"type":15},"SDK","sdk",{"name":3588,"slug":3589,"type":15},"Serverless","serverless",{"name":3591,"slug":3592,"type":15},"WebSockets","websockets","2026-04-06T18:39:51.717063",{"slug":3595,"name":3595,"fn":3596,"description":3597,"org":3598,"tags":3599,"stars":25,"repoUrl":26,"updatedAt":3615},"ai-elements","build chat UIs with AI Elements","AI Elements component library guidance — pre-built React components for AI interfaces built on shadcn\u002Fui. Use when building chat UIs, message displays, tool call rendering, streaming responses, reasoning panels, or any AI-native interface with the AI SDK.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[3600,3603,3606,3609,3612],{"name":3601,"slug":3602,"type":15},"Frontend","frontend",{"name":3604,"slug":3605,"type":15},"React","react",{"name":3607,"slug":3608,"type":15},"shadcn\u002Fui","shadcn-ui",{"name":3610,"slug":3611,"type":15},"UI Components","ui-components",{"name":3613,"slug":3614,"type":15},"Vercel","vercel","2026-04-06T18:40:59.619419",{"slug":3617,"name":3617,"fn":3618,"description":3619,"org":3620,"tags":3621,"stars":25,"repoUrl":26,"updatedAt":3635},"ai-gateway","configure Vercel AI Gateway","Vercel AI Gateway expert guidance. Use when configuring model routing, provider failover, cost tracking, or managing multiple AI providers through a unified API.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[3622,3625,3628,3631,3634],{"name":3623,"slug":3624,"type":15},"AI Infrastructure","ai-infrastructure",{"name":3626,"slug":3627,"type":15},"Cost Optimization","cost-optimization",{"name":3629,"slug":3630,"type":15},"LLM","llm",{"name":3632,"slug":3633,"type":15},"Performance","performance",{"name":3613,"slug":3614,"type":15},"2026-04-06T18:40:44.377464",{"slug":3637,"name":3637,"fn":3638,"description":3639,"org":3640,"tags":3641,"stars":25,"repoUrl":26,"updatedAt":3647},"ai-generation-persistence","implement persistence patterns for AI generations","AI generation persistence patterns — unique IDs, addressable URLs, database storage, and cost tracking for every LLM generation",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[3642,3643,3646],{"name":3626,"slug":3627,"type":15},{"name":3644,"slug":3645,"type":15},"Database","database",{"name":3629,"slug":3630,"type":15},"2026-04-06T18:41:08.513425",600,{"items":3650,"total":3847},[3651,3672,3695,3712,3728,3745,3764,3776,3790,3804,3816,3831],{"slug":3652,"name":3652,"fn":3653,"description":3654,"org":3655,"tags":3656,"stars":3669,"repoUrl":3670,"updatedAt":3671},"prior-auth-packet-builder","build healthcare prior authorization packets","Build a concise prior authorization packet from local case files and payer policy docs.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[3657,3660,3663,3666],{"name":3658,"slug":3659,"type":15},"Documents","documents",{"name":3661,"slug":3662,"type":15},"Healthcare","healthcare",{"name":3664,"slug":3665,"type":15},"Insurance","insurance",{"name":3667,"slug":3668,"type":15},"Regulatory Compliance","regulatory-compliance",28169,"https:\u002F\u002Fgithub.com\u002Fopenai\u002Fopenai-agents-python","2026-04-16T05:11:39.180399",{"slug":3673,"name":3673,"fn":3674,"description":3675,"org":3676,"tags":3677,"stars":3692,"repoUrl":3693,"updatedAt":3694},"aspnet-core","build ASP.NET Core web applications","Build, review, refactor, or architect ASP.NET Core web applications using current official guidance for .NET web development. Use when working on Blazor Web Apps, Razor Pages, MVC, Minimal APIs, controller-based Web APIs, SignalR, gRPC, middleware, dependency injection, configuration, authentication, authorization, testing, performance, deployment, or ASP.NET Core upgrades.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[3678,3681,3683,3686,3689],{"name":3679,"slug":3680,"type":15},".NET","dotnet",{"name":3682,"slug":3673,"type":15},"ASP.NET Core",{"name":3684,"slug":3685,"type":15},"Blazor","blazor",{"name":3687,"slug":3688,"type":15},"C#","csharp",{"name":3690,"slug":3691,"type":15},"Web Development","web-development",23787,"https:\u002F\u002Fgithub.com\u002Fopenai\u002Fskills","2026-04-12T05:07:02.819491",{"slug":3696,"name":3696,"fn":3697,"description":3698,"org":3699,"tags":3700,"stars":3692,"repoUrl":3693,"updatedAt":3711},"chatgpt-apps","build ChatGPT Apps SDK applications","Build, scaffold, refactor, and troubleshoot ChatGPT Apps SDK applications that combine an MCP server and widget UI. Use when Codex needs to design tools, register UI resources, wire the MCP Apps bridge or ChatGPT compatibility APIs, apply Apps SDK metadata or CSP or domain settings, or produce a docs-aligned project scaffold. Prefer a docs-first workflow by invoking the openai-docs skill or OpenAI developer docs MCP tools before generating code.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[3701,3704,3707,3710],{"name":3702,"slug":3703,"type":15},"Apps SDK","apps-sdk",{"name":3705,"slug":3706,"type":15},"ChatGPT","chatgpt",{"name":3708,"slug":3709,"type":15},"MCP","mcp",{"name":9,"slug":8,"type":15},"2026-04-12T05:07:05.468097",{"slug":3713,"name":3713,"fn":3714,"description":3715,"org":3716,"tags":3717,"stars":3692,"repoUrl":3693,"updatedAt":3727},"cli-creator","build CLIs from API docs","Build a composable CLI for Codex from API docs, an OpenAPI spec, existing curl examples, an SDK, a web app, an admin tool, or a local script. Use when the user wants Codex to create a command-line tool that can run from any repo, expose composable read\u002Fwrite commands, return stable JSON, manage auth, and pair with a companion skill.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[3718,3721,3724],{"name":3719,"slug":3720,"type":15},"API Development","api-development",{"name":3722,"slug":3723,"type":15},"CLI","cli",{"name":3725,"slug":3726,"type":15},"Codex","codex","2026-04-12T05:07:04.132762",{"slug":3729,"name":3729,"fn":3730,"description":3731,"org":3732,"tags":3733,"stars":3692,"repoUrl":3693,"updatedAt":3744},"cloudflare-deploy","deploy projects to Cloudflare","Deploy applications and infrastructure to Cloudflare using Workers, Pages, and related platform services. Use when the user asks to deploy, host, publish, or set up a project on Cloudflare.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[3734,3737,3740,3741],{"name":3735,"slug":3736,"type":15},"Cloudflare","cloudflare",{"name":3738,"slug":3739,"type":15},"Cloudflare Pages","cloudflare-pages",{"name":3582,"slug":3583,"type":15},{"name":3742,"slug":3743,"type":15},"Deployment","deployment","2026-04-12T05:07:14.275118",{"slug":3746,"name":3746,"fn":3747,"description":3748,"org":3749,"tags":3750,"stars":3692,"repoUrl":3693,"updatedAt":3763},"define-goal","define and set measurable project goals","Help the user define a concrete, measurable goal before starting work, especially when they ask to use the goal tool, create a goal, set an objective, clarify success criteria, or turn a fuzzy intention into a quantitative outcome. Use this skill for goal creation and goal refinement only; it does not manage durable snapshots, decision logs, or long-running execution artifacts.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[3751,3754,3757,3760],{"name":3752,"slug":3753,"type":15},"Productivity","productivity",{"name":3755,"slug":3756,"type":15},"Project Management","project-management",{"name":3758,"slug":3759,"type":15},"Strategy","strategy",{"name":3761,"slug":3762,"type":15},"Task Management","task-management","2026-05-23T06:17:16.870838",{"slug":3765,"name":3765,"fn":3766,"description":3767,"org":3768,"tags":3769,"stars":3692,"repoUrl":3693,"updatedAt":3775},"figma","translate Figma designs into code","Use the Figma MCP server to fetch design context, screenshots, variables, and assets from Figma, and to translate Figma nodes into production code. Trigger when a task involves Figma URLs, node IDs, design-to-code implementation, or Figma MCP setup and troubleshooting.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[3770,3771,3773,3774],{"name":3546,"slug":3547,"type":15},{"name":3772,"slug":3765,"type":15},"Figma",{"name":3601,"slug":3602,"type":15},{"name":3708,"slug":3709,"type":15},"2026-04-12T05:06:47.939943",{"slug":3777,"name":3777,"fn":3778,"description":3779,"org":3780,"tags":3781,"stars":3692,"repoUrl":3693,"updatedAt":3789},"figma-code-connect-components","connect Figma designs to code components","Connects Figma design components to code components using Code Connect mapping tools. Use when user says \"code connect\", \"connect this component to code\", \"map this component\", \"link component to code\", \"create code connect mapping\", or wants to establish mappings between Figma designs and code implementations. For canvas writes via `use_figma`, use `figma-use`.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[3782,3783,3786,3787,3788],{"name":3546,"slug":3547,"type":15},{"name":3784,"slug":3785,"type":15},"Design System","design-system",{"name":3772,"slug":3765,"type":15},{"name":3601,"slug":3602,"type":15},{"name":3610,"slug":3611,"type":15},"2026-05-10T05:59:52.971881",{"slug":3791,"name":3791,"fn":3792,"description":3793,"org":3794,"tags":3795,"stars":3692,"repoUrl":3693,"updatedAt":3803},"figma-create-design-system-rules","generate design system rules from Figma","Generates custom design system rules for the user's codebase. Use when user says \"create design system rules\", \"generate rules for my project\", \"set up design rules\", \"customize design system guidelines\", or wants to establish project-specific conventions for Figma-to-code workflows. Requires Figma MCP server connection.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[3796,3797,3798,3801,3802],{"name":3546,"slug":3547,"type":15},{"name":3784,"slug":3785,"type":15},{"name":3799,"slug":3800,"type":15},"Documentation","documentation",{"name":3772,"slug":3765,"type":15},{"name":3601,"slug":3602,"type":15},"2026-05-16T06:07:47.821474",{"slug":3805,"name":3805,"fn":3806,"description":3807,"org":3808,"tags":3809,"stars":3692,"repoUrl":3693,"updatedAt":3815},"figma-implement-design","translate Figma designs into application code","Translates Figma designs into production-ready application code with 1:1 visual fidelity. Use when implementing UI code from Figma files, when user mentions \"implement design\", \"generate code\", \"implement component\", provides Figma URLs, or asks to build components matching Figma specs. For Figma canvas writes via `use_figma`, use `figma-use`.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[3810,3811,3812,3813,3814],{"name":3546,"slug":3547,"type":15},{"name":3772,"slug":3765,"type":15},{"name":3601,"slug":3602,"type":15},{"name":3610,"slug":3611,"type":15},{"name":3690,"slug":3691,"type":15},"2026-05-16T06:07:40.583615",{"slug":3817,"name":3817,"fn":3818,"description":3819,"org":3820,"tags":3821,"stars":3692,"repoUrl":3693,"updatedAt":3830},"hatch-pet","create animated pets for Codex","Create, repair, validate, visually QA, and package Codex-compatible animated pets and pet spritesheets from character art, generated images, company or prospect brand cues, or visual references. Use when a user wants a lightweight-worker Codex pet workflow, a non-pixel custom pet style, a prospect or company mascot pet, or a full 8x9 animated pet atlas with transparent unused cells, QA contact sheets, and pet.json packaging. This skill composes the installed $imagegen system skill for visual generation and uses bundled scripts for deterministic spritesheet assembly.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[3822,3825,3826,3829],{"name":3823,"slug":3824,"type":15},"Animation","animation",{"name":3725,"slug":3726,"type":15},{"name":3827,"slug":3828,"type":15},"Creative","creative",{"name":3546,"slug":3547,"type":15},"2026-05-02T05:31:48.48485",{"slug":3832,"name":3832,"fn":3833,"description":3834,"org":3835,"tags":3836,"stars":3692,"repoUrl":3693,"updatedAt":3846},"imagegen","generate and edit raster images","Generate or edit raster images when the task benefits from AI-created bitmap visuals such as photos, illustrations, textures, sprites, mockups, or transparent-background cutouts. Use when Codex should create a brand-new image, transform an existing image, or derive visual variants from references, and the output should be a bitmap asset rather than repo-native code or vector. Do not use when the task is better handled by editing existing SVG\u002Fvector\u002Fcode-native assets, extending an established icon or logo system, or building the visual directly in HTML\u002FCSS\u002Fcanvas.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":8},[3837,3838,3839,3842,3845],{"name":3827,"slug":3828,"type":15},{"name":3546,"slug":3547,"type":15},{"name":3840,"slug":3841,"type":15},"Image Generation","image-generation",{"name":3843,"slug":3844,"type":15},"Images","images",{"name":9,"slug":8,"type":15},"2026-05-15T06:23:24.312127",675]