> ## Documentation Index
> Fetch the complete documentation index at: https://docs.demiurg.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Prompt Engineering Tips

> Advanced techniques for crafting effective agent descriptions

## Mastering agent prompts

The quality of your prompts directly impacts your agents' performance. Small wording changes can significantly alter agent behavior.

<Info>
  Your prompt is the foundation of your agent's capabilities. Precision matters.
</Info>

## Essential prompt components

* Clear role definition
* Specific knowledge domains
* Defined personality traits
* Explicit capabilities
* Task descriptions
* Interaction guidelines
* Performance criteria

## Effective structure

```
I need an AI agent that can [primary function].

Knowledge areas: [list specific domains]

Personality: [describe interaction style]

The agent should be able to:
- [capability 1]
- [capability 2]
- [capability 3]

When interacting, the agent should [interaction guidelines].

Success means [performance criteria].
```

## Advanced techniques

<AccordionGroup>
  <Accordion title="Role framing" icon="user-tie" defaultOpen>
    Frame your agent's role as a professional position or expert identity.

    <strong>Less effective:</strong> "An agent that helps with marketing"

    <strong>More effective:</strong> "A senior digital marketing strategist with 15+ years of experience in B2B SaaS companies"
  </Accordion>

  <Accordion title="Contextual anchoring" icon="anchor">
    Provide specific contexts to guide your agent's understanding of its purpose.

    <strong>Less effective:</strong> "An agent that helps with writing"

    <strong>More effective:</strong> "A writing coach for graduate students working on dissertations in the humanities"
  </Accordion>

  <Accordion title="Capability hierarchies" icon="layer-group">
    Organize capabilities from fundamental to advanced, helping the agent prioritize.

    <strong>Example:</strong>
    "The agent should have these capabilities, in order of priority:

    1. Identify investment opportunities based on financial metrics
    2. Analyze risk factors for each opportunity
    3. Create portfolio allocation recommendations
    4. Generate detailed investment reports"
  </Accordion>

  <Accordion title="Constraint definition" icon="ban">
    Explicitly define boundaries for your agent's behavior.

    <strong>Example:</strong>
    "The agent must never:

    * Make specific stock price predictions
    * Recommend individual securities without disclaimers
    * Present itself as a licensed financial advisor
    * Guarantee returns on investments"
  </Accordion>

  <Accordion title="Reasoning patterns" icon="brain">
    Define how your agent should approach problems.

    <strong>Analytical:</strong> "Break problems into components, examine each systematically, synthesize findings"

    <strong>Creative:</strong> "Explore broadly, make unexpected connections, evaluate and refine promising options"
  </Accordion>

  <Accordion title="Output formatting" icon="file-lines">
    Specify how information should be presented.

    <strong>Example:</strong>
    "Structure information as:

    1. Executive summary (2-3 sentences)
    2. Key findings (bullet points)
    3. Detailed analysis (by topic)
    4. Recommendations (prioritized)
    5. Next steps (actionable items)"
  </Accordion>
</AccordionGroup>

## Domain-specific patterns

<CardGroup cols={2}>
  <Card title="Analytical agents" icon="chart-line">
    <strong>Focus on:</strong> Data handling, analytical frameworks, statistical approaches, visualization preferences

    <strong>Pattern:</strong> "Analyze \[data] using \[methods] to identify \[insights], presenting results with \[visualization] and indicating confidence levels."
  </Card>

  <Card title="Creative agents" icon="lightbulb">
    <strong>Focus on:</strong> Stylistic preferences, creative constraints, inspiration sources, iteration approaches

    <strong>Pattern:</strong> "Generate \[output] in the style of \[reference], balancing \[quality A] and \[quality B], with variations exploring different \[dimensions]."
  </Card>

  <Card title="Educational agents" icon="graduation-cap">
    <strong>Focus on:</strong> Teaching methodologies, knowledge scaffolding, assessment approaches, explanation techniques

    <strong>Pattern:</strong> "Teach \[subject] from \[level], using \[methodology], adapting explanations based on comprehension."
  </Card>

  <Card title="Operational agents" icon="gears">
    <strong>Focus on:</strong> Process definitions, decision criteria, exception handling, verification steps

    <strong>Pattern:</strong> "Manage \[process] following \[procedure], making decisions based on \[criteria], handling exceptions by \[approach]."
  </Card>
</CardGroup>

## Example prompts

<AccordionGroup>
  <Accordion title="Financial advisor agent" icon="money-bill-trend-up">
    ```
    I need an AI financial advisor specialized in personal finance and retirement planning.

    Knowledge areas:
    - Investment strategies (stocks, bonds, ETFs, mutual funds)
    - Retirement account types (401(k), IRA, Roth) and tax implications
    - Debt management and credit optimization
    - Budgeting methodologies
    - Current financial regulations and tax laws

    Personality:
    Approachable yet professional, explains complex concepts simply without condescension. Conservative in recommendations, prioritizes risk management.

    The agent should be able to:
    - Analyze financial situations based on provided information
    - Create personalized savings and investment plans
    - Recommend account types and investment categories
    - Explain tax implications of financial decisions
    - Generate retirement projections for various scenarios
    - Provide tailored budgeting advice

    When providing advice, the agent should:
    - Acknowledge the limitations of its guidance
    - Provide explanations for recommendations
    - Suggest when a human advisor should be consulted
    - Never guarantee specific returns or outcomes
    - Consider both short-term needs and long-term goals

    Success means users feel confident making financial decisions and have clear, actionable steps.
    ```
  </Accordion>

  <Accordion title="Content marketing strategist" icon="bullhorn">
    ```
    I need an AI content marketing strategist specialized in SaaS and B2B technology markets.

    Knowledge areas:
    - Content marketing methodologies and best practices
    - SEO principles and current algorithm trends
    - B2B buyer journey and decision-making processes
    - SaaS industry terminology and common challenges
    - Content distribution channels and analytics

    Personality:
    Strategic, data-driven, yet creative. Communicates with authority while remaining conversational.

    The agent should be able to:
    - Develop content strategies aligned with business goals
    - Generate ideas targeting specific personas and funnel stages
    - Create detailed content briefs with SEO guidelines
    - Suggest content repurposing opportunities
    - Analyze performance metrics and recommend optimizations
    - Identify content gaps and competitive opportunities

    When developing strategies, the agent should:
    - Start by understanding business objectives and audience
    - Balance short-term wins with long-term brand building
    - Consider resource constraints and implementation feasibility
    - Prioritize recommendations based on potential impact
    - Connect initiatives to measurable outcomes

    Success means providing actionable guidance that drives traffic, engagement, and leads.
    ```
  </Accordion>
</AccordionGroup>

## Iterative refinement process

<Steps>
  <Step title="Start with a basic prompt">
    Create your initial agent with a solid description.
  </Step>

  <Step title="Test thoroughly">
    Interact with your agent across various relevant scenarios.
  </Step>

  <Step title="Identify gaps">
    Note areas where your agent underperforms or misunderstands.
  </Step>

  <Step title="Refine your prompt">
    Revise your description to address specific issues.
  </Step>

  <Step title="Repeat">
    Continue this cycle until your agent performs consistently.
  </Step>
</Steps>

<Tip>
  Keep records of your prompt revisions and how each change affected performance.
</Tip>

## Troubleshooting common issues

<AccordionGroup>
  <Accordion title="Agent misunderstands purpose" icon="circle-question">
    <strong>Symptoms:</strong>

    * Performs tasks outside intended domain
    * Fails to prioritize core functions
    * Seems confused about its role

    <strong>Solution:</strong>
    Make your role definition more explicit and prominent. Start with a clear purpose statement.
  </Accordion>

  <Accordion title="Agent lacks depth" icon="arrow-down-to-line">
    <strong>Symptoms:</strong>

    * Provides surface-level information
    * Cannot handle specialized queries
    * Indicates knowledge limitations

    <strong>Solution:</strong>
    Specify detailed knowledge domains and sub-domains.
  </Accordion>

  <Accordion title="Inconsistent personality" icon="face-meh">
    <strong>Symptoms:</strong>

    * Tone varies unpredictably
    * Sometimes contradicts established character
    * Personality doesn't align with purpose

    <strong>Solution:</strong>
    Define personality traits explicitly and provide communication examples.
  </Accordion>

  <Accordion title="Struggles with complexity" icon="network-wired">
    <strong>Symptoms:</strong>

    * Performs well on simple tasks but fails on complex ones
    * Doesn't break down problems effectively
    * Provides incomplete solutions

    <strong>Solution:</strong>
    Include methodologies for approaching complex tasks and step-by-step processes.
  </Accordion>
</AccordionGroup>

## Expert tips

1. <strong>Use concrete examples</strong> of expected outputs to provide clear guidance.

2. <strong>Define interaction patterns</strong> for different request types to create consistency.

3. <strong>Anticipate edge cases</strong> with instructions for handling unusual or ambiguous inputs.

<Warning>
  Prompt engineering is an evolving discipline. What works for one agent may not work for another. Stay experimental in your approach.
</Warning>
