GenAIHub

Agents & Tool Calling Simulator

Explore multi-agent workflows, tool calling patterns, and error handling

Agent Architecture Patterns

Compare different agent architectures from simple single-agent to complex multi-agent orchestration.

User
Agent
Reasoning + Acting
Tools
API, DB, Code

Single Agent Architecture

One LLM handles all tasks: reasoning, planning, and tool execution. Simple but limited for complex tasks.

Simple Low Latency Limited Scope
Pattern Complexity Latency Best For
Single Agent Low Fast Simple tasks, Q&A
Planner-Executor Medium Medium Multi-step tasks
Hierarchical High Slow Complex workflows
Collaborative High Variable Specialized domains
Tool Calling Mechanism

Tools extend LLM capabilities by allowing them to interact with external systems like APIs, databases, and code interpreters.

Available Tools

Calculator
Math operations
SQL Query
Database access
Code Interpreter
Execute Python
Tool Schema Example
const searchTool = { "name": "web_search", "description": "Search the web", "parameters": { "type": "object", "properties": { "query": { "type": "string" } } } };

Execution Flow

1. User Request

"What's the weather in Tokyo?"

2. Tool Selection

Agent chooses: web_search

3. Tool Execution

{"query": "Tokyo weather today"}

4. Process Results

Parse and synthesize response

5. Final Response

Natural language answer

85%
Tool Selection Accuracy
~2s
Avg Execution Time
12%
Retry Rate
4
Tools Available
Multi-Agent Orchestration

Multiple specialized agents collaborate to solve complex tasks. Each agent has specific expertise and tools.

Orchestrator
Task delegation
Researcher
Web search, docs
Analyst
Data analysis
Writer
Report generation

Execution Log

Multi-agent session initialized
Research the latest trends in AI agents and write a summary report
Orchestrator: Breaking down task into subtasks...
Error Handling & Recovery

Robust agents must handle tool failures, API errors, and unexpected responses gracefully.

Common Error Scenarios

Tool Timeout
API doesn't respond in time
Invalid Parameters
LLM sends wrong tool input
Rate Limited
Too many API calls
Tool Hallucination
LLM invents non-existent tool

Recovery Strategies

Retry with Backoff

Automatically retry failed calls with exponential delay

Fallback Tools

Use alternative tool when primary fails

Ask User

Request clarification when uncertain

LLM Fallback

Use LLM knowledge when tool unavailable

Click an error scenario to see recovery in action

ReAct: Reasoning + Acting

ReAct interleaves reasoning (thinking) with action (tool use) for better decision-making.

ReAct Loop

1
Thought

Reason about what to do next

2
Action

Execute tool or action

3
Observation

Observe tool result

↺ repeat until done

Example Trace

# Question: What's the population of Tokyo divided by 2? Thought: I need to find Tokyo's population first. Action: search("Tokyo population 2024") Observation: Tokyo population is 13.96 million Thought: Now I need to divide by 2. Action: calculator(13960000 / 2) Observation: 6980000 Thought: I have the answer. Final Answer: 6.98 million

ReAct vs Standard Prompting

Standard

LLM generates complete response in one shot. May hallucinate or miss steps.

Accuracy: ~65%
ReAct

Step-by-step reasoning with tool verification. More reliable and interpretable.

Accuracy: ~92%
Agent Playground
ReAct
Plan & Execute
Max Iterations 5

Agent output will appear here

0
Steps
0
Tool Calls
0ms
Total Time