Skip to content

feat: implement evaluation framework for praisonaiagents #976

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

MervinPraison
Copy link
Owner

Implements comprehensive evaluation framework as requested in issue #967

  • Added AccuracyEval, ReliabilityEval, PerformanceEval, EvalSuite classes
  • Supports simple similarity and LLM-based multi-criteria evaluation
  • Includes statistical reliability with confidence intervals
  • Provides tool usage validation and performance benchmarking
  • Features automated test suites with CI/CD integration
  • Maintains full backward compatibility with lazy loading
  • All tests passing (6/6)

Closes #967

Generated with Claude Code

- Add comprehensive evaluation framework with minimal client-side code
- Implement AccuracyEval with simple similarity and LLM-based scoring
- Implement ReliabilityEval for tool usage validation
- Implement PerformanceEval for runtime, memory, and token benchmarking
- Add EvalSuite for automated test suites with CI/CD integration
- Include EvalCriteria for multi-dimensional evaluation scoring
- Support statistical reliability with multiple iterations and confidence intervals
- Add result export capabilities (JSON, HTML, Markdown)
- Integrate with existing Agent, Task, and PraisonAIAgents classes
- Ensure backward compatibility with lazy loading
- Include comprehensive test suite and usage examples

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-authored-by: Mervin Praison <MervinPraison@users.noreply.github.com>
Copy link
Contributor

coderabbitai bot commented Jul 17, 2025

Warning

Rate limit exceeded

@MervinPraison has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 3 minutes and 34 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 39fbb76 and 3fa2a13.

📒 Files selected for processing (10)
  • src/praisonai-agents/example_eval_usage.py (1 hunks)
  • src/praisonai-agents/praisonaiagents/__init__.py (2 hunks)
  • src/praisonai-agents/praisonaiagents/eval/__init__.py (1 hunks)
  • src/praisonai-agents/praisonaiagents/eval/accuracy_eval.py (1 hunks)
  • src/praisonai-agents/praisonaiagents/eval/eval_criteria.py (1 hunks)
  • src/praisonai-agents/praisonaiagents/eval/eval_result.py (1 hunks)
  • src/praisonai-agents/praisonaiagents/eval/eval_suite.py (1 hunks)
  • src/praisonai-agents/praisonaiagents/eval/performance_eval.py (1 hunks)
  • src/praisonai-agents/praisonaiagents/eval/reliability_eval.py (1 hunks)
  • src/praisonai-agents/test_eval_framework.py (1 hunks)
✨ Finishing Touches
  • 📝 Generate Docstrings

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary of Changes

Hello @MervinPraison, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request delivers a robust and extensible evaluation framework for PraisonAI agents, addressing the need for systematic quality assessment. It provides developers with tools to measure and improve agent performance, reliability, and accuracy through configurable tests, statistical analysis, and automation features, ultimately enhancing the overall quality assurance pipeline for agent development.

Highlights

  • New Evaluation Framework: Introduced a comprehensive evaluation framework for PraisonAI agents, including core classes like AccuracyEval, ReliabilityEval, PerformanceEval, EvalSuite, TestCase, and EvalCriteria.
  • Multi-faceted Evaluation Capabilities: The framework supports diverse evaluation types: accuracy (via simple similarity or LLM-based multi-criteria scoring), reliability (tool usage validation, including order and additional tool tolerance), and performance (benchmarking runtime, memory, token usage, and time to first token).
  • Automation and Reporting: Features include statistical reliability with confidence intervals, automated test suites with scheduling and alerts, and flexible result export options (JSON, HTML, Markdown) for continuous integration and quality assurance.
  • Backward Compatibility: The new evaluation components are integrated using lazy loading to ensure full backward compatibility with existing PraisonAI agent implementations.
  • Example and Test Coverage: A new example file (example_eval_usage.py) demonstrates the framework's capabilities, and a dedicated test script (test_eval_framework.py) validates its core components.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist is currently in preview and may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a comprehensive evaluation framework for PraisonAI agents, including modules for accuracy, reliability, and performance testing. The implementation is well-structured with clear separation of concerns. I've identified a few areas for improvement, including a high-severity performance issue in report generation, a medium severity bug in result saving, and opportunities to make evaluation thresholds more configurable for better flexibility. Overall, this is a great addition to the library.

Comment on lines +359 to +360
# Run the evaluation
result = self.run()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

high

The generate_report method currently calls self.run() internally. This is highly inefficient, as it will re-run the entire evaluation suite every time a report is generated, which can be very time-consuming and expensive.

The report generation should be decoupled from the test execution. A better approach is to have run() return the results, and then pass those results to generate_report().

I suggest changing the signature of generate_report to accept an EvalSuiteResult object.

    def generate_report(
        self,
        result: EvalSuiteResult,
        format: str = "json",
        include_graphs: bool = False,
        compare_with: Optional[str] = None
    ) -> str:
        """
        Generate a comprehensive evaluation report.
        
        Args:
            result: The result object from an EvalSuite run.
            format: Report format ("json", "html", "markdown")
            include_graphs: Whether to include performance graphs
            compare_with: Compare with previous results (e.g., "last_week")
            
        Returns:
            Report content or file path
        """
        try:
            # No longer runs the evaluation, uses the passed-in result object

Comment on lines +280 to +281
if hasattr(self, 'verbose') and self.verbose:
print(f"Results saved to {self.save_results}")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The condition hasattr(self, 'verbose') and self.verbose will always evaluate to false because verbose is a parameter of the run method and is not set as an attribute on the class instance. This means the confirmation message for saving results is never printed, which can be confusing for users.

A better approach would be to use the logging module to inform the user that the file has been saved. This is more idiomatic for a library and allows the user to control visibility via their logging configuration.

            logger.info(f"Results saved to {self.save_results}")


return {
'type': 'accuracy',
'passed': result.success and result.score >= 7.0, # Default threshold
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The passing threshold for accuracy tests is hardcoded to 7.0. This reduces the flexibility of the evaluation suite, as different tests might require different passing criteria.

Consider making this threshold configurable by adding a property to the TestCase dataclass, for example min_accuracy_score: Optional[float] = 7.0. This would allow users to define custom thresholds for each test case.

Suggested change
'passed': result.success and result.score >= 7.0, # Default threshold
'passed': result.success and result.score >= (test_case.min_score if hasattr(test_case, 'min_score') else 7.0), # Default threshold

)
result = evaluator.run()

passed = result.success and result.success_rate >= 80.0 # Default threshold
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Similar to the accuracy test, the success rate threshold for reliability tests is hardcoded to 80.0. This should be configurable to accommodate different reliability requirements.

I recommend adding a min_success_rate field to the TestCase dataclass to allow users to set this value on a per-test basis.

Suggested change
passed = result.success and result.success_rate >= 80.0 # Default threshold
passed = result.success and result.success_rate >= (test_case.min_success_rate if hasattr(test_case, 'min_success_rate') else 80.0) # Default threshold

Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: Verbose Mode Not Functional

The _save_results method attempts to use self.verbose to control a print statement, but the verbose parameter is only passed to the run() method and never stored as an instance attribute. This causes the hasattr(self, 'verbose') check to always be False, preventing the "Results saved to..." message from being printed even when verbose mode is intended. The verbose parameter should be stored as an instance attribute or passed directly to _save_results.

src/praisonai-agents/praisonaiagents/eval/accuracy_eval.py#L279-L281

json.dump(results, f, indent=2)
if hasattr(self, 'verbose') and self.verbose:
print(f"Results saved to {self.save_results}")

Fix in CursorFix in Web


BugBot free trial expires on July 22, 2025
Learn more in the Cursor dashboard.

Was this report helpful? Give feedback by reacting with 👍 or 👎

@MervinPraison
Copy link
Owner Author

@claude review this pull request and do a detailed analysis and fix this if the existing code doesn't have the solution implemented. Making sure it has backward compatibility, no existing features removed. After making those changes, again review the applied changes. Use @web to search if you dont know any information or to find the latest documentation or to find the latest version. Run the code if you think you need to run it to test it. Minimal code change to start with if required any changes.

Copy link
Contributor

github-actions bot commented Jul 17, 2025

Claude encountered an error —— View job


I'll analyze this and get back to you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

create eval framework for praisonaiagents, mini...
1 participant