Prerequisites:
- A working FrontMCP project with tools (see Your First Tool)
- An API key for an LLM provider (OpenAI, Anthropic, etc.)
What You’ll Build
A weather summary agent that:- Accepts a location from the user
- Uses a weather tool to fetch current conditions
- Returns a human-friendly summary generated by an LLM
Understanding Agents
Agents in FrontMCP are different from tools:| Aspect | Tool | Agent |
|---|---|---|
| Execution | Deterministic code | LLM-driven reasoning |
| Tool Access | N/A | Can call other tools |
| Response | Direct result | Generated content |
| Use Case | Data fetching, CRUD | Summarization, planning, multi-step tasks |
Step 1: Create a Tool for the Agent
First, create a tool that the agent can use:Step 2: Create the Agent
Step 3: Register the Agent
Add the agent to your app:Agent Configuration Options
LLM Provider Configuration
Tool Visibility
Control how the agent appears to clients:System Instructions
Guide the agent’s behavior:How Agents Work
LLM processes request
The agent sends the input to the configured LLM along with:
- System instructions
- Available tools (as function definitions)
- User input
Tool calls (if needed)
If the LLM decides to use a tool, the agent:
- Executes the tool with provided arguments
- Returns the result to the LLM
- LLM continues reasoning
Example: Multi-Tool Agent
Create an agent that uses multiple tools:Example: Planning Agent
Create an agent that breaks down complex tasks:Using Agents as Tools
Agents can be used by other agents, creating hierarchical workflows:Testing Agents
Best Practices
Write clear system instructions
Write clear system instructions
Good instructions lead to better agent behavior:
Limit available tools
Limit available tools
Only give agents tools they need:
Define clear schemas
Define clear schemas
Help LLMs produce structured output:
Handle errors gracefully
Handle errors gracefully
Include error handling in system instructions:
Monitor agent costs
Monitor agent costs
Track LLM API usage:
Next Steps
Agent Reference
Full @Agent decorator documentation
CodeCall Plugin
Advanced agent orchestration
Tool UI
Rich displays for agent outputs
Testing
Test agents and their tool usage