From Chatbots to Executable LLM Workflows

    This article explains how to evolve large language model applications from simple chat endpoints into executable workflow entities. It breaks down four core capabilities—runnable application entities with input and output schemas, declarative UI rendering driven by model output, multi-model workflow orchestration, and no-code plan decomposition—and covers engineering practices for orchestration, fault tolerance, observability, quality evaluation, and common pitfalls on Baidu AI Cloud.

    From Chatbots to Executable LLM Workflows

    1. Background: Why “Being Able to Chat” Is Not “Being Able to Work”

    Over the past two years, the typical form of an LLM application has been a single input box: the user asks a question, and the model answers. This works well enough for knowledge Q&A and draft copywriting, but three structural gaps appear once it enters real business scenarios.

    First, the interaction form is too limited. Business systems need clickable, validatable, and auto-fillable structured interfaces—not a block of natural language. Plain text output forces the caller to build an extra parsing and rendering layer, which lengthens the chain.

    Second, a single model has clear capability boundaries. Text generation, image generation, video generation, and speech synthesis each have models they excel at. No single model can cover an end-to-end flow, so an orchestration layer is required to connect them.

    Third, the flow is not controllable. Business requirements specify step order, failure retries, and result validation, none of which a simple “one question, one answer” exchange can express—there is no way to represent branches, loops, or human confirmation nodes.

    This has led the industry to a clear technical direction: upgrading LLMs from a “chat endpoint” into an “executable micro-application entity.” This article abstracts three general-purpose capabilities around that theme and provides an engineering design that can be implemented.

    2. Capability 1: From Preset Instructions to a Runnable Program Entity

    The essence of the traditional preset instruction mode (often called a role prompt template in the industry) is context constraint: it injects a fixed block of text before the session starts to influence the style and scope of the model’s output, but it disappears when the session ends and has no state or lifecycle.

    A runnable micro-application entity is closer to a program: it has a clear input contract, internal state, execution stages, and a structured output. The differences can be summarized in the table below.

    Dimension Preset instruction session Runnable micro-app
    Carrier One-off context Application instance with a lifecycle
    State Essentially no persistent state Maintains session and intermediate results
    Output Free text Structured data + UI description
    Reuse Copy the prompt Publish, share, version control
    Failure handling Ask again Node-level retry and fallback

    In engineering terms, this means defining an input schema and an output schema for the application. An illustrative definition is shown below (it only expresses structure and is not the interface of any specific product):

    1. {
    2. "input": {
    3. "topic": "string, required",
    4. "count": "integer, 1..20, default 3"
    5. },
    6. "output": {
    7. "items": "array<{title:string, reason:string, tags:string[]}>",
    8. "ui": "object, UI description tree"
    9. }
    10. }

    With a schema, an application can be tested, versioned, and invoked by other systems in a standard way. This is the dividing line between a “toy” and a “component.”

    3. Capability 2: Visual Interface Rendering with Declarative UI

    The second key capability is a UI driven by model output. The approach is not mysterious: instead of having the model produce HTML directly, have it produce a constrained UI description tree (UI schema), which the host renders with a component library. This ensures visual consistency and avoids injection risks.

    An example of a constrained UI description:

    1. {
    2. "type": "Card",
    3. "props": { "title": "Ingredient list" },
    4. "children": [
    5. { "type": "List", "items": ["Main ingredient A", "Main ingredient B"] },
    6. { "type": "Button", "props": { "label": "Regenerate" }, "action": "regenerate" }
    7. ]
    8. }

    There are four design points:

    1. Component allowlist. The set of allowed node types is fixed, and the model can only choose from the allowlist, which eliminates arbitrary tag injection.
    2. Enumerated actions. A button’s action must be a pre-registered action; clicking it triggers the corresponding workflow node rather than executing arbitrary text.
    3. Separation of data and view. Business data goes through the data channel and UI structure goes through the view channel, which makes caching and analytics easier.
    4. Accessibility and fallback. If rendering fails, fall back to plain text or a table to keep the app usable.

    This division of labor—the model produces structure and the host handles rendering—aligns with the declarative UI approach already mature in frontend development, so teams can get started without adopting a new paradigm.

    4. Capability 3: Workflow Orchestration Across Multiple Models

    The third capability is organizing multiple capability models into a directed graph. Take a “content recommendation app” as an example; a typical workflow contains the following nodes:

    • Node 1, input parsing: Extract parameters such as topic, count, and style, then validate them and fill in defaults.
    • Node 2, candidate retrieval: Retrieve candidate items from your own knowledge base or a document set in object storage.
    • Node 3, text inference: Call a language model to score relevance and generate reasons.
    • Node 4, image enhancement (optional): Call an image generation model to produce a cover; skip it on failure.
    • Node 5, result shaping: Normalize to the output schema and perform deduplication, truncation, and sensitive content filtering.
    • Node 6, UI rendering: Generate the UI schema and return it.

    The orchestration layer needs to solve four engineering problems:

    • Dependencies and concurrency: Run nodes without dependencies in parallel to reduce end-to-end latency.
    • Fault tolerance strategy: Distinguish retryable errors (timeouts, rate limits) from non-retryable ones (invalid parameters), combined with exponential backoff.
    • Cost control: Set a maximum output length and call limit for each node to prevent the flow from amplifying costs.
    • Observability: Generate a trace ID for each execution to correlate node logs, durations, and token consumption.

    Pseudocode for the orchestration skeleton:

    1. def run(inputs):
    2. params = parse_and_validate(inputs) # Node 1
    3. cands = retrieve(params.topic, params.count) # Node 2
    4. ranked = llm_rank(cands, params.style) # Node 3
    5. covers = safe_parallel(gen_cover, ranked) # Node 4, can degrade on failure
    6. payload = shape(ranked, covers) # Node 5
    7. return {"data": payload, "ui": build_ui(payload)} # Node 6

    5. Capability 4: No-Code Automatic Flow Decomposition

    No-code does not mean no engineering; it means handing the authoring work of orchestration to the model while leaving the constraint work to humans. The user describes a goal in natural language, and the system decomposes it into an executable sequence of steps, then maps them onto registered node capabilities.

    Reliable implementation depends on three layers of constraints:

    1. Capability registry. Every node that can be invoked must be registered in advance, including its name, input and output schemas, timeout, and quota. The model can only choose capabilities in the registry and cannot invent steps out of thin air.
    2. Plan validation. The decomposition result first goes through a static check: are parameters complete, do types match, are there cycles, does it exceed the maximum number of steps? If validation fails, the system asks for re-planning rather than executing directly.
    3. Human confirmation points. For nodes involving write operations, external side effects, or high-cost calls, insert a confirmation step and continue only after the user clicks to confirm.

    An illustrative plan structure:

    1. {
    2. "plan": [
    3. { "node": "extract", "args": { "field": "topic" } },
    4. { "node": "sentiment", "args": { "input": "$extract.value" } },
    5. { "node": "summarize", "args": { "input": "$sentiment.value" } },
    6. { "node": "format", "args": { "template": "card" } }
    7. ]
    8. }

    Variable references (such as $extract.value) create explicit data dependencies between nodes, which makes parallelization easier and failure localization simpler.

    6. Implementation Recommendations on Baidu AI Cloud

    To implement the architecture above in the Baidu AI Cloud environment, you can organize it by general capability layers:

    • Model layer: Use the language, image, and other general model capabilities provided by the Qianfan ModelBuilder platform, select models per node requirement, and wrap a unified invocation adapter layer to make replacement and canary rollout easier.
    • Orchestration layer: Deploy the application in a container platform or a function-compute environment, and drive node execution with a directed graph engine; keep workflow definitions separate from code and support version rollback.
    • Data layer: Store raw documents in object storage, put retrieval indexes in a vector search service, and use a cache service for hot data to reduce latency.
    • Observability layer: Connect to logging and monitoring/alerting services, and build dashboards and threshold alerts for node success rate, P95 latency, and token consumption.
    • Security governance: Apply unified input and output content safety filtering, key management, and least-privilege access control, and strictly enforce the component allowlist for UI rendering.

    A pragmatic rollout pace is to first get end-to-end working with a fixed workflow, then gradually open up natural language decomposition, and only then introduce multi-tenancy and a quota system. Skipping the first two steps and going straight to “full automation” usually comes at a cost in maintainability.

    7. Quality Evaluation and Common Pitfalls

    Evaluation should cover four dimensions rather than only whether the answer “looks reasonable”:

    • Schema compliance rate: Whether the output satisfies the schema, and the proportion of missing fields and type errors.
    • Flow success rate: The end-to-end completion rate and the failure distribution across nodes.
    • Latency and cost: End-to-end P95 latency, average number of calls per execution, and token consumption.
    • Human adoption rate: The proportion of results adopted directly or adopted with only minor adjustments.

    Common pitfalls include: overloading a single model call with too many responsibilities, which makes output unstable; a UI description lacking an allowlist, which creates rendering and security risks; node granularity that is too fine, making the orchestration graph hard to maintain; and missing idempotency design, which causes retries to produce duplicate side effects. The corresponding general solutions are to split responsibilities, constrain enumerations, divide nodes by business semantics, and introduce idempotency keys for write operations.

    8. Conclusion

    From a chat window with preset instructions to a runnable, orchestrable, and automatically decomposable micro-app, the essence is that LLM applications have shifted from a “content generator” to an “execution unit.” For developers, the real barrier is not calling the model but the engineering fundamentals: schema design, orchestration fault tolerance, UI constraints, and observability. Build these capabilities layer by layer, and LLMs can reliably enter production systems and continuously deliver measurable business value.