Test a Project
Learn how to test your IrisOS agents to ensure they work correctly and consistently.
Overview
Testing is crucial for building reliable AI agents. This guide covers:
Unit testing agent responses
Integration testing with platforms
Testing multi-agent interactions
Performance and load testing
Testing best practices
Testing Strategies
1. Response Testing
Test that your agent responds appropriately to different inputs:
const axios = require('axios');
const assert = require('assert');
const client = axios.create({
baseURL: 'https://api.irisos.xyz/v1',
headers: {
'Authorization': `Bearer ${process.env.IRIS_API_KEY}`,
'Content-Type': 'application/json'
}
});
async function testAgentResponse(agentId, input, expectedKeywords) {
const response = await client.post(
`/agents/${agentId}/messages`,
{
text: input,
userId: 'test_user'
}
);
const output = response.data.data.response.toLowerCase();
// Check if response contains expected keywords
for (const keyword of expectedKeywords) {
assert(
output.includes(keyword.toLowerCase()),
`Response should contain "${keyword}"`
);
}
console.log(`✓ Test passed: ${input}`);
return response.data;
}
// Example test
async function runTests() {
const agentId = 'your_agent_id';
await testAgentResponse(
agentId,
'What is blockchain?',
['distributed', 'ledger', 'technology']
);
await testAgentResponse(
agentId,
'Explain DeFi',
['decentralized', 'finance', 'protocol']
);
console.log('All tests passed!');
}
runTests().catch(console.error);2. Personality Testing
Verify that your agent maintains its personality:
3. Context Memory Testing
Test that agents remember conversation context:
Testing Framework
Create a comprehensive testing framework:
Integration Testing
Testing Platform Integrations
Test Discord integration:
Testing Plugin Functionality
Test that plugins work correctly:
Performance Testing
Response Time Testing
Load Testing
Test agent under load:
Multi-Agent Testing
Test interactions between multiple agents:
Automated Testing with CI/CD
GitHub Actions Example
Create .github/workflows/test-agents.yml:
Test Script (package.json)
Test Data Management
Creating Test Fixtures
Best Practices
Test Early and Often: Integrate testing into your development workflow
Isolate Tests: Each test should be independent and repeatable
Use Realistic Data: Test with data similar to production scenarios
Test Edge Cases: Include unusual inputs and boundary conditions
Monitor Performance: Track response times and resource usage
Automate Testing: Set up CI/CD pipelines for automated testing
Test in Staging: Always test in a staging environment before production
Document Tests: Clear documentation helps maintain tests over time
Debugging Tips
Enable Verbose Logging
Test Individual Components
Next Steps
Deploy a Project - Deploy tested agents to production
Multiple Agents - Test multi-agent systems
API Reference - Complete API documentation
Need Help?
Last updated