Agent

An Agent action in Leverage allows you to create AI-powered automation that can perform multiple steps and make decisions to complete complex tasks. Agents use the actions you provide to work through problems autonomously until the specified objective is achieved.

Key Features

  • Decision-making capabilities to determine the best approach to a task

  • Action selection from tools you provide

  • Iterative processing that continues until instructions are fulfilled

  • Dynamic variable integration for workflow context

  • Ability to process files and access knowledge bases

  • Smart suggestions for improving agent configuration

How to Add an Agent Action

  1. Open the Add Action menu using one of three methods:

    • Click the "Add Action" button in the top left corner

    • Click on a connection circle on an existing action card

    • Click and drag from one action to create a connection

  2. Select "AI" from the categories or find "Agent" in the options

  3. Click on "Agent" to add it to your canvas

💡 The Agent action appears similar to the Prompt action in the workflow canvas

How to Add an Agent Action

  1. Open the Add Action menu using one of three methods:

    • Click the "Add Action" button in the top left corner

    • Click on a connection circle on an existing action card

    • Click and drag from one action to create a connection

  2. Select "AI" from the categories or find "Agent" in the options

  3. Click on "Agent" to add it to your canvas

💡 The Agent action appears similar to the Prompt action in the workflow canvas.

How to Configure the Agent Action Card

  1. Locate the Agent card on your canvas which includes:

    • Header with the action name

    • Variable chip in the top left corner for referencing outputs

    • Control buttons for expanding/collapsing and running the agent

    • Connection points for inputs and outputs

  2. Configure the basic settings:

    • Instructions: Add your agent's objective in the instructions box

  3. Provide clear instructions for what the agent needs to accomplish

⚠️ Be specific with instructions as this determines how the agent will operate.

Expanding the Instructions View

To view your instructions in a larger format:

  • Hover over the input box at the bottom right corner

  • Click the expand arrows icon

  • This opens an expanded view for easier editing of longer instructions

How to Add Actions and Resources to Your Agent

Below the instructions section, you can add various resources by clicking the "+" button:

1. Add an App

  • Integrates external applications like Gmail, Slack, Outlook, and other services

  • Provides access to Leverage's built-in tools and integrations

2. Add an Action

  • Select from Leverage's action library

  • Configure action parameters or leave them blank for the agent to determine

  • For sub-actions, you can specify parameters if needed or let the agent fill them out automatically

3. Add a Variable

  • Reference workflow variables the agent should use

  • Ensures the agent has access to necessary data from previous steps

4. Add a Knowledge Base

  • Select from your available knowledge bases

  • Gives the agent access to specific information repositories

💡 The agent will attempt to automatically configure actions when possible, using context from your instructions.

How to Configure JSON Output Format

When you add an action to your agent, you can configure structured JSON output:

How to Set Up JSON Output

  1. After adding an action to your agent, look for the "Advanced" section

  2. Select "JSON Output" option

  3. Configure the schema using one of two methods:

Simple Table Method:

  1. Use the simple table interface

  2. Add attributes by specifying field names and types

  3. Define the structure using the visual editor

Advanced JSON Schema:

  1. Switch to the "Advanced" section

  2. Write the JSON schema directly

  3. Define the exact structure and validation rules you want

This allows you to ensure the agent returns data in a specific, structured format that can be easily used by subsequent workflow actions.

💡 JSON output configuration helps maintain consistent data structure across your workflow

Agent Suggestions Feature

Below the agent card, you'll find a suggestions panel that provides:

  1. Action Recommendations: Suggests relevant actions based on your instructions

  2. Variable Recommendations: Identifies variables that might be useful for your task

  3. Instruction Formatting: If your instructions aren't optimally structured, a magic wand icon appears

    • Click the magic wand to automatically reformat your prompt

    • This creates a more systematic structure that agents can better understand

How the Agent Action Works

  1. The agent analyzes your instructions to understand the objective

  2. It selects appropriate actions from those you've provided

  3. It executes actions in sequence, making decisions based on results

  4. The process continues until the agent determines the instructions have been fulfilled

  5. The final output is passed to the next action in your workflow

⚠️ If action configurations have been previously specified in your workflow, the agent will follow those rules rather than creating its own configuration.

How the Agent Action Works

  1. The agent analyzes your instructions to understand the objective

  2. It selects appropriate actions from those you've provided

  3. It executes actions in sequence, making decisions based on results

  4. The process continues until the agent determines the instructions have been fulfilled

  5. The final output is passed to the next action in your workflow

⚠️ If action configurations have been previously specified in your workflow, the agent will follow those rules rather than creating its own configuration

Writing Effective Agent Instructions

Structure Guidelines

  1. Clear Objective: Start with a specific goal statement

  2. Context: Provide relevant background information

  3. Constraints: Specify any limitations or requirements

  4. Expected Output: Describe what success looks like

Best Practices

  • Be clear about the specific goal the agent needs to achieve

  • Specify any constraints or requirements for the solution

  • Reference any variables the agent should use with proper syntax

  • Focus on the "what" (goal) rather than the "how" (specific steps)

  • Use the formatting suggestions when available to improve clarity

  • Start with action verbs: "Research," "Analyze," "Create," "Process"

  • Define success criteria clearly

  • Explain the business context or use case

  • Include relevant details about the data or situation

  • Set boundaries for the agent's actions

  • Define quality standards or formatting requirements

  • Use clear, concise language

  • Break complex objectives into logical components

  • Avoid ambiguous terms or jargon

💡 For best results, provide context that helps the agent understand the problem scope

Example Instruction Formats

For Research Tasks:

Research and analyze [specific topic] using the provided knowledge base and web search capabilities. Focus on [specific aspects] and compile findings into a comprehensive summary that includes key insights, trends, and actionable recommendations. Ensure all sources are properly cited.

For Data Processing:

Process the uploaded customer data to identify patterns in purchasing behavior. Analyze the data for trends, segment customers by behavior type, and generate a report with visualizations showing key insights. Use the customer database for additional context where needed.

For Content Creation:

Create a professional email campaign based on the provided customer segment data. The email should be personalized, follow our brand guidelines from the knowledge base, and include compelling subject lines. Generate 3 variations for A/B testing purposes.

Advanced Techniques

Use Conditional Logic:

  • "If X condition is met, then Y action should be taken"

  • "When analyzing data, prioritize recent entries over historical ones"

  • "In case of missing information, use the knowledge base to fill gaps"

Specify Output Format:

  • "Present findings in a structured report with executive summary, detailed analysis, and recommendations"

  • "Output results as a JSON object with specific field names"

  • "Create a markdown-formatted document with proper headers and sections"

Include Quality Checks:

  • "Verify all calculations before presenting results"

  • "Cross-reference findings with multiple sources when possible"

  • "Flag any inconsistencies or potential issues in the data"

⚠️ Avoid being too vague about the desired outcome or providing step-by-step instructions instead of objectives

💡 Use the formatting suggestions feature when available to automatically optimize your instruction structure

Working with Files and Data

Agents can:

  • Process files passed through triggers

  • Access information from connected knowledge bases

  • Handle multiple data sources simultaneously

  • Pass processed information to subsequent workflow steps

Testing Your Agent Action

How to test your agent:

  1. Click the "Run" button on the Agent card to test it with current workflow variables

  2. Review the final output to ensure it meets your requirements

  3. If the agent encounters issues:

    • The output panel will explain why it couldn't complete the task

    • Review the error message for guidance on adjustments needed

    • Adjust instructions or available actions if necessary to improve results

⚠️ Agents may take longer to execute than standard prompts because they perform multiple steps to complete a task

Troubleshooting

If your agent isn't performing as expected:

  1. Check the output panel for detailed error messages

  2. Ensure all necessary actions and resources are added

  3. Use the suggestion feature to optimize your instructions

  4. Verify that variables are correctly referenced

  5. Consider breaking complex tasks into smaller, clearer objectives

  6. Review your instructions for clarity and specificity

  7. Test with simpler objectives first to validate the agent setup

Last updated