Managing Agents
Learn how to manage agents throughout their lifecycle: from creation to optimization to retirement.
Agent Lifecycle
Agents go through distinct stages:
- Draft - Initial creation and testing
- Active - Production use
- Monitoring - Performance tracking
- Optimization - Improvements based on data
- Retirement - Deactivation or replacement
Draft Stage
Creating Draft Agents
Best Practice: Always create agents in Draft state first.
Why:
- Test without affecting production
- Iterate on instructions
- Verify tool assignments
- Refine before going live
Testing Draft Agents
Methods:
- Agent Chat: Manual testing with sample queries
- Agent Run: Execute specific prompts programmatically
- Test Scenarios: Run through common use cases
- Edge Cases: Test error handling and boundaries
Testing Checklist:
- Instructions are clear and followed
- Tools are called correctly
- Responses are accurate
- Error handling works
- Tone is appropriate
- Performance is acceptable
Iterating on Drafts
Process:
- Test with real scenarios
- Review Agent Run logs
- Identify issues
- Refine instructions
- Adjust tools if needed
- Test again
- Repeat until satisfied
When to Promote:
- All tests pass
- Performance meets criteria
- Stakeholders approve
- Documentation complete
Active Stage
Activating Agents
To activate:
- Open agent in Desk
- Change status from Draft to Active
- Save
Before activating:
- Complete testing
- Verify permissions
- Check tool assignments
- Review instructions
- Set up monitoring
Managing Active Agents
Ongoing Tasks:
- Monitor performance metrics
- Review user feedback
- Check error rates
- Track costs
- Optimize based on data
Regular Reviews:
- Weekly: Check error logs
- Monthly: Review costs and performance
- Quarterly: Assess effectiveness and ROI
Safe Editing
Editing Active Agents
Changes take effect immediately:
- New runs use updated configuration
- Ongoing conversations may use old config
- Scheduled triggers pick up changes
- No downtime required
Best Practices
Do:
- Test changes in draft/duplicate first
- Make small, incremental changes
- Document what changed and why
- Monitor after changes
- Have rollback plan
Don’t:
- Make major changes without testing
- Edit production agents during peak hours
- Change multiple things at once
- Forget to update documentation
Version Control Strategy
Option 1: Draft Duplicates
- Create draft copy of production agent
- Make changes in draft
- Test thoroughly
- Replace production when ready
Option 2: Feature Flags
- Use agent settings to toggle features
- Enable/disable without code changes
- A/B test different configurations
Option 3: Gradual Rollout
- Create new version
- Run both versions in parallel
- Compare performance
- Switch when new version proves better
Enabling and Disabling
Disabling Without Deletion
When to disable:
- Temporary issues
- Seasonal agents
- Testing new versions
- Cost optimization
- Maintenance windows
How to disable:
- Open agent
- Uncheck “Is Active” or change status
- Save
Effects:
- Agent stops running
- Triggers don’t fire
- Chat access removed
- Configuration preserved
- Can re-enable anytime
Re-enabling
To re-enable:
- Open agent
- Check “Is Active” or change status to Active
- Save
Before re-enabling:
- Verify configuration is still correct
- Check dependencies (tools, providers)
- Test if needed
- Notify users
Organization
Naming Conventions
Use descriptive names:
- Include purpose: “Customer Support Agent”
- Include scope: “Sales Lead Qualifier”
- Include environment: “Invoice Validator - Production”
Examples:
- Good: “Customer Support Agent - Production”
- Good: “Sales Lead Qualifier - Q1 2024”
- Bad: “Agent 1”
- Bad: “Test”
Categorization
Group related agents:
- By function: Support, Sales, Operations
- By department: Marketing, Finance, HR
- By status: Active, Draft, Archived
- By model: GPT-4, Claude, GPT-3.5
Benefits:
- Easier to find
- Better organization
- Clearer ownership
- Simplified management
Documentation
Document each agent:
- Purpose and scope
- Instructions summary
- Tool assignments
- Trigger configuration
- Success metrics
- Known issues
- Contact person
Where to document:
- Agent description field
- Internal notes
- Separate documentation
- README files
Access Control
Permissions
Frappe permissions apply:
- Users need permission to view agents
- Users need permission to edit agents
- Users need permission to run agents
- Standard role-based access control
Best Practices
Restrict access:
- Only authorized users can edit
- Separate view and edit permissions
- Use roles for access control
- Audit access regularly
Common Roles:
- Agent Admin: Full access to create/edit
- Agent User: Can run agents, view results
- Agent Viewer: Read-only access
Monitoring Performance
Key Metrics
Track regularly:
- Run Count: How many times agent executed
- Success Rate: Percentage of successful runs
- Error Rate: Percentage of failed runs
- Average Response Time: How fast agent responds
- Token Usage: Cost tracking
- User Satisfaction: Feedback scores
Review Process
Weekly Review:
- Check error logs
- Review failed runs
- Identify patterns
- Plan fixes
Monthly Review:
- Analyze performance trends
- Review costs
- Assess effectiveness
- Plan improvements
Quarterly Review:
- Evaluate ROI
- Compare to goals
- Plan major changes
- Consider retirement
Optimization
When to Optimize
Signs you should optimize:
- High error rates
- Slow response times
- High costs
- User complaints
- Low success rates
- Changing requirements
Optimization Strategies
Improve Instructions:
- Add examples
- Clarify boundaries
- Fix ambiguities
- Add context
Adjust Tools:
- Add missing tools
- Remove unused tools
- Improve tool descriptions
- Optimize tool calls
Tune Settings:
- Adjust temperature
- Change model if needed
- Optimize conversation settings
- Reduce token usage
Refine Triggers:
- Add conditions
- Optimize schedules
- Improve prompt templates
- Fix event selection
A/B Testing
Test changes:
- Create duplicate agent
- Make changes to duplicate
- Run both in parallel
- Compare performance
- Adopt winner
What to test:
- Different instructions
- Different models
- Different tools
- Different settings
Retirement
When to Retire
Retire agents when:
- No longer needed
- Replaced by better version
- Requirements changed
- Cost exceeds value
- Technology outdated
Retirement Process
Steps:
-
Notify stakeholders
- Inform users
- Update documentation
- Plan transition
-
Disable agent
- Stop triggers
- Disable chat access
- Keep configuration
-
Archive data
- Export Agent Run logs
- Save configuration
- Document lessons learned
-
Clean up
- Remove from active lists
- Update documentation
- Free up resources
Replacing Agents
When replacing:
- Create new agent
- Test thoroughly
- Run in parallel
- Gradually migrate
- Retire old agent
Best Practices
Lifecycle Management
Do:
- Start with drafts
- Test before production
- Monitor actively
- Optimize regularly
- Document everything
- Plan retirement
Don’t:
- Skip testing
- Ignore performance
- Make changes blindly
- Forget documentation
- Keep unused agents
Change Management
Do:
- Test changes first
- Make incremental changes
- Document changes
- Monitor after changes
- Have rollback plan
Don’t:
- Change without testing
- Make multiple changes at once
- Ignore feedback
- Forget to communicate
Organization
Do:
- Use clear naming
- Categorize agents
- Document purpose
- Track ownership
- Regular cleanup
Don’t:
- Use vague names
- Mix unrelated agents
- Forget documentation
- Ignore organization
Troubleshooting
Agent not working after edit:
- Check for syntax errors in instructions
- Verify tools still exist
- Check provider/model availability
- Review Agent Run logs for errors
Changes not taking effect:
- Clear cache
- Restart bench
- Check agent is saved
- Verify status is Active
Performance degraded:
- Review recent changes
- Check for new errors
- Monitor token usage
- Compare to baseline
What’s Next?
- Running Agents - Execution methods
- Monitoring - Performance tracking
- Creating Agents - Build new agents
- Examples - Reference configurations
Questions? Check GitHub discussions .