Agents
An agent in Foil represents a distinct AI component or workflow in your application. Use agents to organize traces, configure alerts, and view metrics by logical unit.What is an Agent?
An agent could be:- A customer support chatbot
- A code review assistant
- A document analyzer
- A research agent
- Any distinct AI-powered feature
- Trace history
- Alert configuration
- Analytics dashboard
- Performance metrics
Creating Agents
Agents are created automatically when you specify anagentName:
Agent Configuration
In the Dashboard
Configure agents in the Foil dashboard under Agents:- Name & Description - Identify the agent
- Alert Settings - Enable/disable alert types
- Thresholds - Set custom thresholds for this agent
- Notification Contacts - Who gets alerted
Via API
Agent Metrics
Each agent tracks:| Metric | Description |
|---|---|
| Request count | Total traces processed |
| Success rate | Percentage of successful completions |
| Error rate | Percentage of failed traces |
| Avg latency | Mean response time |
| P95 latency | 95th percentile response time |
| Token usage | Total tokens consumed |
| Cost | Estimated API costs |
Organizing by Agent
Single Application, Multiple Agents
Environment-Based Naming
Version Tracking
Agent Versioning
Foil tracks agent versions automatically:Filtering by Agent
Dashboard
Use the agent dropdown to filter:- Traces
- Alerts
- Analytics
- Signals
API
Multi-Agent Workflows
When agents collaborate, link them via traces:Best Practices
Use descriptive agent names
Use descriptive agent names
Names should clearly identify the agent’s purpose:
customer-supportnotagent1code-review-assistantnotcra
One agent per logical function
One agent per logical function
Don’t mix different functionalities in one agent. Create separate agents for distinct workflows.
Configure alerts per agent
Configure alerts per agent
Different agents may need different alert thresholds. A code review agent might tolerate higher latency than a chatbot.
Track versions in properties
Track versions in properties
Include version information in trace properties to correlate performance with deployments.