-
Notifications
You must be signed in to change notification settings - Fork 48
feature(workflows): added a agentic workflow for sudoku #481
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your contribution. The Sudoku has some similarities to frozen lake.
And the current version has significant room for improvement.
A qualified Sudoku workflow should include three parts:
1.A Sudoku generator: Automatically generate solvable Sudoku puzzles and allow you to set the difficulty level.
2. An agentic workflow to solve the Sudoku: Some Sudoku is hard to solve in just one step, so an agentic workflow should be designed to solve the game in multiple steps.
3. A general judge function: Some Sudoku puzzles may have multiple possible solutions, the judge function should correctly parse the model's output and determine the correctness of the result according to the Sudoku rules, not just exactly match.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @pan-x-c ,
Thanks for the detailed feedback earlier.
I’ve implemented all the requested changes:
- Added a SudokuGenerator that produces solvable puzzles (with adjustable difficulty via hole count)
- Reworked the workflow into a multi-step agentic loop, similar in structure to FrozenLakeWorkflow
- Added a SudokuJudge that validates rows, columns, and 3×3 blocks instead of exact string matching
- Integrated generator + judge inside the workflow
- Updated workflow registry
Please have a look and let me know if you’d like further improvements or additional refinements.
| - Removes 'holes' positions to create a puzzle | ||
| """ | ||
|
|
||
| BASE_SOLUTION = [ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Relying on a single standard answer to generate Sudoku puzzles can easily lead to overfitting. Existing works (e.g., python-sudoku-generator-solver) can be referenced for the generation and evaluation parts.
|
|
||
| for step in range(self.max_steps): | ||
| prompt = f""" | ||
| Solve Sudoku by giving moves one at a time. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The prompts are important for agentic workflow. They should precisely describe the game rules and the tasks required to do at each step, as well as the output format. In some cases, even a few-shot example may be necessary. The design of prompts can also draw some inspiration from the Frozen Lake example.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’ve updated the Sudoku workflow by improving the generator to avoid a single canonical solution and refining the prompt to clearly describe the rules, step-wise task, and strict output format, inspired by the Frozen Lake example.
Please let me know if any further refinements are needed.
#470
Solved the issue: Implement a New Workflow
feat: add SudokuWorkflow example implementation and register in default_mapping
Checklist
Added sudoku_workflow.py with full docstrings and inline comments
If need to implement more custom workflows then please let me know