Table of contents
Official Content
  • This documentation is valid for:

When executing an Agent or a Task as part of a Agentic Process, a prompt is automatically generated and sent to the LLM. This prompt is built by the execution engine based on multiple factors, including the Agent's configuration, the Tools it can access, and Contextual information like process variables or predefined parameters.

This article explains the general structure of that prompt; the format described here represents the base structure used during execution.

Prompt components

The prompt consists of several elements, grouped into two main parts:

  1. Agent prompt
  2. Task prompt

Agent prompt and task prompt in The Lab

1. Agent Prompt

The Agent prompt defines the Agent’s behavior.

It includes:

  • Reasoning Strategy: Determines how the Agent processes information and generates responses. See Reasoning Strategies for more information.

  • Background Knowledge (context): Provides context information relevant to the Agent’s role.

  • Guidelines (instructions): Sets general instructions on how the Agent should act.

  • Examples: Provides sample inputs and expected outputs to guide the Agent's behavior.

2. Task Prompt

The Task prompt is added when the Agent executes a specific Task. It adapts the Agent’s behavior to the requirements of that Task.

  • Task context: Provides additional background information that the Agent should take into account for this specific Task.

  • Task instructions: Defines the step-by-step actions the agent is expected to follow. These instructions complement the agent's general guidelines.

  • Inputs: Artifacts (files) the agent needs to use or analyze during Task execution.

  • Outputs: Artifacts the agent must deliver at the end of the Task.

  • Examples: Provides sample data to the Task to help guide the Agent.

Note: The information in the Task prompt is combined with the Agent prompt at runtime.

How the Prompt is Built

The execution engine uses a template system to combine all prompt components into a single message for the LLM. The template defines the order and structure of each section, such as reasoning strategy, agent context, task instructions, and examples.

The prompt structure is defined at the system level but can be customized per project. By default, it includes the following structure:

{{#if.REASONING_STRATEGY}}
# Reasoning Strategy:
## {{REASONING_STRATEGY}}
{{/if.REASONING_STRATEGY}}

{{#if.AGENT_CONTEXT}}
# Agent Context:
## {{AGENT_CONTEXT}}
{{/if.AGENT_CONTEXT}}

{{#if.AGENT_INSTRUCTIONS}}
# Agent instructions:
## {{AGENT_INSTRUCTIONS}}
{{/if.AGENT_INSTRUCTIONS}}

{{#if.AGENT_EXAMPLES}}
# Examples:
## {{AGENT_EXAMPLES}}
{{/if.AGENT_EXAMPLES}}

{{#if.TASK_CONTEXT}}
# Task Context:
## {{TASK_CONTEXT}}
{{/if.TASK_CONTEXT}}

{{#if.TASK_INSTRUCTIONS}}
# Task instructions:
{{TASK_INSTRUCTIONS}}
{{/if.TASK_INSTRUCTIONS}}

{{#if.TASK_EXAMPLES}}
# Examples:
## {{TASK_EXAMPLES}}
{{/if.TASK_EXAMPLES}}

Note: The template shown here is dynamic and may vary between projects.

Prompt sample

Here is a sample prompt for an Agent called Translation Expert, which translates text into any desired language.

Reasoning Strategy:
You are an advanced AI assistant capable of reasoning through complex problems using a step-by-step approach. Before providing a final answer, break down the problem into logical steps, considering all relevant factors. Follow these principles:

- Understand the Question: Identify key details, constraints, and objectives.
- Break It Down: Decompose the problem into smaller, manageable steps.
- Apply Logical Reasoning: Use relevant knowledge, rules, and structured reasoning to analyze each step.
- Verify Consistency: Check for errors, contradictions, or missing information before finalizing the answer.
- Conclude Clearly: Provide a concise, well-reasoned final response based on your step-by-step analysis.
If the problem involves numerical calculations, show your work. If it requires qualitative reasoning, justify each step with clear explanations. Always prioritize accuracy, clarity, and logical coherence in your responses.

Agent Context:
You are an experienced language translator capable of translating text from any language to another.

Agent instructions:
When a user provides a text and specifies the target language, translate the text accurately and maintain the original meaning. If the user does not specify the target language, ask for clarification.

Examples:

- text: Translate 'Hello' to Spanish.
  translatedText: Hola

- text: Translate 'Bonjour' to English.
  translatedText: Hello

- text: Translate 'Hello, how are you?' to Japanese.
  translatedText: こんにちは、お元気ですか?

- text: Translate '¿Dónde está la biblioteca?' to English.
  translatedText: Where is the library?
Last update: March 2025 | © GeneXus. All rights reserved. GeneXus Powered by Globant