Workflows orchestrate the interaction between an agent, an environment, and a rollout engine to execute multi-step tasks.Documentation Index
Fetch the complete documentation index at: https://docs.rllm-project.com/llms.txt
Use this file to discover all available pages before exploring further.
Workflows are the older of the two agent-authoring paths in rLLM. New
agents should be authored as AgentFlows — see the
Cookbooks tutorial and
cookbooks/. Workflows
remain supported for the use cases where you want explicit BaseAgent +
BaseEnv separation; the seven cookbooks ship as examples of the
AgentFlow alternative.Workflow
Abstract base class for all workflows.Constructor
The rollout engine for model inference.
Thread pool executor for async operations.
Timeout for workflow execution in seconds.
Discount factor for reward computation. When > 0, computes Monte Carlo returns.
Coefficient for reward shaping based on reward deltas.
Methods
run
Execute the workflow on a single task. Must be implemented by subclasses.The task to execute.
Unique identifier for the task.
The generated episode.
run_with_termination_handling
Wrapper aroundrun() that handles termination events, errors, and timeouts.
commit
Commit a trajectory for training.Name for the trajectory.
Agent whose trajectory to commit.
Trajectory to commit directly (alternative to agent).
Whether to reset the agent after committing.
collect_trajectories
Collect all trajectories from committed and agent instances.Episode containing all trajectories.
reset
Reset the workflow for a new task.The task to reset to.
Unique identifier for the task.
postprocess_episode
Post-process episode after completion (compute rewards, metrics, etc.).SimpleWorkflow
Simplified workflow for single-agent, single-turn tasks.Constructor
Engine for model inference.
Function to compute rewards from task and action.
Methods
run
Execute the workflow:- Extracts messages from task (supports
question,prompt,problem, ormessageskeys) - Gets model response
- Computes reward
- Creates trajectory with step
- Returns episode
MultiTurnWorkflow
Workflow for multi-step agent-environment interactions.Constructor
Agent class (a
BaseAgent subclass) or string identifier registered in env_agent_mappings.Environment class or string identifier.
Arguments to pass to agent constructor.
Arguments to pass to environment constructor.
Maximum number of steps before termination.
Methods
run
Execute the multi-step workflow:- Resets environment with task
- Updates agent with initial observation
- For each step:
- Gets model response
- Updates agent with response
- Steps environment with action
- Updates agent with new observation and reward
- Terminates on
done=Trueor max steps reached

