Skip to content

docs: Add code assistant tutorial - #1386

Open
Rajkumar7633 wants to merge 1 commit into
google:mainfrom
Rajkumar7633:feature/code-assistant
Open

Rajkumar7633 wants to merge 1 commit into
google:mainfrom
Rajkumar7633:feature/code-assistant

Conversation

@Rajkumar7633

@Rajkumar7633 Rajkumar7633 commented Jul 31, 2026 •

Copy link
Copy Markdown

Description

This PR adds a new code assistant tutorial to the tutorials/ modules.

New Features

  • Added code-assistant tutorial module with 4 tools (generate, review, explain, debug code)
  • Created CodeAssistant.java with comprehensive code assistance capabilities
  • Added detailed README with setup and usage instructions
  • Updated parent pom.xml to include the new module

Testing

Unit Tests

Added CodeAssistantTest.java with 10 unit tests covering:

  • generateCode functionality (2 tests)
  • reviewCode functionality (2 tests)
  • explainCode functionality (2 tests)
  • debugCode functionality (2 tests)
  • ROOT_AGENT validation (2 tests)

All 10 unit tests pass successfully (./mvnw test -pl tutorials/code-assistant -am).

Manual E2E Tests

  • Tested code assistant tutorial with GOOGLE_API_KEY
  • Verified all 4 tools work correctly via web interface at http://localhost:8080
  • Tested existing tutorials still work after changes

@google-cla

google-cla Bot commented Jul 31, 2026

Copy link
Copy Markdown

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@Rajkumar7633
Rajkumar7633 force-pushed the feature/code-assistant branch from 339221f to c64aa51 Compare July 31, 2026 08:31

@Rajkumar7633 Rajkumar7633 left a comment

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

No existing issue. This PR adds:

  1. New code assistant tutorial feature

  2. Critical code quality improvements (unsafe Optional.get() fixes)
    Problem:

  3. Missing code assistant tutorial for developers

  4. Unsafe Optional.get() calls that could cause NoSuchElementException crashes

  5. Inconsistent error handling in LLM flow processing
    Solution:

  6. Added new code-assistant tutorial with 4 tools (generate, review, explain, debug code)

  7. Replaced unsafe .get() calls with orElseThrow() for better error handling

  8. Added meaningful error messages for debugging

  9. Removed duplicate condition checks
    Testing Plan:

Unit Tests:

  • All 24 modules pass successfully (BUILD SUCCESS)
  • ./mvnw test completed in 2:23 min with no failures

Manual E2E Tests:

  • Tested code assistant tutorial with GOOGLE_API_KEY
  • Verified all 4 tools work correctly via web interface
  • Tested existing tutorials still work after changes

@hemasekhar-p hemasekhar-p self-assigned this Aug 3, 2026
@hemasekhar-p

Copy link
Copy Markdown
Contributor

Hi @Rajkumar7633, thank you for your contribution! We appreciate you taking the time to submit this pull request. To proceed with the review, could you please address the following,

  1. Please provide clear and detailed description of your PR.
  2. Please include corresponding unit tests to verify your changes.
  3. As per our contribution policy, please squash your changes into a single commit.

@hemasekhar-p hemasekhar-p added the waiting on reporter Waiting for reaction by reporter. Failing that, maintainers will eventually closed it as stale. label Aug 3, 2026
@hemasekhar-p hemasekhar-p mentioned this pull request Aug 3, 2026
10 tasks done
@Rajkumar7633
Rajkumar7633 force-pushed the feature/code-assistant branch 3 times, most recently from 46ef6dd to da774e6 Compare August 3, 2026 09:27
@hemasekhar-p

Copy link
Copy Markdown
Contributor

@Rajkumar7633, thank you for addressing the feedback and squashing your commits, Currently this PR is under review by our team, we will keep you posted if any additional information is required. thank you

@hemasekhar-p hemasekhar-p added needs review and removed waiting on reporter Waiting for reaction by reporter. Failing that, maintainers will eventually closed it as stale. labels Aug 3, 2026

@damianmomotgoogle damianmomotgoogle left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Please also keep PR as single commit and update both commit message and PR title to follow conventional commits.

As this looks to be example/tutorial you could use docs: Add code assistant tutorial

.modelName()
.orElseThrow(
() ->
new IllegalStateException(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This looks like behavior change - if needed please contribute it in a separate PR - this one should be limited to code assistant tutorial itself

.outputSchema()
.orElseThrow(
() ->
new IllegalStateException(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Same ask to keep core logic changes to a separate PR

}

int finalConfirmationEventIndex = confirmationResult.get().eventIndex();
ConfirmationResult result =

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Same ask to move core logic changes to a separate PR

@damianmomotgoogle damianmomotgoogle added waiting on reporter Waiting for reaction by reporter. Failing that, maintainers will eventually closed it as stale. and removed needs review labels Oct 22, 2026
@Rajkumar7633
Rajkumar7633 force-pushed the feature/code-assistant branch from 96fe2b4 to 9ec717b Compare November 13, 2026 21:32
@Rajkumar7633 Rajkumar7633 changed the title Add code assistant tutorial feature docs: Add code assistant tutorial Nov 13, 2026
Add a new code-assistant tutorial module with four tools for
generating, reviewing, explaining, and debugging code, along with
a README and unit tests.
@Rajkumar7633
Rajkumar7633 force-pushed the feature/code-assistant branch from 9ec717b to 2f2cf0d Compare November 13, 2026 21:41
@Rajkumar7633

Copy link
Copy Markdown
Author

All feedback addressed: core changes moved to #1809, PR is now limited to the code assistant tutorial, squashed to a single conventional commit (docs: Add code assistant tutorial), and rebased on latest main.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

waiting on reporter Waiting for reaction by reporter. Failing that, maintainers will eventually closed it as stale.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants