a tool · typed in, typed out, no judgment
export const retrieveDocsTool = createTool({
id: 'retrieve-docs',
description:
'Search the documentation for passages ' +
'relevant to a question, with scores.',
inputSchema: z.object({
query: z.string().describe('The question, verbatim.'),
topK: z.number().int().min(1).max(10).default(5),
}),
outputSchema: retrievalSchema,
execute: async ({ query, topK }) =>
retrieveDocs(query, topK),
})
an agent · a model with instructions, judgment
export const docsAgent = new Agent({
id: 'docs-agent',
instructions: `You answer questions about the product
from its documentation. Nothing else.
1. Use ONLY what the retrieve-docs tool returns. You have
no other knowledge of this product. Never invent a
feature, flag, endpoint, setting or limit.
2. Cite the page that settles it, title and path, and quote
the part that answers. If the docs do not clearly settle
it, say so and do not claim it.
3. End with a Sources list. Only pages you were given.`,
model: 'rock8router/qwen3.6-27b',
tools: { retrieveDocsTool },
})