Agents
Create and manage AI agents with Truffle AI
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 the deployAgent
method:
Agent Configuration
The deployAgent
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’) |
Using Agents
Running Tasks
Use the run
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:
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.
-
Error Handling: Always implement proper error handling:
Next Steps
Now that you understand how to work with agents, check out our examples to see various use cases and implementation patterns:
View Examples
Explore practical examples and use cases for different types of agents