Agents & Tool Calling
Build AI agents that can use tools to accomplish complex tasks.
What You'll Learn
- Overview - What agents are and how they work
- Creating Agents - Configure agent behavior and tools
- Tools - Available built-in and custom tools
- Chatting - Interact with your agents
- Managing - Update and maintain agents
- Tool Calling - Direct tool usage without agents
- Examples - Integration examples
Overview
Agents are AI assistants that can use tools to complete tasks.
How Agents Work
Agents follow a four-step process:
- Plan - LLM analyzes the task and selects appropriate tools
- Execute - Run selected tools with provided parameters
- Observe - Review tool results
- Synthesize - Combine results into final answer
Agents vs. Raw LLM
| Feature | Raw LLM | Agents |
|---|---|---|
| Tool usage | No | Yes - Can call APIs, search, execute code |
| Multi-step tasks | Limited | Yes - Can iterate until task complete |
| Real-time data | No | Yes - Can fetch current information |
| Complex workflows | Manual | Yes - Automated tool chains |
Use Cases
| Use Case | Recommended Tools |
|---|---|
| Research | RAG search + web search |
| Data analysis | Code execution |
| Customer support | RAG + CRM tools |
| Automation | Custom MCP tools |
Quick Example
Create an agent that uses RAG and web search:
import requests
# Create agent
response = requests.post(
"http://localhost/api/v1/agent/configs",
headers={"Authorization": "Bearer YOUR_API_KEY"},
json={
"name": "research_agent",
"system_prompt": "You are a research assistant. Use web search for current info and RAG for internal docs.",
"model": "gpt-4",
"builtin_tools": ["rag_search", "web_search"],
"tool_choice": "auto",
"max_iterations": 5
}
)
agent_id = response.json()["id"]
# Chat with agent
chat_response = requests.post(
"http://localhost/api/v1/agent/chat",
headers={"Authorization": "Bearer YOUR_API_KEY"},
json={
"agent_id": agent_id,
"message": "What are the latest developments in AI?"
}
)
print(f"Response: {chat_response.json()['response']}")
print(f"Tools used: {chat_response.json()['tool_calls']}")
Next Steps
- Create Your First Agent - Configure an agent
- Available Tools - Learn about built-in and custom tools
- Examples - See how to use agents in applications