add-workflow
Guide for adding a new RolloutWorkflow to AReaL. Use when user wants to create a new workflow.
Install
mkdir -p .claude/skills/add-workflow && curl -L -o skill.zip "https://mcp.directory/api/skills/download/3002" && unzip -o skill.zip -d .claude/skills/add-workflow && rm skill.zipInstalls to .claude/skills/add-workflow
About this skill
Add Workflow
Add a new RolloutWorkflow implementation to AReaL.
When to Use
This skill is triggered when:
- User asks "how do I add a workflow?"
- User wants to create a new RolloutWorkflow
- User mentions implementing a custom rollout
Prerequisites
Before starting, ensure you understand:
- The workflow's purpose and requirements
- Input/output data format
- Reward function to use
Step-by-Step Guide
Step 1: Create Workflow File
Create areal/workflow/<name>.py:
import uuid
from typing import Any, Callable
import torch
from areal.api.cli_args import GenerationHyperparameters
from areal.api.engine_api import InferenceEngine
from areal.api.io_struct import ModelRequest, ModelResponse
from areal.api.reward_api import AsyncRewardWrapper
from areal.api.workflow_api import RolloutWorkflow
from areal.utils import logging
logger = logging.getLogger("MyWorkflow")
class MyWorkflow(RolloutWorkflow):
"""Description of your workflow."""
def __init__(
self,
gconfig: GenerationHyperparameters,
tokenizer,
reward_fn: Callable,
):
self.gconfig = gconfig.new_with_stop_and_pad_token_ids(tokenizer)
self.tokenizer = tokenizer
self.async_reward_fn = AsyncRewardWrapper(reward_fn)
async def arun_episode(
self,
engine: InferenceEngine,
data: dict[str, Any],
) -> dict[str, torch.Tensor]:
"""Run a single episode. MUST be async and non-blocking."""
# 1. Prepare input_ids from data
input_ids = self.tokenizer.apply_chat_template(
data["messages"],
tokenize=True,
add_generation_prompt=True,
)
# 2. Build ModelRequest
req = ModelRequest(
rid=uuid.uuid4().hex,
input_ids=list(input_ids),
gconfig=self.gconfig.new(n_samples=1),
tokenizer=self.tokenizer,
)
# 3. Generate completion (async)
resp: ModelResponse = await engine.agenerate(req)
# 4. Compute reward (async)
prompt_str = self.tokenizer.decode(input_ids)
completion_str = self.tokenizer.decode(resp.output_tokens)
reward = await self.async_reward_fn(
prompt_str,
completion_str,
resp.input_tokens,
resp.output_tokens,
**data,
)
# 5. Return results in expected format
return {
"input_ids": torch.tensor(resp.input_tokens),
"output_ids": torch.tensor(resp.output_tokens),
"reward": torch.tensor(reward),
}
Step 2: Register in init.py
Add to areal/workflow/__init__.py:
from areal.workflow.<name> import MyWorkflow
__all__ = [
# ... existing exports
"MyWorkflow",
]
Step 3: Update Entry Script
Update your training script to use the new workflow:
trainer.train(
workflow="areal.workflow.<name>.MyWorkflow",
# ... other args
)
Step 4: Add Tests
Create tests/test_<name>_workflow.py:
import pytest
from areal.workflow.<name> import MyWorkflow
@pytest.mark.asyncio
async def test_workflow_basic():
# Test basic functionality
pass
Reference Implementations
| Workflow | File | Description |
|---|---|---|
| MultiTurnWorkflow | areal/workflow/multi_turn.py | Multi-turn conversation |
| RLVRWorkflow | areal/workflow/rlvr.py | RL with verifiable rewards |
| VisionRLVRWorkflow | areal/workflow/vision_rlvr.py | Vision + RLVR |
Key Requirements
- Async:
arun_episodemust beasync defand non-blocking - No sync I/O: Use
aiofilesfor file operations - Wrap rewards: Use
AsyncRewardWrapperfor reward functions - Tensor format: Output tensors should be
[batch, seq_len, ...] - Use helpers:
concat_padded_tensorsfor combining outputs
Common Mistakes
- ❌ Using
open()instead ofaiofiles.open() - ❌ Forgetting to
awaitasync calls - ❌ Not wrapping reward function with
AsyncRewardWrapper - ❌ Wrong tensor shape conventions
<!-- ================================================================================ MAINTAINER GUIDE ================================================================================ Location: .claude/skills/add-workflow/SKILL.md Invocation: /add-workflow <name> ## Purpose Step-by-step guide for adding new RolloutWorkflow implementations. ## How to Update ### When Workflow API Changes 1. Update the code template in Step 1 2. Update the required imports 3. Update the method signature if changed ### When New Patterns Emerge 1. Add to "Reference Implementations" table 2. Update "Key Requirements" if new requirements added ================================================================================ -->
More by inclusionAI
View all skills by inclusionAI →You might also like
flutter-development
aj-geddes
Build beautiful cross-platform mobile apps with Flutter and Dart. Covers widgets, state management with Provider/BLoC, navigation, API integration, and material design.
drawio-diagrams-enhanced
jgtolentino
Create professional draw.io (diagrams.net) diagrams in XML format (.drawio files) with integrated PMP/PMBOK methodologies, extensive visual asset libraries, and industry-standard professional templates. Use this skill when users ask to create flowcharts, swimlane diagrams, cross-functional flowcharts, org charts, network diagrams, UML diagrams, BPMN, project management diagrams (WBS, Gantt, PERT, RACI), risk matrices, stakeholder maps, or any other visual diagram in draw.io format. This skill includes access to custom shape libraries for icons, clipart, and professional symbols.
ui-ux-pro-max
nextlevelbuilder
"UI/UX design intelligence. 50 styles, 21 palettes, 50 font pairings, 20 charts, 8 stacks (React, Next.js, Vue, Svelte, SwiftUI, React Native, Flutter, Tailwind). Actions: plan, build, create, design, implement, review, fix, improve, optimize, enhance, refactor, check UI/UX code. Projects: website, landing page, dashboard, admin panel, e-commerce, SaaS, portfolio, blog, mobile app, .html, .tsx, .vue, .svelte. Elements: button, modal, navbar, sidebar, card, table, form, chart. Styles: glassmorphism, claymorphism, minimalism, brutalism, neumorphism, bento grid, dark mode, responsive, skeuomorphism, flat design. Topics: color palette, accessibility, animation, layout, typography, font pairing, spacing, hover, shadow, gradient."
godot
bfollington
This skill should be used when working on Godot Engine projects. It provides specialized knowledge of Godot's file formats (.gd, .tscn, .tres), architecture patterns (component-based, signal-driven, resource-based), common pitfalls, validation tools, code templates, and CLI workflows. The `godot` command is available for running the game, validating scripts, importing resources, and exporting builds. Use this skill for tasks involving Godot game development, debugging scene/resource files, implementing game systems, or creating new Godot components.
nano-banana-pro
garg-aayush
Generate and edit images using Google's Nano Banana Pro (Gemini 3 Pro Image) API. Use when the user asks to generate, create, edit, modify, change, alter, or update images. Also use when user references an existing image file and asks to modify it in any way (e.g., "modify this image", "change the background", "replace X with Y"). Supports both text-to-image generation and image-to-image editing with configurable resolution (1K default, 2K, or 4K for high resolution). DO NOT read the image file first - use this skill directly with the --input-image parameter.
fastapi-templates
wshobson
Create production-ready FastAPI projects with async patterns, dependency injection, and comprehensive error handling. Use when building new FastAPI applications or setting up backend API projects.
Related MCP Servers
Browse all serversBoost your AI code assistant with Context7: inject real-time API documentation from OpenAPI specification sources into y
Uno Platform — Documentation and prompts for building cross-platform .NET apps with a single codebase. Get guides, sampl
pg-aiguide — Version-aware PostgreSQL docs and best practices tailored for AI coding assistants. Improve queries, migrat
Create and edit PowerPoint presentations in Python with Office PowerPoint. Use python pptx or pptx python tools to add s
DeepWiki converts deepwiki.com pages into clean Markdown, with fast, secure extraction—perfect as a PDF text, page, or i
Empower your Unity projects with Unity-MCP: AI-driven control, seamless integration, and advanced workflows within the U
Stay ahead of the MCP ecosystem
Get weekly updates on new skills and servers.