ShadAI Framework
  1. core-concepts
ShadAI Framework
  • Index
  • README
  • Pricing
    • Pricing Plan
  • advanced
    • Best Practices
    • Tool Orchestration
    • Performance Optimization
    • Custom Tools
  • examples
    • Advanced Patterns
    • Custom Agent Examples
    • Market Research Examples
    • Multi-Document Analysis
    • Basic Query Examples
  • api-reference
    • Exceptions Reference
    • Engine Tool API
    • Shadai Client API Reference
    • Query Tool API
    • Summarize Tool API
    • Agent Tool API
    • Web Search Tool API
  • use-cases
    • Knowledge Synthesis
    • Research Assistant
    • Custom Workflows
    • Document Q&A
  • core-concepts
    • Architecture
    • Intelligent Agent
    • RAG System
    • Tools Overview
  • guides
    • Memory & Context
    • Streaming Responses
    • File Ingestion
    • Error Handling
    • Session Management
  • getting-started
    • Authentication
    • Your First Query
    • Quick Start
    • Installation
  1. core-concepts

Intelligent Agent

Shadai's intelligent agent enables autonomous workflows with custom tools through a powerful plan → execute → synthesize pattern.

What is an Agent?#

An agent is an AI system that can:
Plan: Decide which tools to use
Execute: Run tools autonomously
Synthesize: Combine results into coherent answers
The agent automatically:
1.
Decides to use search_database
2.
Infers arguments from prompt
3.
Executes the tool
4.
Synthesizes results

Agent Workflow#

Traditional Approach (Manual)#

Agent Approach (Autonomous)#

Agent automatically:
Determines tool sequence
Infers all arguments
Handles tool execution
Combines outputs

Creating Custom Tools#

Method 1: Using @tool Decorator#

Key Points:
Use @tool decorator
Add docstring (agent uses this!)
Type hints required
Return string

Method 2: Manual Tool Definition#

Use @tool decorator - it's simpler and automatically generates schemas!

Tool Design Best Practices#

✅ Good Tool#

Why Good:
Clear, descriptive name
Detailed docstring
Type hints
Optional parameters
Returns formatted string

❌ Bad Tool#

Why Bad:
No decorator
No docstring
No type hints
Vague name
Returns non-string

Agent Capabilities#

1. Tool Selection#

Agent automatically chooses appropriate tools:

2. Argument Inference#

Agent infers arguments from prompt:

3. Multi-Step Execution#

Agent chains tools automatically:

4. Result Synthesis#

Agent combines tool outputs into coherent response:

Real-World Examples#

Example 1: Customer Support#

Example 2: Market Research#

Example 3: Data Pipeline#

Advanced Patterns#

Pattern 1: Conditional Execution#

Pattern 2: Error Handling in Tools#

Pattern 3: Async Tools#

Limitations#

1. Tool Complexity#

Works Well:
Challenging:
Solution: Break into smaller tools

2. Ambiguous Prompts#

Clear:
"Search users with revenue > $50k, limit 10, email results to boss@company.com"
Ambiguous:
"Do something with users"
Solution: Be specific in prompts

3. Tool Count#

Optimal: 3-10 tools
Too Many: 50+ tools (agent gets confused)
Solution: Group related functionality, provide clear descriptions

Debugging Agents#

Check Tool Execution#

Validate Tool Descriptions#

Make sure docstrings are clear:

Best Practices#

✅ Do This#

❌ Don't Do This#

Next Steps#

Custom Tools Deep Dive
Tool Orchestration
Custom Agent Examples

Key Takeaway: Agents automate complex workflows. Design clear tools, write specific prompts, let the agent orchestrate!
Modified at 2025-10-17 17:47:10
Previous
Architecture
Next
RAG System
Built with