ReinforceNowReinforceNow

env.py

Tools allow your model to call external functions during training. Define them in env.py using the @tool decorator.

Usage

from rnow.core.tool import tool

@tool
def search(query: str) -> dict:
    """Search for information."""
    return {"results": ["result1", "result2"]}

Automatic Optimization

ReinforceNow automatically analyzes your code and determines the optimal execution strategy. Just write your function - we handle the rest.

Requirements

docstring: Required, describes what the tool does

type hints: All parameters and return type must be typed

return: Must be JSON-serializable (str, int, float, bool, list, dict)

Supported Types

str, int, float, bool, list, dict

Examples

Calculator

from rnow.core.tool import tool

@tool
def calculator(expression: str) -> float:
    """Evaluate a math expression."""
    return eval(expression)
import requests
from rnow.core.tool import tool

@tool
def web_search(query: str) -> dict:
    """Search the web."""
    resp = requests.get("https://api.example.com/search", params={"q": query})
    return resp.json()

Configuration

Enable multi-turn in config.yml:

rollout:
  max_turns: 5
  termination_policy: last_tool

last_tool: Episode ends when model responds without a tool call

max_turns: Episode ends when max_turns is exhausted