Skip to content

Update Workflow Developement Tutorial#310

Merged
chenyushuo merged 8 commits intoagentscope-ai:mainfrom
pan-x-c:feature/enhance_workflow_tutorial
Oct 9, 2025
Merged

Update Workflow Developement Tutorial#310
chenyushuo merged 8 commits intoagentscope-ai:mainfrom
pan-x-c:feature/enhance_workflow_tutorial

Conversation

@pan-x-c
Copy link
Collaborator

@pan-x-c pan-x-c commented Oct 9, 2025

Description

As the title says

Checklist

Please check the following items before code is ready to be reviewed.

  • Code has passed all tests
  • Docstrings have been added/updated in Google Style
  • Documentation has been updated
  • Code is ready for review

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @pan-x-c, 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 substantial update to the workflow development tutorial, aiming to provide a more comprehensive and user-friendly guide. It clarifies fundamental concepts, introduces visual aids like Mermaid flowcharts, and expands on advanced features crucial for building efficient and flexible workflows. The changes cover performance optimizations, asynchronous operations, and seamless integration with external APIs like OpenAI, ensuring developers have the necessary tools and knowledge to leverage the framework effectively.

Highlights

  • Mermaid Diagram Support: Enabled the use of Mermaid diagrams in the Sphinx documentation by adding sphinxcontrib.mermaid to the configuration and dependencies, allowing for visual flowcharts within the tutorials.
  • Enhanced Workflow Development Tutorial: Significantly updated the develop_workflow.md tutorial with a new Mermaid flowchart, clearer definitions for Task, Workflow, and Experience, and the introduction of the Model concept. It also renames AgentScopeReactMathWorkflow to AgentScopeReActWorkflow for consistency.
  • Refined Example Workflow Logic: Modified the example run method in the tutorial to generate a single response by default, simplifying the experience creation process and making the example more straightforward for basic use cases.
  • New Performance Optimization Guidance: Introduced a new section on 'Performance Optimization' in the tutorial, detailing how to avoid re-initialization with resettable and reset methods, and how to support batch inference using repeatable and set_repeat_times for efficiency.
  • Advanced Workflow Features: Added an 'Advanced Features' section covering asynchronous workflow support via asynchronous and run_async methods, and detailed integration with the OpenAI API, including configuration and code examples for extracting experiences from API history.
  • Default Repeatability Change: The base Workflow class's repeatable property now defaults to False, requiring explicit opt-in for workflows that support batch inference, promoting clearer design choices.
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
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 significantly improves the workflow development tutorial by adding a conceptual diagram, introducing advanced features like batch inference and async support, and providing examples for using the OpenAI API. The documentation is now more structured and easier to follow.

I've left a few comments on the documentation to fix some inconsistencies and missing definitions in the code examples. I also found a potential issue in the base Workflow class change that might unintentionally affect SimpleWorkflow and its subclasses.

Additionally, there's a small typo in the pull request title: "Developement" should be "Development".

@pan-x-c
Copy link
Collaborator Author

pan-x-c commented Oct 9, 2025

/unittest-all

@pan-x-c pan-x-c requested a review from Copilot October 9, 2025 07:53
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR updates the workflow development tutorial documentation and related code to improve clarity and add new features. The changes focus on enhancing documentation with visual diagrams, expanding content coverage, and ensuring workflow implementations include proper repeatability support.

  • Added mermaid diagram support to visualize the relationship between Task, Model, Workflow, and Experience
  • Enhanced tutorial content with more detailed explanations and performance optimization sections
  • Implemented repeatable property across multiple workflow classes to support batch inference optimization

Reviewed Changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
trinity/common/workflows/workflow.py Modified base workflow class to change default repeatable behavior and added repeatable property to subclasses
trinity/common/workflows/envs/alfworld/RAFT_alfworld_workflow.py Added repeatable property implementation
tests/utils/plugins/my_workflow.py Added repeatable property to test workflow
pyproject.toml Added sphinxcontrib-mermaid dependency for documentation
docs/sphinx_doc/source_zh/tutorial/develop_workflow.md Comprehensive update to Chinese tutorial with improved structure and new content
docs/sphinx_doc/source_zh/conf.py Added mermaid extension configuration
docs/sphinx_doc/source/tutorial/develop_workflow.md Comprehensive update to English tutorial with improved structure and new content
docs/sphinx_doc/source/conf.py Added mermaid extension configuration

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@pan-x-c
Copy link
Collaborator Author

pan-x-c commented Oct 9, 2025

/unittest-module-common

@github-actions
Copy link

github-actions bot commented Oct 9, 2025

Summary

Tests 📝 Passed ✅ Failed ❌ Skipped ⏭️ Other ❓ Flaky 🍂 Duration ⏱️
30 30 0 0 0 0 319ms

Tests

Test Name Status Flaky Duration
tests/common/config_test.py::TestConfig::test_all_examples_are_valid 34ms
tests/common/config_test.py::TestConfig::test_config_flatten 1ms
tests/common/config_test.py::TestConfig::test_continue_from_checkpoint_is_valid 1ms
tests/common/config_test.py::TestConfig::test_load_default_config 4ms
tests/common/experience_test.py::TestEID::test_eid_properties 1ms
tests/common/experience_test.py::TestExperience::test_action_mask_and_logprobs_type 1ms
tests/common/experience_test.py::TestExperience::test_assertions 1ms
tests/common/experience_test.py::TestExperience::test_dpo_experience 1ms
tests/common/experience_test.py::TestExperience::test_gather 1ms
tests/common/experience_test.py::TestExperience::test_hf_datasets_conversion 1ms
tests/common/experience_test.py::TestExperience::test_multi_turn_experience 1ms
tests/common/experience_test.py::TestExperience::test_serialize_deserialize 1ms
tests/common/experience_test.py::TestExperience::test_single_turn_experience 1ms
tests/common/experience_test.py::TestExperience::test_to_dict 1ms
tests/common/experience_test.py::TestExperienceConversion::test_batch_conversion 1ms
tests/common/experience_test.py::TestExperienceConversion::test_dpo_experience_batch_conversion 1ms
tests/common/experience_test.py::TestExperienceConversion::test_experience_model_experience_conversion 1ms
tests/common/experience_test.py::TestExperienceConversion::test_gather_experiences_with_custom_fields 1ms
tests/common/experience_test.py::TestExperienceConversion::test_multiturn_experience_batch_converstion 1ms
tests/common/vllm_test.py::ModelWrapperTest_0::test_generate 59ms
tests/common/vllm_test.py::ModelWrapperTest_1::test_generate 35ms
tests/common/vllm_test.py::ModelWrapperTest_2::test_generate 48ms
tests/common/vllm_test.py::TestModelLen_0::test_model_len 20ms
tests/common/vllm_test.py::TestModelLen_1::test_model_len 20ms
tests/common/vllm_test.py::TestAPIServer::test_api 24ms
tests/common/vllm_test.py::TestAsyncAPIServer::test_api_async 24ms
tests/common/vllm_test.py::TestTokenizer::test_action_mask 1ms
tests/common/vllm_test.py::TestTokenizer::test_action_mask_with_tools 1ms
tests/common/vllm_test.py::TestAPIServerToolCall_0_deepseek_r1::test_api_tool_calls 22ms
tests/common/vllm_test.py::TestAPIServerToolCall_1::test_api_tool_calls 20ms

Github Test Reporter by CTRF 💚

@pan-x-c
Copy link
Collaborator Author

pan-x-c commented Oct 9, 2025

/unittest-module-trainer

@github-actions
Copy link

github-actions bot commented Oct 9, 2025

Summary

Tests 📝 Passed ✅ Failed ❌ Skipped ⏭️ Other ❓ Flaky 🍂 Duration ⏱️
20 17 1 2 0 0 2.0s

Failed Tests

Failed Tests ❌ Fail Message
❌ tests/trainer/trainer_test.py::TestTrainerLoRA::test_trainer The test failed in the call phase due to an assertion error

Skipped

Tests Status
tests/trainer/trainer_test.py::TestMultiModalGRPO::test_trainer skipped ⏭️
tests/trainer/trainer_test.py::TestMultiModalSFT::test_trainer skipped ⏭️

Tests

Test Name Status Flaky Duration
tests/trainer/trainer_test.py::TestTrainerCountdown_0_fsdp::test_trainer 142ms
tests/trainer/trainer_test.py::TestTrainerCountdown_1_megatron::test_trainer 316ms
tests/trainer/trainer_test.py::TestStepAheadAsyncRL::test_trainer 55ms
tests/trainer/trainer_test.py::TestTrainerGSM8K_0_fsdp::test_trainer 55ms
tests/trainer/trainer_test.py::TestTrainerGSM8K_1_fsdp2::test_trainer 52ms
tests/trainer/trainer_test.py::TestTrainerGSM8K_2_fsdp::test_trainer 59ms
tests/trainer/trainer_test.py::TestTrainerGSM8K_3_fsdp2::test_trainer 62ms
tests/trainer/trainer_test.py::TestTrainerSFTWarmupGSM8K::test_trainer 104ms
tests/trainer/trainer_test.py::TestTrainerDPO::test_trainer 40ms
tests/trainer/trainer_test.py::TestTrainerSFT::test_trainer 36ms
tests/trainer/trainer_test.py::TestTrainerToolsSFT::test_trainer_tools 37ms
tests/trainer/trainer_test.py::TestFullyAsyncMode_0_fsdp::test_fully_async_mode 85ms
tests/trainer/trainer_test.py::TestFullyAsyncMode_1_fsdp::test_fully_async_mode 87ms
tests/trainer/trainer_test.py::TestFullyAsyncMode_2_megatron::test_fully_async_mode 177ms
tests/trainer/trainer_test.py::TestTrainerCheckpointSave_0_fsdp::test_trainer 99ms
tests/trainer/trainer_test.py::TestTrainerCheckpointSave_1_megatron::test_trainer 356ms
tests/trainer/trainer_test.py::TestTrainerMIX::test_trainer 54ms
tests/trainer/trainer_test.py::TestMultiModalGRPO::test_trainer ⏭️ 1ms
tests/trainer/trainer_test.py::TestMultiModalSFT::test_trainer ⏭️ 1ms
tests/trainer/trainer_test.py::TestTrainerLoRA::test_trainer 136ms

Github Test Reporter by CTRF 💚

@pan-x-c
Copy link
Collaborator Author

pan-x-c commented Oct 9, 2025

/unittest-module-trainer

@github-actions
Copy link

github-actions bot commented Oct 9, 2025

Summary

Tests 📝 Passed ✅ Failed ❌ Skipped ⏭️ Other ❓ Flaky 🍂 Duration ⏱️
20 18 0 2 0 0 2.0s

Skipped

Tests Status
tests/trainer/trainer_test.py::TestMultiModalGRPO::test_trainer skipped ⏭️
tests/trainer/trainer_test.py::TestMultiModalSFT::test_trainer skipped ⏭️

Tests

Test Name Status Flaky Duration
tests/trainer/trainer_test.py::TestTrainerCountdown_0_fsdp::test_trainer 141ms
tests/trainer/trainer_test.py::TestTrainerCountdown_1_megatron::test_trainer 315ms
tests/trainer/trainer_test.py::TestStepAheadAsyncRL::test_trainer 70ms
tests/trainer/trainer_test.py::TestTrainerGSM8K_0_fsdp::test_trainer 52ms
tests/trainer/trainer_test.py::TestTrainerGSM8K_1_fsdp2::test_trainer 52ms
tests/trainer/trainer_test.py::TestTrainerGSM8K_2_fsdp::test_trainer 56ms
tests/trainer/trainer_test.py::TestTrainerGSM8K_3_fsdp2::test_trainer 59ms
tests/trainer/trainer_test.py::TestTrainerSFTWarmupGSM8K::test_trainer 103ms
tests/trainer/trainer_test.py::TestTrainerDPO::test_trainer 40ms
tests/trainer/trainer_test.py::TestTrainerSFT::test_trainer 36ms
tests/trainer/trainer_test.py::TestTrainerToolsSFT::test_trainer_tools 36ms
tests/trainer/trainer_test.py::TestFullyAsyncMode_0_fsdp::test_fully_async_mode 87ms
tests/trainer/trainer_test.py::TestFullyAsyncMode_1_fsdp::test_fully_async_mode 82ms
tests/trainer/trainer_test.py::TestFullyAsyncMode_2_megatron::test_fully_async_mode 173ms
tests/trainer/trainer_test.py::TestTrainerCheckpointSave_0_fsdp::test_trainer 101ms
tests/trainer/trainer_test.py::TestTrainerCheckpointSave_1_megatron::test_trainer 349ms
tests/trainer/trainer_test.py::TestTrainerMIX::test_trainer 54ms
tests/trainer/trainer_test.py::TestMultiModalGRPO::test_trainer ⏭️ 1ms
tests/trainer/trainer_test.py::TestMultiModalSFT::test_trainer ⏭️ 1ms
tests/trainer/trainer_test.py::TestTrainerLoRA::test_trainer 154ms

Github Test Reporter by CTRF 💚

@chenyushuo chenyushuo merged commit 0adb26e into agentscope-ai:main Oct 9, 2025
2 checks passed
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.

2 participants

Comments