节点 / builtin / ai / aiagents
Q&A Agent
Generate an action plan and execute it. Can use external tools.
此内容尚不支持你的语言。
Answer a question from your own documents, with a cloud chat model or fully on-device.
What it does
Section titled “What it does”Q&A Agent takes the question in Prompt, looks up the most relevant passages in the knowledge base connected to Knowledge, and answers from them. What you connect to Model decides how it answers; there is no setting to switch:
- A chat model (for example Chat OpenAI or Web LLM) writes an answer in its own words, using the passages. Without a knowledge base, it answers from what the model knows.
- A Local Q&A Model runs in your browser: free, private and offline. It reads each retrieved passage and quotes the best-scoring span, so the answer always comes word for word from your documents. It needs a knowledge base, and System message and the output parser do not apply.
Passages are added to the prompt as reference data, not as instructions. A knowledge base marked Device only is never sent to a cloud model.
When to use it
Section titled “When to use it”- Answer questions about your notes, manuals or saved pages.
- Look up a fact (a price, a date, a policy) in a knowledge base inside a workflow.
- Keep everything on your device with a Local Q&A Model and Local Embeddings.
For a multi-turn chat with memory over your documents, use RAG Agent. To answer from one passage you already have, use Answer Question.
Inputs and settings
Section titled “Inputs and settings”| 设置项 | 类型 | 作用 |
|---|---|---|
| Prompt (必填) | Text | |
| Options | Group | The options for the node. |
| Options › System message | Long text | The system message to use. |
| Options › Knowledge documents (k) | Number | How many documents to retrieve from the connected knowledge base. 默认值:4 |
| Options › Max knowledge context length | Number | Maximum characters of retrieved knowledge to inject into the prompt. 默认值:4000 |
| Options › Fail on knowledge error | Toggle | If enabled, the node fails when knowledge retrieval errors instead of answering without context. 默认值:Off |
| Options › Search type | Choice | How passages are picked from the connected knowledge base. Options: Most similar, Diverse (MMR). 默认值:Most similar |
| Options › Match by | Choice | How a knowledge base is searched with "Most similar". Diverse (MMR) and other vector stores always match by meaning. Options: Keywords and meaning, Meaning only. 默认值:Keywords and meaning |
| Options › Minimum relevance | Number | Drop passages less similar to the question than this (0 to 1). 0 keeps every passage. 默认值:0 |
| Options › Metadata filter | Key-value pairs | Only search passages whose metadata matches every key = value (e.g. sourceType = web). Keys use letters, numbers and _; numbers and true/false are matched as such. |
| Options › Device-only knowledge with a cloud model | Choice | A knowledge base marked "Device only" is never sent to a cloud model. Choose what the node does when its model is a cloud model. Options: Stop with an error, Answer without it. 默认值:Stop with an error |
Prompt is the question, for example {{ $input.question }} or a fixed What is our refund window?.
With a Local Q&A Model, Max knowledge context length limits how much of each passage the model reads.
Outputs
Section titled “Outputs”-
Output
Each output item has these fields:
| Field | 类型 | What it holds |
|---|---|---|
| response | Any | The model reply; the parsed result when an output parser is connected |
| answer | Text | |
| score | Number | |
| source | Text | |
| sources | List of entries | The knowledge base sources used for the answer |
{ "response": null, "answer": "…", "score": 0, "source": "…", "sources": []}- With a chat model, you get
response, plussourceswhen a knowledge base is connected. - With a Local Q&A Model,
responseandanswerhold the quoted answer (empty when none was found),scoreis the model’s confidence, andsourcenames the document it came from.
Each entry in sources has title, url (when there is one), knowledgeId, sourceId and score. After a run, the node shows a badge such as 3 sources cited.
Dependencies and credentials
Section titled “Dependencies and credentials”| Slot | Accepts | Connections |
|---|---|---|
| Model (必填) | chat model, local qa | One node. |
| Knowledge | vector store | One node. |
| Output Parser | output parser | One node. |
- Model: a chat model, or a Local Q&A Model to answer on-device. Cloud models hold their own API key.
- Knowledge: a Local Knowledge node. Optional with a chat model, required with a Local Q&A Model.
- Output Parser: shapes the chat model’s answer. Ignored by the Local Q&A Model.
Example workflow
Section titled “Example workflow”- Add your product manual to a knowledge base on the knowledge bases page, or with the Indexer.
- Get Selected Text reads a customer question you highlighted, with Output field name
question. - Q&A Agent with Prompt
{{ $input.question }}, a Local Knowledge node on Knowledge and a Local Q&A Model on Model. - Display Markdown shows
{{ $input.answer }}and{{ $input.source }}.
Nothing leaves the browser.
Common issues
Section titled “Common issues”- “The Local Q&A Model answers by quoting a passage, so it needs a context: connect a Knowledge to the Q&A Agent.” Connect a Local Knowledge node to Knowledge.
answeris empty. None of the retrieved passages contained an answer (a warning is logged). Raise Knowledge documents (k), lower Minimum relevance, or rephrase the question.- “Knowledge retrieval failed: …”. The knowledge base could not be searched. Open the Local Knowledge node and check its knowledge base and embedding model.
- “… is on this device only, but … is a cloud model.” The knowledge base is marked Device only. Use an on-device model, change the knowledge base’s privacy, or set Device-only knowledge with a cloud model to Answer without it.
- “Model not found”. The connected chat model node is not set up: open it and choose a model and its credential.
Related nodes
Section titled “Related nodes”- RAG Agent: chat over your documents, with memory.
- Local Knowledge: the knowledge base to search.
- Local Q&A Model: the on-device answer engine.
- Answer Question: on-device Q&A over a passage you provide.