TaskAppConfig, and a small FastAPI entrypoint or registry call. The sections below walk through the expected order so you always know where each piece goes.
Anatomy of a task-app file
- Imports & constants: Define dataset specs, reward constants, and helper functions you’ll reuse.
- Dataset registry: Build a
TaskDatasetRegistry, register splits, and expose helpers such asbuild_dataset()so everything is cached. - Task description helpers: Provide
_base_task_info()plus anydescribe_taskset/provide_task_instanceshelpers. - Rollout executor: Implement
async def rollout_executor(...)that runs your environment and returns aRolloutResponse. - TaskAppConfig builder: Create
build_config()that stitches dataset, TaskInfo helpers, rollout executor, tracing hooks, and proxies together. - Registration & entrypoints: Call
register_task_app(...)for discovery and optionally expose afastapi_app()/create_app()function orrun_task_app(...)block for local serving.
Build the TaskAppConfig
This section shows thebuild_config() function you add near the end of your file. It pulls together the dataset, task metadata, rollout executor, tracing hooks, SFT output path, proxy settings, and routers—everything the FastAPI harness needs to serve your task. Copy the structure, then replace the dataset/loaders/rubrics with your own.
build_dataset()warms the dataset and registers it once, so both RL and SFT share the same loader cache.app_stateis how you pass handles (dataset managers, tracer factories, SFT destinations) to routers and rollout code.register_task_appmakes the config discoverable by the CLI and deployment tooling.
Routes and FastAPI entrypoints
create_task_app turns your TaskAppConfig into an actual FastAPI app and auto-mounts /, /health, /info, /task_info, /rollout, /done, /debug/env, and any proxy routes. Most teams expose that ASGI app through a thin wrapper so local dev, demos, and deployments all hit the same routes.
-
/confirms the service is alive and names the task: -
/healthenforces the environment API key and returns the expected prefix plus auth metadata: -
/infosurfaces dataset, rubric, inference, and limit metadata pulled from yourTaskAppConfig.base_task_info. -
/task_inforeturns either the taskset descriptor or concreteTaskInfoinstances for the requested seeds. -
/rolloutaccepts aRolloutRequest, calls your executor, and normalizes the response into aRolloutResponse. -
/doneis a lightweight readiness hook used by automation, and/debug/envexposes masked API-key info for debugging missing secrets.
/health routes installed by create_task_app and registers bespoke handlers that surface API-key expectations plus structured 422 logs. The pattern is: