---
title: Dynamic Outline-Guided Agent (DOGA)
url: https://www.emergentmind.com/topics/dynamic-outline-guided-agent-doga
type: topic
---

# Dynamic Outline-Guided Agent (DOGA)

The Dynamic Outline-Guided Agent (DOGA) is a modular inference-stage framework designed to inject turn-level strategic structure into large language models (LLMs) during goal-driven, multi-turn persuasive dialogue. Developed within the AI-Salesman architecture for telemarketing, DOGA introduces explicit, intent-conditioned micro-planning at each turn by dynamically retrieving and personalizing vetted outline steps from an offline script library, thereby addressing the strategic brittleness and factual hallucination endemic to generic prompt-based deployments of LLMs [2511.12133].

## 1. Inference Architecture and Core Operational Cycle

DOGA operates exclusively during inference, orchestrating each LLM response through three tightly integrated sub-tasks: intent classification, outline retrieval/personalization, and dynamic prompt assembly. At dialogue turn $t$, the agent executes:

1. **Intent Classification:**  
   A lightweight intent classifier (fine-tuned Qwen2.5-7B) leverages the current dialogue context, $H_{t-1}$, and the user’s latest utterance $U_t$ to assign a sales intent label $I_t$ (e.g., Business_Analysis, Objection_Handling). A finite-state machine constrains allowable transitions, ensuring strategic coherence.

2. **Outline Retrieval & Personalization:**  
   For the inferred $I_t$, the agent retrieves one or more high-performing templates from the offline script library $\mathcal L(I_t)$. These templates, distilled from historical conversions, contain parameterized placeholders (e.g., $\{\!\!\text{user\_onboard\_days}\}$), populated on-the-fly using the static user profile $M$.

3. **Dynamic Prompt Assembly:**  
   The populated outline (the dynamic outline) is concatenated with a static system prompt (encoding agent persona, business rules, and immutably defined constraints) and full dialogue history, yielding the constructed prompt $P_t$, which conditions the LLM response. The inference cycle thus implements:
   $$
   A_t^* = \arg\max_{A} P(A \mid P_\text{static} \oplus H_{t-1} \oplus D(I_t, M))
   $$
   where $D(I_t, M)$ denotes the personalized outline.

## 2. Algorithmic Process: Outline Generation and Turn Evolution

The turn-level DOGA algorithm formalizes the control flow for outline-guided inference. Given dialogue history $H_{t-1}$, the new user utterance $U_t$, and user profile $M$, the following loop occurs at each agent turn:

```python
function DOGA_generate(H_{t-1}, U_t, M):
    # 1) Intent classification (constrained by FSM)
    p = IntentClassifier(H_{t-1}, U_t)
    I_t = argmax_i p[i]
    # 2) Template retrieval & ranking
    candidates = 𝓛(I_t)
    for each T in candidates:
        score_T = cosine(Embed(T), Embed(U_t))
    T_star = argmax_{T∈candidates} score_T
    # 3) Personalize placeholders
    outline O_t = FillPlaceholders(T_star, M)
    # 4) Assemble prompt
    P_t = P_static ⊕ H_{t-1} ⊕ O_t
    # 5) Generate agent response
    A_t = LLM_generate(P_t)
    return A_t, I_t
```
At turn $t+1$, the updated history $H_t = H_{t-1} \oplus U_t \oplus A_t$ is supplied. This process ensures each agent action is tightly tethered to an explicit, contextualized micro-plan.

## 3. Offline Script Library Construction and Integration

DOGA’s outline provisioning depends on a pre-constructed library of scripts. This library is generated offline in a sequence of steps:

**1. Data Collection & Intent Annotation:**  
A dataset of high-performing tele-sales dialogues is annotated (via GPT-4) with top-level intent tags and explicitly invoked user facts at each turn.

**2. Script Extraction:**  
For each (turn, intent) tuple, the corresponding agent utterance is generalized into a succinct, bullet-point template via GPT-4 re-writing.

**3. Clustering & Summarization:**  
Templates for each intent are embedded (using Qwen3-Embedding), clustered according to greedy cosine similarity (threshold > 0.8), and each cluster is summarized by GPT-4 into a canonical outline template.

The finalized library $\mathcal L = \{i \mapsto [T^i_1, \dots, T^i_{n_i}]\}_{i \in \mathcal I}$ enables targeted, fidelity-promoting retrieval and prompt construction. At runtime, only $\mathcal L(I_t)$ is accessed to preserve computational efficiency.

| Phase                        | Method/Tool Used            | Output                             |
|------------------------------|-----------------------------|-------------------------------------|
| Data Collection & Annotation | GPT-4                       | Annotated corpus with intents       |
| Script Extraction            | GPT-4                       | Bullet-point outline templates      |
| Clustering & Summarization   | Qwen3-Embedding + GPT-4     | Canonical outline templates by intent |

## 4. Mathematical Formulation of Template Selection and Prompt Utility

DOGA formalizes outline retrieval and agent action as optimization problems for both template selection and response generation:

**Template Ranking:**  
When multiple templates for intent $I_t$ exist, selection is based on semantic similarity between candidate $T$ and $U_t$:
$$
\mathrm{Score}_{\text{sel}}(T; U_t) = \cos(\mathrm{Embed}(T), \mathrm{Embed}(U_t))
$$
The selected template is
$$
T^*_t = \arg\max_{T \in \mathcal L(I_t)} \mathrm{Score}_{\text{sel}}(T; U_t)
$$

**Turn-Level Utility Function:**  
The overall agent action at turn $t$ maximizes the (conditional) probability of completion under the dynamic system prompt:
$$
A^*_t = \arg\max_{A} P(A \mid P_{\text{static}} \oplus H_{t-1} \oplus O_t)
$$
The injected outline $O_t$ acts as a soft utility shaping function, steering the language model generation toward alignment with empirically validated strategies.

## 5. Outline-to-Utterance Mapping: Concrete Example

Consider the following user message at turn 3:
> "I’m worried I won’t see a return on this spend."

DOGA's processing sequence:
- **Intent classification:** assigns `Objection_Handling`.
- **Retrieved & personalized outline $O_3$:**
    1. Acknowledge the budget concern.
    2. Remind of “Flash Recharge Bonus” eligibility (< 30 days onboarded).
    3. Emphasize coupon value and valid use cases.
    4. Propose next action: “Shall we top up now?”

The LLM, conditioned on this explicit, numbered outline and domain constraints, produces an utterance in which each bullet structurally maps to a clause or sentence:
> "I completely understand your caution around budget. Since you joined 15 days ago and have spent under \$10, you qualify for our Flash Recharge Bonus. If you add \$50 today, you’ll receive a \$10 coupon valid on keyword-bidding ads. Would you like me to walk you through that recharge now?"

This mapping illustrates DOGA’s decoupling of *strategy selection* (outline) from *strategy execution* (natural language realization), ensuring both task alignment and user adaptation.

## 6. Faithfulness, Robustness, and Error Prevention Mechanisms

DOGA incorporates multiple mechanisms to enforce factuality, strategic robustness, and resistance to hallucination:

- **Domain Constraint Injection:**  
  The static system prompt $P_\text{static}$ encodes all promotional rules, eligibility criteria, pricing, and forbidden topics, prohibiting generation of unverified claims.

- **Intent-FSM Enforcement:**  
  The intent classifier is governed by a finite-state machine, enforcing allowed transitions (e.g., prohibiting jumps from Objection_Handling to Business_Analysis if incoherent), which maintains dialogue structure and progression.

- **Pre-verified Script Library:**  
  Only templates distilled, clustered, and manually sanity-checked from successful real-world dialogues are admissible; ungrounded strategy steps are precluded by construction.

- **Prompt Schema Control:**  
  The dynamic prompt utilizes a rigid, bullet-point schema in presenting the outline to the LLM, implicitly biasing the model towards following the stepwise plan.

Collectively, these mechanisms ensure that every LLM response is both strategically appropriate and factually correct within the given telemarketing domain [2511.12133]. This architecture provides a systematic, micro-planning-centric alternative to conventional few-shot prompting and post-hoc verification in controlled, goal-oriented conversational AI.

Source: https://www.emergentmind.com/topics/dynamic-outline-guided-agent-doga