Engineering AI Agents for Multi-Source Office Information Integration
This article explores the engineering practices behind building an intelligent agent to automatically draft proposals from fragmented office information. It breaks down the core challenges into four sub-problems—heterogeneous data ingestion, context assembly, service stability, and controllable output—and introduces a six-layer architecture to address them. The discussion covers document normalization, rate limiting and retry strategies for model calls, fallback routing across multiple models, and prompt engineering for task decomposition.
The Starting Point: Information Scattered Across Multiple Systems
In modern office environments, work-related information is rarely concentrated in a single place. Customer requirements may arrive as voice messages and fragmented text within instant messaging tools. Meeting conclusions reside in recorded transcripts. Proposal documents undergo multiple rounds of revision without a finalized version. Historical data accumulates in knowledge bases. Completing a typical task often requires an employee to switch back and forth between four or five systems, manually extracting, comparing, and organizing information—a process that is time-consuming and prone to missing critical details.
Large language models (LLMs) are capable of understanding unstructured text and, in theory, can handle information summarization and initial draft generation. However, directly pasting raw materials into a model often yields unreliable results. The reasons are manifold: input materials may exceed the model’s context window, formats vary significantly across sources, model services may throttle or time out, and the generated content often lacks traceable citations. Therefore, the core issue is not choosing the model itself, but building a reliable engineering pipeline around it.
Breaking Down the Problem
The goal—“automatically generate a proposal draft using an intelligent agent”—can be decomposed into four sub-problems:
- Heterogeneous Data Ingestion: Voice, text, documents, and meeting transcripts each require different retrieval mechanisms, necessitating a unified collection interface.
- Context Assembly: A model’s input length is limited, requiring relevance-based filtering and compression of materials.
- Service Stability: Model calls may encounter quota exhaustion, network fluctuations, and server errors. The workflow must be able to recover.
- Controllable Output: The results need to conform to a predefined structure and be traceable to the original materials to facilitate human review.
Each sub-problem corresponds to an independent module, and modules communicate through well-defined data structures. This separation enables individual abstracted components to be tested and replaced independently.
The Layered Architecture
A six-layer architecture is recommended:
[Data Ingestion Layer] Connectors for messages, documents, transcripts, and knowledge bases↓[Normalization Layer] Unifies into a standard document structure, adding source and time metadata↓[Retrieval Layer] Filters relevant segments by task keywords and vector similarity↓[Orchestration Layer] Decomposes sub-tasks, manages execution order and state↓[Model Call Layer] Encapsulates a unified interface, handles rate limits, retries, and routing↓[Output Layer] Validates structure, adds citations, provides a manual review entry point
Standardized objects flow through these layers, and no module directly depends on the implementation details of a specific data source. When a data source’s API changes, only the corresponding connector needs to be modified; the rest of the pipeline remains unaffected.
Normalizing Multi-Source Information
Data from various sources must be converted into a unified structure for downstream modules to process. A minimally viable document structure includes the following fields:
Document {id: Globally unique identifiersource_type: Category, e.g., chat_log / meeting_transcript / document / knowledge_basesource_ref: Original location, for traceabilitycreated_at: Original creation time, standardized to UTCauthor: Speaker or author, empty when missingcontent: Cleaned plain textmetadata: Other extension fields}
Three points are crucial during normalization. First, voice must be transcribed; the transcripts should retain timestamps to allow sorting by time. Second, cleaning should remove duplicate messages, emojis, and meaningless system prompts, but must preserve numbers, dates, and proper nouns, as these often serve as decision-making evidence. Third, each entry retains its source citation, enabling the final generated conclusions to be properly attributed.
Rate Limiting and Fault Tolerance for Model Calls
Model services typically enforce rate and quota limits, commonly expressed as requests-per-minute, daily token counts, or quotas that reset on a fixed schedule. A workflow that ignores these limits will experience frequent batch failures.
Exponential Backoff with Jitter
Upon encountering a rate limit or a transient error, the waiting time should be increased exponentially, with random jitter added to prevent a thundering herd of tasks from retrying simultaneously.
function call_with_retry(request, max_retries):for attempt in 0 .. max_retries:response = send(request)if response.ok:return responseif response.error not in [RATE_LIMITED, TIMEOUT, SERVER_ERROR]:raise response.error # Non-retryable errors like invalid argumentswait = min(BASE * 2 ** attempt, CAP)wait *= random.uniform(0.5, 1.0) # Random jittersleep(wait)raise RetryExhausted
The BASE delay and maximum CAP need to be tuned according to the actual rate limit policy. The number of retries should also have an upper bound. If exceeded, the task should be diverted to a pending queue rather than waiting indefinitely.
Client-Side Request Throttling
Beyond passive retries, the client should actively control its request rate. The token bucket algorithm is a common method: tokens are generated at a fixed rate, each request consumes one token, and requests are queued when no tokens are available. This smooths out bursts of traffic into a steady rate, reducing the likelihood of triggering server-side limits.
Persisting Task State
Long-running workflows can fail due to interruptions. After each sub-task completes, the result and its state should be written to persistent storage. Upon recovery, already-completed steps are skipped. This practice avoids wasteful duplicate model calls and conserves quota.
Degradation and Multi-Model Routing
A single model service cannot guarantee continuous availability. Engineering best practice is to abstract the underlying implementation behind an interface, allowing upper-layer business logic to remain agnostic to the specific service used.
interface ModelClient:generate(prompt, options) -> Resultdef route(task):primary = pool.get(task.quality_level)result = primary.generate(task.prompt)if result.failed:fallback = pool.get_fallback(task.quality_level)result = fallback.generate(task.prompt)if result.failed:return degrade(task) # Return a list of materials for manual processingreturn result
The routing strategy should consider three factors: the task’s output quality requirements, the cost budget, and data compliance regulations. Tasks involving sensitive information should only be routed to services that meet corporate data policies. For deterministic tasks like structured extraction, rule-based methods can be used first, deferring only the residual cases to a model.
Degradation is also a design consideration. When all models are unavailable, the system should return the retrieved materials list and a note for manual follow-up, rather than generating content without a factual basis.
Orchestration and Prompt Design
The core of an agent is breaking a large task into smaller, verifiable steps. Using “generate a new proposal based on meeting transcripts and historical plans” as an example, the steps can be: extract key requirements, retrieve historical proposals, compare differences, draft individual sections, and perform a final consistency check. Each step’s input and output must be explicitly defined.
Prompts are recommended to follow a fixed structure:
Role: You are a business analyst responsible for proposal writing.Objective: Based on the provided materials, organize customer requirements and provide draft proposal sections.Input:- A list of requirement sources (each with a source_ref)- Segments from historical proposalsConstraints:- Use only information present in the input materials. Mark any unmentioned information as "to be confirmed".- Each conclusion must include a source_ref.Output Format: JSON with fields including requirement_list, draft_sections, and open_questions.
Explicitly instructing the model on how to handle missing information (marking it as “to be confirmed”) and requiring source citations are the key mechanisms for producing a reliable and verifiable first draft. This structured approach creates a clear handoff point for human review and iteration.
