trinity.common.workflows.agentscope.react.react_workflow module#

An example workflow using AgentScope’s ReAct agent to solve tasks.

This workflow is a demonstration of how to integrate the AgentScope framework within the Trinity-RFT workflow system with minimal modifications.

class trinity.common.workflows.agentscope.react.react_workflow.AgentScopeReActWorkflow(*, task: Task, model: ModelWrapper, auxiliary_models: List[OpenAI] | None = None)[source]#

Bases: Workflow

__init__(*, task: Task, model: ModelWrapper, auxiliary_models: List[OpenAI] | None = None)[source]#
async run_async()[source]#

Run the workflow asynchronously.

async calculate_reward(response) float | Dict[str, float][source]#

Calculate the reward for the workflow.

Returns:

The reward value or a dictionary of reward value.

Return type:

Union[float, Dict[str, float]]

construct_experiences(reward: float | Dict[str, float]) List[Experience][source]#

Construct experiences from the agent’s interaction history.

Parameters:

reward (Union[float, Dict[str, float]]) – The reward value to assign to each experience.

Returns:

A list of Experience objects.

Return type:

List

property asynchronous#

AgentScope’s ReAct agent only supports asynchronous calls, so we set this to True.

property repeatable#

This workflow is not repeatable.