Harness

Run

Every public method of a run in TypeScript, Python and Ruby.

TypeScript methods return promises unless marked sync. Python and Ruby methods are synchronous. A dash means the language has no such method.

Checking calls#

TypeScriptPythonRubyDoes
check(tool, args, { id, messages, approvedByUser })check(tool, args, *, id, messages, approved_by_user)check(tool, args, id:, messages:, approved_by_user:)Before-guards; returns a verdict. A call that may run is counted toward budgets.
after(tool, args, result, { id, messages })after(tool, args, result, *, id, messages)after(tool, args, result, id:, messages:)After-guards; returns what the model reads (TypeScript: { result, results })
wrap(tool, fn) (sync, returns an async function)wrap(tool, fn=None, *, messages=None)wrap(tool) { |args| }Both around your function
preview(tool, args)-preview(tool, args)Dry-run engine check
allowedTools(names?)allowed_tools(names=None)allowed_tools(names)Tools within the task's ceiling, plus the human tools

Adapters#

TypeScriptPythonRubyDoes
tools(tools) (sync)--Wraps AI SDK tools
toolApproval (getter)--For AI SDK toolApproval
prepareStep (getter)--For AI SDK prepareStep
budgetExceeded (getter)--For AI SDK stopWhen
--ruby_llm(tool, chat: nil)Guards a RubyLLM tool
humanTools(jsonSchema, { methods }) (sync)human_tools(methods=None)human_tools(methods:)Human tools
--ruby_llm_human_tools(methods:)Human tools as RubyLLM tools

People in the loop#

TypeScriptPythonRubyDoes
startVerification({ verdict, method, permission })start_verification(*, verdict, method, permission)start_verification(verdict:, method:, permission:)Sends the person a code or push
submitCode(code, challengeToken?)submit_code(code, challenge_token=None)submit_code(code, challenge_token = nil)Passes on the person's code
verificationStatus(challengeToken?)verification_status(challenge_token=None)verification_status(challenge_token = nil)Polls a verification
completeVerification(challengeToken?)complete_verification(challenge_token=None)complete_verification(challenge_token = nil)Records a finished verification
verifiedAt()verified_at (property, epoch seconds)verified_atWhen the person last verified in this run
confirm(tool, args)confirm(tool, args)confirm(tool, args)The person confirmed this exact call
requestApproval(call)request_approval(call)request_approval(call)Files a reviewer request for a call
approvalStatus(id)approval_status(id)approval_status(id)Where a reviewer request stands
requestPlan(calls, reason?)-request_plan(calls, reason:)Files a plan
planStatus()-plan_statusWhere the run's plan stands

Task and session#

TypeScriptPythonRubyDoes
token()token()tokenThe task token, starting the task on first use
taskId()task_id()task_idThe task id
whoami()whoami()whoamiWho the agent works for and what the task allows; cached
session()session()sessionThe run's session id, created on first use
complete()complete()complete!Ends the session and completes the task
revoke()revoke()revoke!Ends the session and revokes the task
property(name)property(name)property(name)Reads a secret
sign(name, { claims } or { data })sign(name, *, claims, data)sign(name, claims:, data:)Signs with a key pair
reportTools(definitions)-report_tools(definitions)Reports tool definition hashes

Grounding, identity and budgets#

TypeScriptPythonRubyDoes
ground(...values) (sync)ground(*values)ground(*values)Values known to be true, for grounding
identify(...values) (sync)identify(*values)identify(*values)Who is asking, for requesterOnly; also grounds them
recordUsage({ usd })record_usage(*, usd)record_usage(usd:)Adds model spend for budget
recentExecutions()recent_executions()recent_executionsExecutions in the last hour for this agent and person, with tiers
budgetExhausted()budget_exhausted()budget_exhausted?A run budget is used up
snapshot()snapshot()snapshotA copy of the run's state

Attributes#

TypeScriptPythonRubyMeaning
idididThe run id
harnessharnessharnessThe harness
options--The options the run was created with
toolNamestool_namestool_namesTools seen through the adapter (TypeScript, Ruby) or wrap (Python)