Skip to content

Knowledge base ​

A knowledge source gives the agent your own material: design notes, coding standards, API docs. At the start of each turn, Yi Code searches the role's sources with your message and hands the best passages to the agent, with their source names, to cite.

Kinds of source ​

TypeWhat it is
ragflowDocument retrieval in RAGFlow. Upload documents in Yi Code and they are parsed and indexed there.
httpYour own retrieval service over HTTP.
mcpYour own retrieval service as an MCP server over Streamable HTTP.

Each organization's documents are kept in its own knowledge backend account, with its own credentials. On the cloud service we set up that account for the organization.

Add a source ​

Owners and administrators open "Knowledge" in the settings and add a source:

  • "Knowledge source name".
  • "Type": ragflow, http or mcp.
  • "Service endpoint (must be allowlisted by your administrator)": the host has to be on the deployment's list of allowed connector hosts. On the cloud service the endpoint must use HTTPS.
  • "Credential reference (optional)": the name of a server-side secret, never the secret itself (see credential references).
  • "RAGFlow Dataset ID" for a ragflow source.

Upload documents ​

For a ragflow source, click "Upload and parse document". Each document can be up to 10 MB. The page shows "Document submitted for parsing" and later "Document ready".

The organization has a knowledge allowance: a number of documents, a total size and embedding tokens per month. The page shows how much is used. Embedding within the allowance is not charged to your credit.

If an upload is interrupted, the page says "Upload status awaits reconciliation. Please do not submit it again." The document may already be in the backend, and we check it before the allowance is released. Uploading the same file again to the same source returns the earlier upload.

Test a search ​

"Test retrieval" runs a search against one source, so you can see what the agent would get for a question before you rely on it.

Use a source in turns ​

A source is used when it is attached to a role. An administrator publishes a new version of the ask or code role with the source ticked under "Knowledge sources" (see Changing a role). From then on, each new turn in that mode:

  1. Searches every attached source with your message, taking the top five passages from each.
  2. Adds them to the agent's instructions with their source names, and asks it to cite them.
  3. Lists the sources in the turn's report.md.

Retrieved passages are treated as task data, never as instructions to the agent. Turns already running keep the sources they started with.

Your own retrieval service ​

An http source receives a POST with a JSON body:

json
{ "query": "the user's message", "top_k": 5, "filters": {} }

and answers with:

json
{ "items": [ { "text": "passage", "source": "where it came from", "metadata": {} } ] }

An mcp source is called through its search tool with query and top_k. The tool returns the same items JSON as text, or plain text, which is used as one passage.

The credential reference, if set, is sent as Authorization: Bearer …. Yi Code calls the service from its control plane. The sandbox never sees the credential.