Skip to content

Refine Multi-Step Prompts to Prevent Ambiguous Plan Execution #116

@rgeissen

Description

@rgeissen

Is your feature request related to a problem? Please describe.

When an LLM-powered agent executes a multi-step prompt (e.g., base_databaseBusinessDesc), it can misinterpret instructions that require it to perform a sub-task. For example, if a step in a larger plan says "Describe the table in a business context," the agent might try to fulfill this by calling another high-level prompt (like base_tableBusinessDesc) instead of performing the analysis itself. This leads to the agent getting stuck in a loop, never completing the original plan, and failing to deliver the final, comprehensive result to the user.

Describe the solution you'd like

I would like the instructions within complex, multi-step prompts to be more explicit to guide the LLM's behavior and prevent it from delegating tasks unnecessarily. Steps that require the LLM to generate content based on data from a previous step should explicitly forbid the use of other tools or prompts.

For instance, the base_databaseBusinessDesc prompt should be updated.

Current Wording:

## Phase 2 - describe the tables
- Get the table DDL from the user. Use the base_tableDDL function to get the DDL.
- Describe the table in a business context. The description should be a single string.

Proposed Wording:

## Phase 2 - describe the tables
- Use the `base_tableDDL` function to get the DDL for the table.
- Based *only* on the DDL you just received, describe the table in a business context. **Do not use any other tools or prompts for this description step.**

This clarification removes ambiguity and ensures the LLM correctly performs the analysis step-by-step as intended by the prompt's author.

Describe alternatives you've considered

An alternative is to build a complex, deterministic state machine on the client-side to manage every possible step of every prompt. This is not a scalable solution. It would be brittle, difficult to maintain, and would defeat the purpose of using a powerful LLM for plan execution, as we would be pre-programming every decision. The proposed solution of refining the prompt is far more flexible and robust.

Additional context

This change will improve the reliability of all complex, multi-step prompts that involve both tool execution and LLM-based content generation. It ensures that the agent follows the plan as laid out by the author and prevents it from getting into unintended recursive loops, leading to more predictable and accurate outcomes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions