Skip to main content

Agent Best Practices

Here is a list of best practices to follow when building agentic applications with Squid. Have some wisdom to share, or need a question answered? Contact us and let us know!

Instructions Guidelines

Role, Background, and Context

Tell the agent who it is, how it should behave, and what its main goal is.

You are a financial analyst capable of performing analysis on various financial documents and your main goal is to assist analysts in making faster and well-informed decisions.

Input and Output

Input: Specify where the agent should get the data from (e.g., knowledge base files, the web, or other agents).
Output: Define how the agent should respond (e.g., Text, JSON, PDFs, Bar Charts).

Constraints

Add time limits, filters, size caps, and exception handling.

Answer only according to data from the database.

Break Complex Tasks

Outline step-by-step procedures. Use bullets if necessary.

1. Load the input dataset.  
2. Identify null or inconsistent values.
3. Apply domain-specific cleaning rules.
4. Output a cleaned dataset and summary report.

Be Explicit

Use simple, direct, and unambiguous language. Avoid “maybe”, “try to”, or “could”.

❌ *Try to clean the data if it looks messy.*  
✅ *Remove any row where the email field is empty.*

Define Success Criteria

Clarify how the agent knows it has completed the task correctly.

Success = dataset has no nulls, consistent formats, and validation checks pass.

Boosting answer accuracy

To improve the accuracy of answers provided by agents, tinker with both the agent's instructions and its model. Both these factors can be easily adjusted in the Overview tab of Squid's Agent Studio.

Multi-Agent Guidelines

Assign Clear, Distinct Roles

Each agent should have a unique responsibility to avoid redundancy and confusion. When building agentic applications, it's best to create individual agents that are specialized to complete each task. Connecting specialized agents to a root agent that orchestrates their interactions can lead to a more efficient and effective system.

  • Avoid giving similar tasks to multiple agents to prevent overlapping.
  • Avoid having a single agent do multiple unrelated tasks (e.g., receiving user input, connecting to databases, and verifying data).
  • Split tasks across multiple agents.
- Agent 1: Writes code  
- Agent 2: Tests code
- Agent 3: Documents code

Define Input/Output Contracts

Standardize how agents communicate: define the format and the expected data.

All agents exchange JSON with `task`, `input`, and `output` fields.

Agent Coordination

Facilitate Agent-to-Agent communication by:

  • Using a coordinator agent to manage calls to additional agents
  • Or allowing agents to call each other directly as needed

In all cases, a coordinator agent should manage the entry point of the process, whether via:

  • User input
  • API call
  • Webhook
  • Function calls