Skip to main content
Learn how to create Agentic Loops that eliminate hallucinations by connecting your AI to real-world data sources.

Quick Start: Your First Agentic Loop

Let’s build an agent that provides accurate weather information by calling a real weather API instead of guessing.
1

Navigate to Agent Loops

From your dashboard, click Agent Loops in the sidebar.
Agent loops list

Agent loops list

2

Create New Loop

Click Create Agent Loop to open the configuration form.
Create form

Create agent loop form

3

Name Your Agent

Give your agent a descriptive name: “Weather Information Agent”
Named agent

Named agent loop

4

Configure System Prompt

Define the agent’s role and available tools:
System prompt

System prompt configuration

5

Set User Message

Provide the initial question or task:
User message

User message input

6

Configure MCP Server

Add the tool that provides weather data:
  • Click Add MCP Server
  • Select HTTP Client (for calling weather APIs)
  • Or select a pre-configured weather MCP server if available
MCP server

MCP server configured

7

Add Callback (Optional)

Configure where to send results:
Callback

Callback configuration

8

Configure Advanced Settings

Set execution parameters:
  • Max Iterations: 5 (simple task)
  • Timeout: 60 seconds
  • Model: Claude 3.5 Sonnet (recommended for tool use)
Advanced settings

Advanced settings

9

Save and Test

Click Create to save your Agentic Loop, then click Run to test it.
Complete agent

Complete agent loop

What Happens When It Runs

Execution Flow

Execution Log

After running, you’ll see a detailed log:

Configuration Deep Dive

System Prompt Best Practices

The system prompt is critical for preventing hallucinations. Here’s how to write effective prompts:

Bad System Prompt (Allows Hallucinations)

Problems:
  • Doesn’t mention tools
  • No instruction to use real data
  • Agent might guess instead of fetching

Good System Prompt (Prevents Hallucinations)

Why This Works:
  • Explicitly requires tool use
  • Documents available tools
  • Provides clear process
  • Includes error handling
  • Forbids guessing

User Message Patterns

The user message can be static or dynamic:

Static Message (For Scheduled Tasks)

Dynamic Message (For API Triggers)

Multi-Step Instructions

MCP Server Selection

Choose tools based on your data sources:
Start with one tool: Begin with a single MCP server. Only add more tools when the agent needs multiple data sources. Too many tools can confuse the agent.

Iteration Limits

Set iterations based on task complexity:

Real-World Examples

Example 1: Customer Order Tracking

Goal: Eliminate “your order probably shipped” hallucinations. Configuration:
Result: Every order status is grounded in real database data.

Example 2: Real-Time Inventory Checker

Goal: Stop telling customers items are in stock when they’re not. Configuration:
Result: Accurate, real-time inventory information.

Example 3: Meeting Scheduler

Goal: Schedule meetings with actual calendar data, not guesses. Configuration:
Result: Zero double-bookings, all meetings based on actual availability.

Testing Your Agentic Loop

Pre-Launch Checklist

Before deploying your agent:
  • Test with multiple scenarios: Try edge cases, not just happy paths
  • Verify tool calls work: Check that MCP servers respond correctly
  • Review execution logs: Confirm agent is using tools, not guessing
  • Check error handling: What happens when APIs fail?
  • Validate response format: Is the output structured as expected?
  • Test iteration limits: Does the agent complete within the limit?

Common Issues & Fixes

Issue: Agent Guesses Instead of Using Tools

Symptom:
Fix:

Issue: Agent Runs Out of Iterations

Symptom:
Fix:

Issue: Tool Calls Fail

Symptom:
Fix:
  • Verify MCP server URL is correct
  • Check that server is running and accessible
  • Increase timeout in advanced settings
  • Add retry logic to system prompt

Issue: Agent Uses Wrong Tool

Symptom:
Fix:

Monitoring and Optimization

Key Metrics to Track

Monitor these metrics for each agent:

Cost Management

Agentic Loops cost more than simple prompts due to:
  • Multiple iterations (more tokens)
  • Tool call overhead
  • Longer execution time
Optimization Tips:
  • Set appropriate iteration limits (don’t over-provision)
  • Use efficient system prompts (fewer tokens)
  • Cache frequently accessed data
  • Choose appropriate model (smaller models for simple tasks)

Improving Performance

Reduce Iterations:
Parallel Tool Calls:
Efficient Prompts:

API Integration

Trigger Agentic Loops programmatically:

Complete API Reference

View the full API specification with all endpoints and parameters

Next Steps

Configure Tools

Connect MCP servers to access real-world data

Best Practices

Optimize for performance, cost, and reliability