AI Agent Platform Upgrade: Workflow Orchestration and Real-Time Voice in Practice

    This article walks through a platform upgrade spanning more than twenty changes across workflow orchestration, composite sessions, real-time voice, persistent memory, model integration stability, and cross-device experience. It explains how to make control flow an explicit contract, how on-demand loading improves first-screen performance, how a state machine manages listening, speaking, and interruption in voice interactions, and how scoped memory keeps context trustworthy. It closes with practical rollout advice for building similar capabilities on Baidu AI Cloud.

    1. Upgrade Overview: From “It Runs” to “Controllable and Observable”

    For a developer-facing platform, the value of an iteration rarely comes from the number of feature toggles it adds. It comes from turning steps that used to rely on manual fallback into engineering capabilities that can be declared, observed, and reused. This upgrade bundles more than twenty changes across workflow orchestration, composite sessions, real-time voice, persistent memory, model integration stability, device-side settings, and desktop experience improvements. Taken together, they follow one clear thread: finer execution control, recoverable runtime state, loose coupling with external dependencies, and consistent cross-device experience.

    The sections below are organized by capability domain. Each one covers the problem background, key design points, and practical recommendations.

    2. Workflow Orchestration v2: Writing Control Flow as an Explicit Contract

    Early orchestration engines typically supported only linear execution and simple parallelism. Once branches multiplied, failure handling had to be hard-coded in outer scripts. The core change in v2 is promoting control flow from an implicit convention to an explicit contract.

    Key capabilities include:

    • Conditional routing: successor nodes can be declared with three semantics — “on success / on failure / always” — which is equivalent to lifting try/catch/finally into edge attributes on the graph;
    • True skipping: nodes whose conditions are not met produce no execution record, avoiding downstream misjudgment as an “empty result”;
    • all/any joins: parallel branches can continue when all complete or when any one completes, forming race semantics together with timeouts;
    • Bounded feedback loops: loop bodies carry a maximum iteration count and budget cap, preventing a model’s self-correction from falling into an infinite loop;
    • Execution evidence: every node emits structured evidence (input summary, duration, retry count, termination reason) for auditing and replay;
    • Deadlines and portable import/export: a deadline constrains the budget of the whole graph, and orchestration definitions can be imported and exported across environments.

    Illustrative definition (pseudocode, expressing semantics only):

    1. workflow: doc_pipeline
    2. deadline: 90s
    3. nodes:
    4. - id: fetch
    5. on_success: [parse]
    6. on_failure: [fallback]
    7. always: [audit]
    8. - id: parse
    9. join: all
    10. - id: refine
    11. loop:
    12. max_iterations: 3
    13. exit_when: score >= 0.9

    Engineering recommendation: making “deadline + bounded loop + execution evidence” the default trio can significantly reduce uncontrollable costs in production.

    3. Composite Sessions and First-Screen Performance: On-Demand Loading as the Main Thread

    Composite sessions (multi-model aggregation) previously could only be enabled in global configuration. They can now be selected directly when creating or switching a session, with correct handling of composite names, defaults, context window differences, and runtime behavior differences. This requires the session layer to maintain a set of “composite metadata” that explicitly models context windows, routing policies, and fallback order, instead of scattering them across UI state.

    The key performance judgment is this: the main cause of first-screen size growth is not business logic, but the synchronous loading of optional capabilities. The strategy is to load rich text rendering, chart rendering, the code editor, resources for non-current languages, and optional overlays on demand, compressing the first-screen critical path to a minimal set.

    1. // Load heavy rendering capabilities only when actually needed
    2. const renderMermaid = () => import('./features/mermaid').then(m => m.default);

    Session switching was improved as well: model switching shows a blocking progress state to prevent repeated clicks; switching conversations replays a fade-in animation while preserving drafts and attachments, reducing the anxiety of “switch away and lose it.”

    4. Real-Time Voice: Managing “Listen, Speak, Interrupt” with a State Machine

    Real-time voice is the most failure-prone module because it is simultaneously affected by network jitter, echo, permission prompts, and user interruption. This upgrade introduces a full-screen real-time voice mode in one-to-one chat, supporting real-time transcription, voice queue playback, tool activity display, and interruption control. On the stability side, it covers silent-state recovery, avoiding recording the assistant’s own voice, automatically switching to the current backup transcription service, and keeping approval dialogs visible during interactions.

    The recommendation is to use an explicit state machine rather than a stack of boolean flags:

    1. Idle → Listening → Transcribing → Speaking → (Interrupted) → Listening
    2. ↑__________________ recovery after silence timeout __________________|

    Key points:

    1. Silence recovery: return to the listenable state after a long period without input, with throttling to avoid frequent reconnections;
    2. Echo suppression: use playback state as the input for judging “non-user speech” to prevent self-wakeup;
    3. Backup transcription service: fall back by priority when the primary path is unavailable, with the UI clearly indicating the current path;
    4. Approval visibility: dialogs for high-risk tool calls must not be covered by the voice layer; safety takes priority over smoothness.

    Mobile also needs explicit start/stop controls to avoid compliance disputes caused by “automatic recording.”

    5. Persistent Memory and Scope Isolation: Keeping Context Controllable and Trustworthy

    The value of persistent memory lies in reuse across sessions, while the risk lies in cross-contamination and pollution. This upgrade introduces scoped memory, provides the current model integration and model information in the runtime context, and applies safer handling policies to production memory stores. Three principles are recommended in practice:

    • Scope first: layer by user, tenant, session, and task, and enforce scope filtering at retrieval time;
    • Writes must be revocable: memory entries carry source, time, and confidence, and support review and deletion;
    • Minimum necessary: only distill conclusive facts, and never store raw sensitive data.
    1. {
    2. "scope": {"tenant": "t-1", "user": "u-9", "session": "s-3"},
    3. "fact": "prefers Chinese technical documentation",
    4. "confidence": 0.82,
    5. "source": "explicit_feedback"
    6. }

    6. Model Integration Stability and Cross-Device Experience

    The core tension at the integration layer is the trust order between “real-time discovery results” and “local cache.” This adjustment makes it explicit: the model catalog aligns with runtime, real-time discovery takes priority, and stale fallback cache must not overwrite newer results; custom integration aliases stay stable in already-loaded sessions, avoiding unnecessary client rebuilds and lost request headers. Both points are essentially about reducing implicit state transitions.

    Device and desktop improvements include: displaying the device code, automatically selecting the microphone, syncing disconnect state, limiting transport-layer probing duration, and no longer flashing a console window when capturing workspace changes in an ordinary directory. In addition, the graph view adds multi-select by category, skill and memory nodes with different shapes, previews, and more complete keyboard and touch interactions; exported documents keep their extensions; and streaming output no longer repeats the final message.

    7. Implementation Recommendations

    To build similar capabilities on Baidu AI Cloud, you can compose them from general capability domains: use a container platform to host orchestration and the voice gateway, a message queue for the voice queue and event replay, object storage for execution evidence and exported files, logging and monitoring with alerting for a closed observability loop, and key management to hold integration credentials. The recommended overall order is: first add execution evidence and deadlines, then on-demand loading and a state-machine-based voice layer, and finally refine memory scoping and cross-device consistency.