Working with Agents
Agents are the core building blocks in Truffle AI. Each agent is an AI assistant that can be customized for specific tasks or conversations.Creating Agents
Create a new agent using thedeployAgent
method:
Agent Configuration
ThedeployAgent
method accepts the following parameters:
Parameter | Required | Type | Description |
---|---|---|---|
name | Yes | string | A name for your agent |
instruction | Yes | string | Instructions that define the agent’s behavior |
model | Yes | string | The AI model to use (e.g., ‘gpt-4o-mini’) |
tool | No | string | The tool to use (e.g., ‘Google Sheets’) |
documentId | No | string | ID of an uploaded document for RAG functionality |
Using Agents
Running Tasks
Use therun
method to execute one-off tasks:
Chat Sessions
For interactive conversations, use the chat interface:Managing Agents
Loading Existing Agents
Load a previously created agent using its ID:Updating Agents
Update an agent’s configuration:Enhancing Agents with RAG
You can enhance your agents with Retrieval Augmented Generation (RAG) to provide them with knowledge from your own documents:Deleting Agents
Remove an agent when it’s no longer needed:Best Practices
- Clear Instructions: Provide detailed instructions to shape your agent’s behavior and responses.
- Context Management: For chat applications, use a single chat session for related conversations to maintain context.
- Knowledge Enhancement: Use RAG to provide agents with specific knowledge from your documents when they need domain-specific information.
- Error Handling: Always implement proper error handling: