Relax AGENTS.md

Relax AGENTS.md is an instructions file for Codex, OpenCode from redai-infra/Relax. It costs 1,627 tokens per session, scanned A, original, Apache-2.0.

A set of project instructions for Relax, a framework for training and serving large AI models across distributed computers.

In plain words
What is it for?
Use it when modifying Relax components, training code, distributed systems, configuration, examples, or tests.
Why use it?
It gives coding work consistent project structure, naming, formatting, and testing guidance for a complex machine-learning codebase.

Instructions file for CodexOpenCode

Written for Codex and OpenCode: the file is AGENTS.md. Also seen: mentions subagents.

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add instructions/redai-infra/relax/agents-md
Clone the repo
git clone --depth 1 https://github.com/redai-infra/Relax

Made for: Codex, OpenCode.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for Relax AGENTS.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/redai-infra/relax/agents-md.svg)](https://agentmods.dev/instructions/redai-infra/relax/agents-md)
Your own site
<a href="https://agentmods.dev/instructions/redai-infra/relax/agents-md"><img src="https://agentmods.dev/badge/instructions/redai-infra/relax/agents-md.svg" alt="Measured on agentmods" height="20"></a>
Per session 1,627 This file is loaded in full into every session.
When invoked 1,627 The same file — it is already loaded in full.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.01627 $0.01627
Opus 5 $0.00813 $0.00813
Sonnet 5 $0.00325 $0.00325
Haiku 4.5 $0.00163 $0.00163

Measured 6d ago against content hash 38b8d985315a, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-05, from the pricing page.

Security

Grade A, and why

Relax AGENTS.md scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 6d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

AGENTS.md · 119 lines

How it starts

The opening of the file, as written. The whole thing — 119 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Relax

Relax 是一个基于 Ray Serve 的大模型强化学习训练框架,支持 Megatron 训练后端、SGLang 推理引擎、以及 GRPO/PPO/DAPO 等算法族。

Tech stack: Python 3.8+ · PyTorch · Megatron · SGLang · Ray / Ray Serve

Project Structure

relax/                   核心框架
├── core/                编排层 — 训练循环、服务基类、全局注册表
├── components/          组件层 — RL 服务组件(Ray Serve Deployment)
├── engine/              引擎层 — Rollout 数据生成、奖励计算、请求路由
├── backends/            后端层 — Megatron 训练后端、SGLang 推理引擎
├── distributed/         分布式层 — Ray 集群管理、分布式 Checkpoint
├── entrypoints/         入口层 — 训练入口脚本
└── utils/               基础设施 — 工具函数、指标监控、多模态处理
tests/                   测试(镜像 relax/ 层级)
├── backends/megatron/   Megatron 后端测试(权重转换等)
├── distributed/ray/     分布式 / Ray 测试(弹性伸缩等)
├── engine/rewards/      奖励函数测试
├── engine/rollout/      Rollout 引擎测试(预取、数据源等)
└── utils/               工具函数测试(HTTP、指标、流式数据集等)
transfer_queue/          分布式数据传输队列
examples/                用户级示例(deepeyes、OPD 等)
scripts/                 训练启动脚本 & 模型配置
configs/env.yaml         运行时环境配置

修改代码时重点关注:relax/utils/utils.pyrelax/components/relax/core/controller.pyrelax/entrypoints/train.py

Code Standards

  • Ruff 格式化,行宽 119,isort 管理导入(配置见 pyproject.toml
  • relax/ 下所有 .py 须含版权头:# Copyright (c) 2026 Relax Authors. All Rights Reserved.
  • pre-commit 对 transfer_queue/ 排除大部分检查
  • 日志统一用 relax.utils.logging_utils.get_logger(__name__),禁止 print / logging.getLogger
  • 显式类型注解;禁止通配导入(from x import *);重型可选依赖放函数内导入
  • 热路径禁止 GPU-CPU 同步(.item().tolist()print(tensor)
  • 组合优于继承,层级 ≤ 2;偏好委托

Naming Conventions

类型 模式 示例
Service 类 @serve.deployment Actor, Rollout, Critic, GenRM
后端 Actor XxxTrainRayActor MegatronTrainRayActor
Actor 组 RayTrainGroup 管理一组训练 Ray Actor
Manager XxxManager RolloutManager, GenRMManager
Reward 函数 engine/rewards/xxx.py deepscaler.py, math_utils.py
数据源 XxxDataSource RolloutDataSource

Read the full file on GitHub · 119 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 6d ago First seen · 119 lines · 1,627 tokens per session scan A 38b8d985315a

Subscribe to this mod's changes

Relax AGENTS.md is an instructions file published in the GitHub repository redai-infra/Relax (580 stars, last pushed 8d ago), licensed Apache-2.0. It adds 1,627 tokens to every session, about $0.0081 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other instructions, from other repositories

hands-on-modern-rl AGENTS.md

AGENTS.md instructions for walkinglabs/hands-on-modern-rl, covering repository guidelines, project structure, commands, editing rules and tikz → svg workflow.

walkinglabs/hands-on-modern-rl · 1,305 tokens

theartifact-cli CLAUDE.md

Claude Code instructions for beast-bruiser/theartifact-cli, covering claude.md, commands, build, run with local backend and one-shot commands.

beast-bruiser/theartifact-cli · 2,482 tokens

openrouter-mcp-multimodal AGENTS.md

AGENTS.md instructions for stabgan/openrouter-mcp-multimodal, covering agent instructions, before you ship, releasing (read this before publishing), short version and version files (must all match package.json).

stabgan/openrouter-mcp-multimodal · 793 tokens

pi-tinker AGENTS.md

Instructions for gvkhosla/pi-tinker, covering agent guide for pi-tinker, product promise, agent compatibility, best first commands for users and what is possible.

gvkhosla/pi-tinker · 1,100 tokens

pi-tinker copilot-instructions.md

Instructions for gvkhosla/pi-tinker, a project described as: Fine-tune open-source models with Tinker from inside Pi — managed improve loops, data prep, evals, smoke tests, deploy snippets, and checkpoint chat.

gvkhosla/pi-tinker · 215 tokens

AI-System-Design-Consultant CLAUDE.md

Claude Code instructions for deepanshu2711/AI-System-Design-Consultant, covering claude.md, what this is, running it, load-bearing typos — do not "fix" these paths and agent node pattern.

deepanshu2711/AI-System-Design-Consultant · 674 tokens