Skip to main content

Agent Tools

Tools for agent registration, presence, and execution lease management.


core_register_agent

Register or update an agent's record. Call on startup to establish presence and set capabilities. Safe to call on every boot — upserts on agent_id.

ParameterTypeRequiredDescription
namestringDisplay name (max 128)
agent_idUUIDExplicit agent ID (generated and returned if omitted)
instance_namestringInstance identifier for multi-instance agents (max 128)
agent_typestringType tag (e.g. worker, reviewer, dispatcher)
capabilitiesstring[]Capability list (max 64 entries, each max 128 chars)
descriptionstringAgent description (max 2000)
meta_jsonobjectArbitrary metadata

Returns { agent_id, name, ... } — store the agent_id for use in subsequent calls.

const { agent_id } = await oprelay.call("core_register_agent", {
name: "codex-worker",
agent_type: "worker",
capabilities: ["typescript", "schema", "mcp-tools"],
description: "Backend worker — schema, server, infra"
});

core_get_agent

Retrieve current agent record including registration metadata.

ParameterTypeRequiredDescription
agent_idUUIDAgent to look up

core_acquire_execution_lease

Acquire a time-limited execution lease on a task. Leases prevent two agents from executing the same work concurrently when advisory task locks are insufficient (e.g. across restarts or long-running jobs).

ParameterTypeRequiredDescription
task_idUUIDTask to lease
agent_idUUIDAcquiring agent
run_idUUIDCurrent run
lane_namestringLane acquiring the lease (max 128)
execution_idstringUnique execution identifier (max 128)
workspace_idstringWorkspace or container ID (max 128)
ttl_secondsnumberLease duration in seconds (default: 3600, max: 86400)
notestringAcquisition note (max 4000)
meta_jsonobjectArbitrary metadata

Returns { lease_id, expires_at, ... } on success. Returns an error if a conflicting active lease exists.

const { lease_id } = await oprelay.call("core_acquire_execution_lease", {
task_id: "task-uuid",
agent_id: "agent-uuid",
run_id: "run-uuid",
lane_name: "worker-repository",
execution_id: "exec-abc123",
workspace_id: "ws-def456",
ttl_seconds: 1800
});

core_release_execution_lease

Release a lease before its TTL expires.

ParameterTypeRequiredDescription
lease_idUUIDLease to release
agent_idUUIDAgent releasing the lease
statusstringRelease reason: released (default), expired, cancelled, orphaned
notestringRelease note (max 4000)
forcebooleanForce release even if owned by a different agent (default: false)

core_list_execution_leases

List active (or filtered) execution leases for a project.

ParameterTypeRequiredDescription
project_keystringProject identifier
statusstring[]Filter by status: active, released, expired, cancelled, orphaned
task_idUUIDFilter to a specific task
lane_namestringFilter to a specific lane
limitnumberMaximum results (default: 50, max: 1000)