"Everything Is a Plugin" Architecture Explained: Building a Consultation Workflow on a Plugin-Based AI Framework
A plugin-based AI framework mounts all external capabilities—queries, computation, retrieval, and business processes—as tools driven by structured model calls. This article explains the architectural value of the "everything is a plugin" paradigm and walks through a practical case: turning a vague prompt requirement for a classical-formula consultation into a rigorously gated, executable workflow plugin. Key design takeaways include structured option cards instead of free-form Q&A, hard confidence thresholds that prevent premature conclusions, and an evidence-verification loop with fallback so that "no evidence, no output" is enforced by code rather than by prompts.
“Everything Is a Plugin” Architecture Explained: Building a Consultation Workflow on a Plugin-Based AI Framework
Recently, a large language model application framework built around the idea that “everything is a plugin” was open-sourced, sparking broad discussion in the developer community. The core idea behind this class of frameworks is straightforward: the LLM itself is only responsible for understanding and generation, while every capability for interacting with the outside world—querying, computing, retrieving, executing business processes—is mounted as a plugin, and the model drives these plugins through structured tool calls. This article does not focus on any specific framework. Instead, it analyzes the design value of this architecture from a general engineering perspective, and uses a practical case—a “classical formula consultation” workflow plugin—to show how a vague prompt-based requirement can be turned into a logically rigorous, executable process with hard gates.
1. What Problem Does “Everything Is a Plugin” Actually Solve?
In traditional LLM application development, a common approach is to embed business logic into the system prompt: telling the model “you should ask X first, then do Y, and finally output Z.” This works in small demos, but it has three obvious flaws:
- Weak enforcement. A prompt is essentially a suggestion, not a rule. After multiple conversation turns, models tend to forget instructions, skip steps, and jump to conclusions too early.
- Uncontrollable state. The conversation context is free-form text generated by the model. Developers cannot precisely know which step the workflow has reached or what information has been collected.
- Hard to reuse and test. Logic buried in natural language cannot be unit-tested or reused across applications.
A plugin-based architecture strips this logic out of the prompt and turns it into tool functions with explicit input/output contracts. The model can only decide “which tool to call and with what parameters,” while the state machines, validation rules, and gating logic inside each tool are enforced by code. In other words: the rules that must hold go into the engine, not into the prompt. This is the most important engineering value of this class of frameworks.
2. Case Background: Turning “Classical Formula Consultation” into a Workflow Plugin
Take an assisted consultation workflow for classical Chinese medicine formulas as an example. A responsible consultation process should include: collecting basic information, asking about the chief complaint, refining symptoms and signs (tongue appearance, pulse), performing pattern differentiation to produce candidate formulas, verifying supporting evidence in the literature, and only then issuing a prescription after final confirmation. If the evidence at any step is insufficient, the process should not advance.
In a plugin-based framework, this workflow can be decomposed into several independent tools, for example (names below are illustrative):
consult: initial intake, covering form of address, age, gender, chief complaint, duration of illness, and special conditions (pregnancy, postpartum, breastfeeding, etc.).symptoms/signs: symptom and sign collection, covering multiple groups of multi-select symptoms, tongue appearance, pulse, plus numeric ranges for body temperature, blood pressure, and pulse rate.differentiate: formula-pattern differentiation, which first presents differential-diagnosis checkpoints as multi-select options, then returns candidate formulas with match scores.evidence: literature verification, searching classical medical texts and public medical literature databases.prescribe: prescription output, which re-checks the literature conclusions before issuing a formula and refuses—returning to the differentiation step—if the evidence is insufficient.
Each tool corresponds to a “gate” in the workflow, and gates advance via a stage parameter (such as stage), forming an explicit state machine.
3. Key Design 1: Option Cards Instead of Free-Form Q&A
The interaction experience on the patient (or user) side directly determines the quality of information collected. Free-text questioning has two problems: users often don’t know how to describe their condition, and the model’s parsing of free text is inherently uncertain.
A better approach in practice is structured option cards: symptoms are organized by category as multi-select questions (covering nearly a hundred common symptoms), tongue appearance and pulse each have standard option sets, temperature/blood pressure/pulse offer range options with the ability to enter specific values, and the chief complaint uses a hybrid “multi-select + free-text supplement” mode.
This yields three benefits:
- The collected data consists of structured enumerated values, so downstream matching computations do not depend on the model’s language understanding, and results are reproducible.
- It lowers the bar for users to express themselves, making the interaction smoother.
- Every answer can be explicitly written into the workflow state, making auditing and backtracking easy.
4. Key Design 2: Confidence Thresholds—Ask More Rather Than Conclude Early
This is the most valuable design principle in the entire plugin. Medical scenarios are most vulnerable to “it looks similar, so let’s conclude.” Therefore, the differentiation tool should have hard confidence rules built in, for example:
- If the number of matched primary symptoms is insufficient, no formula conclusion is given.
- If the top candidate’s match score is below a threshold (e.g., 60%), no conclusion is given.
- If the gap between the first and second candidates is smaller than a defined margin (e.g., 8 percentage points, tightened to 4 points in the high-match range), the differentiation is considered insufficient and no conclusion is given.
When any of these conditions is triggered, the tool does not return formula options. Instead, it returns the next round of clarifying differential questions, and caps the number of automatic follow-up rounds (e.g., 3) to avoid infinite loops.
The significance of these thresholds: the model may “want to say,” but the code does not “let it through.” Even if the model leans toward issuing a formula in a given turn, the structured result returned by the tool call forces the workflow back into the questioning stage. The trusted enforcer of rules is the engine, not a probabilistic language model—and that is precisely the essential advantage of plugin-based architecture over pure prompt-based approaches.
5. Key Design 3: Evidence Loop and Failure Fallback
“Only prescribe when supporting evidence can be found” is another hard constraint. Implementation can be split into two gates:
- Literature verification tool: searches the built-in library of classical texts and connects to public literature search interfaces (such as medical literature databases), returning a
supported / unsupportedverdict with citations for each candidate formula. - Pre-prescription re-verification: before issuing a formula, the prescription tool re-validates the verification results. If the verdict is not
supported, it directly refuses to prescribe and returns a list of alternative candidates, driving the workflow back to the differentiation step for re-selection.
This forms a closed loop: differentiate → verify → fall back to differentiation on failure → prescribe only on success. In a workflow diagram, the “fallback edges” often say more about a system’s reliability than the “forward edges.”
Additionally, when users challenge a conclusion, a “principled defense” response strategy can be designed: if the original evidence is solid, present the classical text excerpts and literature references to stand by the conclusion; if there is a genuine oversight, correct the formula on the spot. This “defensible and correctable” posture fits a serious assistive tool far better than either blind confidence or unconditional retreat.
6. Safety Boundaries and Engineering Notes
For any health-related domain, the product must repeatedly emphasize that such a plugin is a learning and assistive tool, and its output cannot replace in-person diagnosis or prescriptions from licensed physicians. Dosage conversions should use conservative standards, and formulas containing toxic ingredients must carry a notice that they should only be used under physician guidance. These disclaimers should not live only in documentation—they should be embedded in the tool’s fixed output templates so that every prescription output is accompanied by the notice.
From a deployment perspective, this kind of plugin application can run on general-purpose cloud infrastructure: a container platform to host the plugin service, object storage for the text library and literature cache, a logging service to record every tool-call chain for auditing, and monitoring/alerting to track threshold-trigger rates and workflow interruption rates. These generic capability categories are sufficient; there is no need to bind to any specific vendor.
7. Conclusion
The value of “everything is a plugin” lies not in the number of plugins, but in the engineering paradigm it provides: confining a non-deterministic LLM inside a deterministic process cage. The practical case in this article demonstrates three transferable design points: use structured options instead of free-form Q&A to guarantee input quality; use confidence thresholds to prevent the model from concluding prematurely; and use evidence verification with failure fallback to build a closed loop, making “no evidence, no output” a code-enforced rule. For any AI application in a serious domain—healthcare, law, finance, industrial diagnostics—this approach is well worth adopting.
