Documentation Index
Fetch the complete documentation index at: https://mintlify.com/QwenLM/Qwen-Agent/llms.txt
Use this file to discover all available pages before exploring further.
Overview
TheFnCallAgent is a widely applicable function calling agent that integrates LLM capabilities with tool usage. It’s the foundation for other agents like Assistant and ReActChat, providing core function calling and tool execution functionality.
Key Features
Native Function Calling
Built-in support for OpenAI-compatible function calling
Parallel Execution
Execute multiple tools simultaneously for efficiency
Memory Management
Automatic file and conversation context management
Iterative Tool Use
Multi-step reasoning with repeated tool calls
Constructor
Parameters
List of tools to enable. Can be:
- Tool names:
'code_interpreter' - Tool configs:
{'name': 'code_interpreter', 'timeout': 30} - Tool objects:
CodeInterpreter()
LLM configuration with
model, model_type, and optionally api_key, model_server, generate_cfg.System message defining the agent’s role and behavior.
Agent identifier for multi-agent scenarios.
Agent description used for routing in multi-agent systems.
Initial files to load into the agent’s memory for context.
Basic Usage
Function Calling Example
Parallel Function Calling
The agent automatically handles parallel tool execution when appropriate:Multi-turn Conversations
With File Context
Advanced: Custom Tool with State
Best Practices
Tool Selection
Tool Selection
- Only include tools relevant to your use case
- Provide clear, specific tool descriptions
- Use descriptive parameter names and types
- Test tools individually before combining them
Error Handling
Error Handling
- Tools should return error messages in JSON format
- Handle timeouts gracefully with appropriate timeout values
- Log tool execution for debugging
- Validate tool parameters before execution
Performance
Performance
- Leverage parallel execution for independent operations
- Set appropriate
MAX_LLM_CALL_PER_RUNlimit (default: 10) - Use streaming for better user experience
- Cache expensive tool results when possible
Comparison with Other Agents
| Feature | FnCallAgent | Assistant | ReActChat |
|---|---|---|---|
| Function Calling | ✅ | ✅ | ✅ |
| RAG Support | ❌ | ✅ | ❌ |
| Format | OpenAI | OpenAI | ReAct Text |
| Parallel Tools | ✅ | ✅ | ❌ |
| Best For | Tool usage | RAG + Tools | Reasoning traces |
Related Resources
Function Calling
Learn about function calling concepts
Custom Tools
Create custom tools for your agent
Assistant Agent
Use Assistant for RAG + function calling
API Reference
Complete API documentation