BAIEnterprise Digitalization · AI Application Development中文EN

Consulting Research Agent 1.0: Project-Source Research & Q&A

Period: 2026.07Status: FrozenType: Original workTags: RAG · Evidence traceability · Judge · TraceRepository ↗

Ask a question; it digs through piles of project documents for the evidence and answers with pointers back to the source text.

Consulting Research Agent 1.0: Project-Source Research & Q&A

The reason was practical: consulting research means digging through too many project documents. Doing it by hand is slow, and I didn’t trust ordinary Q&A tools, because an answer is only usable if it can be traced back to the original text.

1.0 took the form of single-question research: the user asks one question, the system searches the project documents for supporting evidence and generates an answer with evidence, each piece of which can be clicked back to its place in the source. The corpus was the full document set of a real consulting project — technical specifications, process documents, spreadsheets, and slide decks all in there. Project questions are searched locally by default, and web research only turns on after human confirmation.

The pipeline

Incoming documents first go through multi-format normalization: DOCX, PDF, XLSX, and PPTX are each converted into unified text following their own structure, and a location index is kept that maps every passage of normalized text back to which paragraph, which page, which slide, which cell range of the original; there is also a manifest tying source IDs, original files, and index files together, so any passage of normalized text can be traced back to the original document it came from. The retrieval layer uses Alibaba Cloud Bailian embeddings plus a local SQLite vector store, followed by a Bailian rerank; the vector index stays on the local machine and never leaves it. Ordinary relevance questions go through vector retrieval; summary-type tasks that need full coverage keep a local full scan, so none of the target sources is missed. After the answer is generated, it passes validation, an automated judge (Judge), and an exit guard, and is finally written into long-term memory. The interface is a local web workbench — quick questions, run status, the answer, the evidence, and the Trace can be viewed in separate tabs. One run produces five artifacts: the answer, the evidence, the Trace, the event log, and the judge report; evaluation uses an offline, deterministic Judge, so private material is never sent to an external model just to be graded, and the repository keeps a minimal evaluation set (project_eval_cases.jsonl) for regression.

Data boundaries

Two design decisions still look right to me. The first is the outbound gate: before indexing, a source catalog and an outbound policy are read, and only material cleared for external release is sent off for embedding; a few files explicitly marked do-not-send are excluded one by one from the external model’s context, while the rest of the material participates as usual; calling an external model has its own explicit approval switch, off by default, and the human confirmation required for web research is a separate, independent gate — the two are not substitutes for each other. Local resources are likewise governed by a project-level authorization policy and sandboxed execution — it isn’t a case of a process reading whatever it wants. Keys follow the same discipline: they live only in a local .env, never in code, never in the agent’s instruction files, never in the Trace, and .env itself is kept out of the repository by gitignore. The second is that evidence location is kept at four levels: the original file name, the original path, the position within the source, and the path of the normalized text — with positioning rules per format: documents by paragraph, PDFs by page, slide decks by slide, spreadsheets by worksheet and cell range. One more small insistence: if retrieval fails, it fails loudly with an error instead of silently falling back to keyword search to fake a result.

Records and boundaries

The record it left behind: when the work later migrated to 2.0, v1’s regression baseline was 52 passing and 1 warning. To be clear, that number — like the several-hundred figures for later versions — comes from the project documents of the time; I haven’t re-run them, and I haven’t re-verified how usable 1.0 actually is today, or how accurate it is on real business questions.

My biggest takeaway after 1.0: single-question Q&A runs out of road quickly. Research moves forward project by project. Hence 2.x.

Diagrams

graph LR
  A[User question] --> B[Normalization]
  B --> C[Location index]
  C --> D[Vector index]
  D --> E[Retrieval + rerank]
  E --> F[Answer draft]
  F --> G[Judge review]
  G --> H[Five artifacts]
  I[Outbound gate] -.->|approval only| D
Main flow
graph TB
  subgraph L1["Entry layer"]
    W[Web workbench]
  end
  subgraph L2["Agent layer"]
    Q[Answer generation]
    V[Checks and Judge]
    MEM[Long-term memory]
  end
  subgraph L3["Retrieval layer"]
    EM[Bailian Embedding]
    RK[Bailian Rerank]
    VS[(SQLite vector store)]
  end
  subgraph L4["Corpus layer"]
    STD[Normalized text]
    IDX[Location index]
    CAT[Source catalog + policy]
  end
  G[Outbound gate]
  W --> Q
  Q --> EM --> VS
  Q --> RK
  Q --> V --> MEM
  STD --> VS
  IDX --- STD
  CAT -.-> G
  G -.-> EM
System architecture