Evolution of Reasoning Capabilities in LLM APIs: From Long Context to Multi-Agent Practice

    This article explains how LLM APIs are shifting from single-turn question answering to complete task workflows. It covers whether full-document input can replace retrieval, how to assign reasoning effort across task types, and how agents and multi-agent systems carry out tasks within defined boundaries. It also briefly covers search and batch processing, and ends with a practical pilot plan for teams.

    From Single-Turn Q&A to Closed-Loop Tasks

    Over the past two years, LLM API evaluations have mostly focused on the accuracy and fluency of single-turn question answering. Business systems, however, care about the full chain: retrieval, filtering, decomposition, decision-making, and execution. The question therefore becomes whether a model can complete tasks reliably within this loop. This requires API platforms to answer three questions: how much context a single request can hold, how to allocate reasoning effort across different tasks, and how a model can shift from passively answering to actively executing.

    The judgments below are synthesized from public materials and industry practice. Specific model capabilities, prices, and limits are subject to each platform’s official documentation. Capabilities that have not been formally released should be treated as assumptions and verified before launch.

    1. Long Context: Can Full-Document Input Replace Retrieval?

    Expanded context windows have changed how RAG (Retrieval-Augmented Generation) is designed. When windows were short, the common approach was to split documents into chunks, recall passages by vector similarity, and concatenate them for generation. The main problem with this approach is that recall rate directly limits answer quality, and chunk boundaries can cut off causal relationships between entities. For example, if an annual report’s “R&D investment increased year over year” and “mainly due to higher personnel compensation and server depreciation in the AI division” fall into two different chunks, the model may miss the causal link.

    When the window is large enough, the entire document can go directly into the context. The following is an illustrative example. The helper functions must be implemented by your project:

    1. # Illustrative code: count_tokens, truncate_by_tokens, and call_model must be implemented by your project
    2. MAX_INPUT_TOKENS = 128_000 # Set according to the chosen model's window and budget. Check the official documentation.
    3. RESERVED_FOR_OUTPUT = 4_000 # Tokens reserved for the model's output
    4. SYSTEM_PROMPT = (
    5. "You are a financial analysis assistant. Answer only based on the content inside the <document> tags. "
    6. "If the document does not support an answer, state this clearly and do not speculate."
    7. )
    8. def build_messages(report_text: str, question: str) -> list[dict]:
    9. budget = MAX_INPUT_TOKENS - RESERVED_FOR_OUTPUT
    10. if count_tokens(report_text) > budget:
    11. # Fall back when over budget: truncate first, or summarize in segments and then merge
    12. report_text = truncate_by_tokens(report_text, budget)
    13. return [
    14. {"role": "system", "content": SYSTEM_PROMPT},
    15. {
    16. "role": "user",
    17. "content": (
    18. f"<document>\n{report_text}\n</document>\n\n"
    19. f"Question: {question}\n"
    20. "Please confirm again: answer only based on the document content."
    21. ),
    22. },
    23. ]

    This approach has three points to note. First, the system instructions, document delimiters, and the question should be clearly separated, so that document content is not mistaken for instructions. Second, there must be a fallback path for overly long documents. The system should neither raise an error nor silently discard content. Third, repeating key instructions at the beginning and end of the input helps. Research shows that models tend to overlook information in the middle of long inputs, a phenomenon often called “Lost in the Middle.”

    Full-document input offers three main benefits. It reduces retrieval errors, because the model reads all the content directly, so key evidence is not missing when the retriever fails to recall it. It supports reasoning across sections, such as comparing a contract’s background assumptions with the data in its appendix. It also simplifies the architecture, so small and mid-sized teams can avoid maintaining a separate vector database and hybrid retrieval logic.

    These benefits have conditions. Full-document input suits scenarios where documents are updated infrequently, permissions are simple, and the content fits entirely within the budget. If documents change often, or if the system is multi-tenant and must isolate data by user, a retrieval layer and permission isolation are still needed.

    Cost should also be considered separately. Standard self-attention compute grows roughly with the square of input length, so latency and memory pressure rise noticeably for long inputs. Most services bill by token, and the unit price typically grows close to linearly. Latency and resource consumption, however, often grow faster. Therefore, short and well-defined tasks, such as intent classification, should still use trimmed, short context. Full long context is only worth using for summarization and review tasks that genuinely require global understanding.

    2. Tiered Reasoning Effort: Trade-offs Across Three Modes

    Requests differ widely in their quality and speed requirements. “Convert this text into JSON” and “Assess the potential legal risks in this M&A contract” call for very different amounts of reasoning. Some platforms offer tiered reasoning effort, commonly named Low, High, and Max. The names and parameters vary by platform.

    Reasoning Tier Reasoning Budget Example Use Cases Cost and Latency Profile
    Low (fast tier) Low reasoning budget. Usually reduces or disables explicit chain-of-thought and prioritizes low latency. Intent classification, entity extraction, simple FAQs, formatted output Low unit price and controllable latency. Suited to high-concurrency online services.
    High (balanced tier) Standard reasoning budget. Suited to routine reasoning and moderately complex tasks. Routine code generation, development with unit tests, moderately difficult summarization, structured data analysis Balanced quality and speed. Suited to most general-purpose agent tasks.
    Max (deep tier) High reasoning budget. Allows longer internal reasoning. Complex math proofs, architecture design with multiple constraints, long-chain planning Higher cost and latency per request, but may reduce rework.

    The phrase “reduces rework” in the table describes an expectation, not a guarantee. Whether the model performs multi-path verification depends on how each API is implemented. Teams should confirm the actual effect of each tier with their own evaluation sets.

    Dynamic Routing

    The Max tier should not be the default, or costs will rise quickly as request volume grows. A common approach is to first use rules or a lightweight classifier to estimate request difficulty, then select a tier. The code below is a starting point. The keyword rules should be calibrated continuously with labeled samples:

    1. from dataclasses import dataclass
    2. # Placeholders: replace with the actual model names or inference parameters provided by your platform
    3. LOW_MODEL = "your-model-low"
    4. HIGH_MODEL = "your-model-high"
    5. MAX_MODEL = "your-model-max"
    6. SIMPLE_KEYWORDS = ["分类", "提取", "翻译", "格式化", "是否"]
    7. ANALYTIC_KEYWORDS = ["对比", "分析", "评估", "推导", "风险"]
    8. PLANNING_KEYWORDS = ["规划", "多步骤", "架构设计", "证明", "博弈"]
    9. @dataclass
    10. class Route:
    11. model: str
    12. timeout_s: int
    13. def route_to_model(query: str) -> Route:
    14. if any(k in query for k in PLANNING_KEYWORDS):
    15. return Route(MAX_MODEL, timeout_s=300)
    16. if any(k in query for k in ANALYTIC_KEYWORDS):
    17. return Route(HIGH_MODEL, timeout_s=60)
    18. if len(query) <= 200 and any(k in query for k in SIMPLE_KEYWORDS):
    19. return Route(LOW_MODEL, timeout_s=10)
    20. # Requests that match no rule use the middle tier, so unknown requests do not default to the most expensive tier
    21. return Route(HIGH_MODEL, timeout_s=60)

    This code involves several design choices. Requests that match no rule go to the High tier rather than the Max tier, which keeps costs under control. Each tier has a different timeout, so slow requests do not occupy all connections. In production, record the tier, latency, token usage, and user feedback for each request, and use these records to calibrate the rules. If Low-tier outputs often need retries, the request was probably misclassified and should be moved to a higher tier.

    3. Agents and Multi-Agent Systems: From Tool Calls to Collaboration

    A traditional API call is a linear, single question-and-answer exchange. The agent pattern adds a loop. The model decides which tool to call based on the current state, such as search, code execution, or an HTTP request, and then adjusts its plan based on the result. Whether a platform provides this capability at the protocol level varies, so consult the official documentation.

    Take a “competitive analysis report” as an example. The user only needs to state the goal, such as “compare the performance and cost of mainstream vector databases.” The agent might first search for recent benchmark articles, then open technical documentation pages to extract parameters, write a script to organize the performance data and generate charts, and finally compile everything into a report. The developer’s main job is to provide tools and constraints, rather than to write the scheduling logic for each step.

    Agent loops must have boundaries. The most common constraints are a maximum number of steps, a tool allowlist, a cost cap per task, and human approval before any write operation. Without these constraints, a loop can keep consuming tokens along a wrong path.

    Swarm Multi-Agent Collaboration

    If an agent addresses how one worker completes a task efficiently, multi-agent collaboration addresses how several roles divide and coordinate the work. Common roles include planner, executor, and reviewer. The roles exchange results through messages or structured data.

    “Swarm” is often used in the industry to refer to lightweight experimental frameworks. It is not a unified protocol offered by every API platform. When designing a system, do not assume the platform handles role scheduling, timeouts, and failure recovery for you.

    1. User request
    2. ↓
    3. [Task Planning Agent] - splits the task list
    4. ↓ ↓
    5. [Data Retrieval Agent] [Code Execution Agent]
    6. ↓ ↓
    7. [Quality Review Agent] - aggregates results and checks for contradictions
    8. ↓
    9. Final response

    The value of multiple agents lies in division of labor and isolation. For example, a review agent can be responsible only for checking the execution agent’s output. Running the two in separate processes reduces the risk of permissions leaking between them. However, process isolation only limits the