Skip to main content

How Deepdesk Constructs Assistant Prompts

When you configure an assistant in Deepdesk, your configuration is transformed into a structured prompt that is sent to the LLM. Understanding how Deepdesk constructs these prompts will help you write more effective assistant instructions and better utilize features like memory and tools.

The Prompt Structure

Each time an assistant is called, Deepdesk automatically constructs a prompt with the following components:

<instructions>
Your assistant configuration from the Instructions field
</instructions>

<metadata>
Conversation metadata (source_id, customer_id, etc.)
</metadata>

<parameters>
Any parameters passed to the assistant
</parameters>

<memory>
Previously stored conversation memory
</memory>

<transcript>
The conversation history between agent and customer
</transcript>

Instructions Block

The <instructions> block contains exactly what you've entered in the "Instructions" field when configuring your assistant. This is where you define the assistant's purpose, behavior, and how it should process information. Everything you write here becomes part of the prompt sent to the LLM.

Example:

<instructions>
You are a customer service assistant helping agents verify customer identities.
Your goal is to determine if the customer has been properly identified.

Look for the following information in the conversation:
- Account number
- Name match
- Date of birth
- Address verification

Rate verification confidence as High, Medium, or Low.
</instructions>

Metadata Block

The <metadata> block contains information about the conversation that isn't part of the actual dialogue, such as:

  • Conversation IDs (internal and external)
  • Source of the conversation (chat, voice, email)
  • Profile assignment
  • Customer identifiers

This information is automatically collected by Deepdesk depending on what's available regarding the ongoing interaction, and included in the prompt to give the assistant context about the conversation.

Parameters Block

The <parameters> block contains any parameters that were passed to the assistant when it was called. This can include:

  • Parameters from API calls
  • Parameters from other assistants calling this assistant
  • Parameters from Assistant Routes

Parameters allow you to customize the behavior of an assistant for specific situations without changing its core configuration.

Memory Block

The <memory> block contains information that has been stored during the conversation using the write_to_memory tool. This allows assistants to:

  • Remember information between turns in a conversation
  • Pass information between different assistants
  • Maintain state across multiple invocations

For example, if one assistant stores a customer's account status using:

{
"tool_calls": [
{
"tool": "write_to_memory",
"parameters": {
"key": "account_status",
"data": "premium"
}
}
]
}

A subsequent assistant call would receive this in the prompt:

<memory>
- account_status: premium
</memory>

Transcript Block

The <transcript> block contains the conversation history between the agent and customer. This is only included if the "Include conversation transcript" toggle is enabled in your assistant settings.

The transcript helps the assistant understand the context of the conversation, track what has already been discussed, and make more relevant responses.

Implications for Assistant Design

Understanding the prompt construction process will help you:

  1. Write better instructions: Structure your instructions knowing that they'll be placed in a broader context

  2. Use memory effectively: Design assistants that can pass information to each other using memory

  3. Leverage metadata: Write conditions that respond to specific metadata values

  4. Structure parameters: Define well-documented parameters that other systems can use when calling your assistant

By understanding how Deepdesk constructs prompts, you can create more powerful, context-aware assistants that make full use of the platform's capabilities.