To answer a customer’s question, an agent needs facts. Rather than building and maintaining your own vector store, you can search the knowledge you’ve already added to Plain with theDocumentation Index
Fetch the complete documentation index at: https://www.plain.com/docs/llms.txt
Use this file to discover all available pages before exploring further.
searchKnowledgeSources query. It runs a semantic search and returns the most relevant passages, ready to drop into a prompt. This is the retrieval half of a RAG (“retrieval-augmented generation”) agent.
What knowledge sources are
A knowledge source is any content in Plain that can be searched to answer a question. There are two kinds:- Help center articles — the self-serve articles you publish in Plain’s help center.
- Indexed documents — external pages and documents you’ve indexed for AI, like your public docs or marketing site.
searchKnowledgeSources searches across them in a single call.
Search knowledge sources
Pass a natural-languagesearchQuery and Plain returns the passages most semantically relevant to it, ordered most-relevant first. Each result carries the matched content (a chunk of text) plus a reference to the source it came from.
This operation requires the knowledgeSource:read permission.
HelpCenterArticleSearchResult and IndexedDocumentSearchResult. Narrow with __typename (or instanceof) the same way as any other union type in the SDK.
pageSize defaults to 10 and can be between 1 and 50. searchQuery must be between 1 and 1000 characters.Feeding results into a prompt
Thecontent field is what you usually want for generation: it’s the matched passage, already trimmed to the relevant part of the source. Concatenate the top results into your prompt as context:
Narrowing the search
The optionaloptions argument lets you control what gets searched:
| Option | Type | What it does |
|---|---|---|
types | [INDEXED_DOCUMENT | HELP_CENTER_ARTICLE] | Restrict to one kind of source. Omit to search both. |
labelTypeIds | [ID!] | Only return indexed documents tagged with these label types. |
includeNonCustomerFacing | Boolean | Include help centers marked as not customer-facing. Defaults to false. |
If you pass
labelTypeIds without specifying types, the search is limited to indexed documents, since labels only apply to them.Resources
- GraphQL SDK: the typed client your agent calls
- Reading threads: get the customer’s question as text to search with
- Acting on threads: reply, suggest, or note with the answer
- Help center: manage the articles you’re searching over

