Add: beginner-friendly file analyzer example#380
Open
itsroshanharry wants to merge 4 commits into
Open
Conversation
- New example demonstrating core HUD SDK concepts - Shows environment creation with custom tools - Demonstrates scenario-based evaluation - Includes clear documentation and usage examples - Fills gap between basic (00) and advanced (01/02) examples - Perfect starting point for new users learning the SDK
- Fix average word length calculation to exclude whitespace - Change 'Steps taken' to 'Tool calls' for accuracy - Add comment explaining the calculation
- Add directory traversal protection to list_files and read_file tools - Validate all file paths are within working directory before access - Fix tool calls metric to count actual MCP calls from trace - Prevent negative count when agent errors early Addresses Bugbot security and accuracy concerns
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
- Add guard to prevent AttributeError when agent returns no content - Handle edge case where response is None before calling .lower() Addresses Bugbot review comment
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Description
Add a beginner-friendly file analyzer example to help new users understand HUD SDK core concepts.
Problem
Currently, the examples jump from very basic (00_agent_env.py - just one tool call) to advanced production-ready agents (01_codex, 02_opencode). There's no intermediate example for beginners learning the SDK.
Solution
This example fills that gap by demonstrating:
@env.tool())@env.scenario())Why This Is Valuable
Example Output
Testing
gpt-4o-mini(default)gpt-4oruff formatruff checkChecklist
Additional Context
This is my first contribution to the HUD SDK. I created this example while learning the framework and thought it would help other beginners understand the core concepts. The example is self-contained and doesn't modify any existing code.
I'm excited to contribute to the project and help make it more accessible to new users!
Note
Low Risk
Adds a new standalone example script and documentation without modifying library/runtime code; risk is limited to example usability (e.g., path handling and tool output).
Overview
Adds a new beginner example
examples/05_file_analyzer_agent.pythat defines simple file tools (list_files,read_file,count_words), ananalyze-readmescenario with basic reward scoring, and a CLI to run the agent against different models.Updates
examples/README.mdto document how to run the new example (including--modeland--verbose) and position it as an intermediate learning step.Written by Cursor Bugbot for commit c8923aa. This will update automatically on new commits. Configure here.