Trayntrayn.ai

Harness Options

Configure how the Trayn harness runs your agent against playgroundes.

Options

OptionTypeDefaultDescription
agentargsAgentArgsrequiredAgent factory — see Agent Interface
url_overridestringSandbox URL — fetches task dynamically from the backend
headlessbooleantrueRun browser headless
max_stepsnumber25Max actions per task
viewportobject1280x720Browser viewport size
log_levelstringinfodebug, info, warn, error
verbosebooleanfalseShow accessibility tree previews
grader_endpointstringTrayn APICustom grading endpoint URL
session_idstringautoSession ID override
run_idstringautoRun ID override
user_idstringUser email for run attribution

Usage

When url_override is provided, the harness fetches the task definition from the backend using the session ID embedded in the playground URL.

import { harness } from "@trayn/agent-sdk";
 
const h = harness({
  agentargs: { /* ... */ },
  url_override: "https://app.trayn.ai/playground/{host}/{sessionId}",
});
 
await h.run();

The harness parses the session ID from the URL, fetches the task definition (goal, verifiers, expected actions), and uses it to drive the agent run.

Programmatic Task Editing

Fetch the task definition, modify it, and push changes back to the backend:

import {
  fetchTaskFromUrl,
  pushTaskToRemote,
  parseSessionIdFromUrl,
} from "@trayn/agent-sdk";
 
const playgroundUrl = "https://app.trayn.ai/playground/{host}/{sessionId}";
 
const task = await fetchTaskFromUrl(playgroundUrl);
task.goal = "Updated goal text";
 
const sessionId = parseSessionIdFromUrl(playgroundUrl);
await pushTaskToRemote(sessionId, task);

Task Result

The harness returns a TaskResult for each completed task:

FieldTypeDescription
task_namestringTask identifier
successbooleanWhether the task was completed
cum_rewardnumberTotal reward
n_stepsnumberNumber of actions taken
elapsed_timenumberSeconds elapsed
err_msgstringError message if failed

On this page