Skip to content

feat(agents): add step-level type discriminator (GAP-003)#2275

Merged
kevinmessiaen merged 5 commits intomainfrom
feat/agents-gap003-step-type
Mar 4, 2026
Merged

feat(agents): add step-level type discriminator (GAP-003)#2275
kevinmessiaen merged 5 commits intomainfrom
feat/agents-gap003-step-type

Conversation

@Hartorn
Copy link
Copy Markdown
Member

@Hartorn Hartorn commented Feb 26, 2026

Adds StepType enum (TOOL_RESULT, COMPLETION) and step_type field to WorkflowStep, set automatically in _StepRunner.execute().

Made-with: Cursor

Description

Related Issue

Type of Change

  • 📚 Examples / docs / tutorials / dependencies update
  • 🔧 Bug fix (non-breaking change which fixes an issue)
  • 🥂 Improvement (non-breaking change which improves an existing feature)
  • 🚀 New feature (non-breaking change which adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to change)
  • 🔐 Security fix

Checklist

  • I've read the CODE_OF_CONDUCT.md document.
  • I've read the CONTRIBUTING.md guide.
  • I've written tests for all new methods and classes that I created.
  • I've written the docstring in Google format for all the methods and classes that I used.
  • I've updated the pdm.lock running pdm update-lock (only applicable when pyproject.toml has been
    modified)

Adds StepType enum (TOOL_RESULT, COMPLETION) and step_type field to
WorkflowStep, set automatically in _StepRunner.execute().

Made-with: Cursor
@Hartorn Hartorn self-assigned this Feb 26, 2026
@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @Hartorn, 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 enhances the agent workflow by introducing a type discriminator for individual steps. This change allows for clearer identification of whether a step involved a tool execution or a direct completion, providing better visibility and potential for more granular analysis or control over the agent's execution path. The new StepType enum and its automatic assignment streamline the process of categorizing workflow events.

Highlights

  • New StepType Enum: Introduced a new StepType enum with TOOL_RESULT and COMPLETION values to categorize workflow steps.
  • WorkflowStep Type Discrimination: Added a step_type field to the WorkflowStep model to store the type of each step.
  • Automatic StepType Assignment: Implemented automatic assignment of the step_type field within the _StepRunner.execute() method, setting it to TOOL_RESULT for tool-related steps and COMPLETION for generative completion steps.
  • New Tests: Added comprehensive tests to ensure the correct assignment and functionality of the step_type discriminator across various workflow scenarios.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Changelog
  • libs/giskard-agents/src/giskard/agents/init.py
    • Exported StepType from the workflow module.
    • Added StepType to the __all__ list for public access.
  • libs/giskard-agents/src/giskard/agents/workflow.py
    • Introduced StepType enum with TOOL_RESULT and COMPLETION values.
    • Added step_type field to the WorkflowStep model.
    • Assigned StepType.TOOL_RESULT when creating a WorkflowStep from tool results.
    • Assigned StepType.COMPLETION when creating a WorkflowStep from a completion message.
  • libs/giskard-agents/tests/test_workflow_steps.py
    • Created a new test file for WorkflowStep type discrimination.
    • Added test_steps_have_correct_step_type to verify TOOL_RESULT and COMPLETION types.
    • Included test_step_type_completion_when_no_tools to check completion-only workflows.
    • Added test_step_type_available_via_run to confirm step_type is accessible on the last chat step.
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 by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

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 pull request 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 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. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

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
Copy Markdown
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 step_type discriminator to WorkflowStep, allowing to distinguish between TOOL_RESULT and COMPLETION steps. The implementation is clean and the new field is correctly populated within the _StepRunner. The addition of tests for this new feature is great, ensuring the logic is correct. I've found a minor issue in one of the new tests, where it doesn't seem to be verifying what its name and docstring suggest. My feedback includes a suggestion to address this.

Comment on lines +83 to +96
async def test_step_type_available_via_run():
"""step_type is set on the last step accessible through chat."""
gen = MagicMock(spec=BaseGenerator)
gen.complete = AsyncMock(
return_value=Response(
message=Message(role="assistant", content="World!"),
finish_reason="stop",
)
)

chat = await ChatWorkflow(generator=gen).chat("Hello").run()

assert not chat.failed
assert chat.last.content == "World!"
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.

medium

This test is named test_step_type_available_via_run and its docstring says it tests that step_type is set on the last step. However, the test implementation doesn't assert anything about step_type. The run() method returns a Chat object, which doesn't expose the underlying WorkflowStep where step_type is defined. As it is, this test is a basic smoke test for the run() method and doesn't verify the step_type logic.

Consider one of the following options:

  • Remove this test. The other tests in this file already provide good coverage for the step_type functionality using the steps() interface.
  • Modify the test to use steps() to inspect the final step's type, similar to the other tests in this file.
  • Rename the test and update its docstring to reflect that it's a smoke test for run(), although it might be better placed in a different test file.

@kevinmessiaen kevinmessiaen enabled auto-merge (squash) March 4, 2026 06:32
@kevinmessiaen kevinmessiaen merged commit 9c5d2c9 into main Mar 4, 2026
23 checks passed
@kevinmessiaen kevinmessiaen deleted the feat/agents-gap003-step-type branch March 4, 2026 06:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

3 participants