Skip to main content

Agents

Choose your language:

Agents are Mankinds automation units attached to systems.

client.agents.list(filters)

List agents in the authenticated organization.

SDKclient.agents.list(filters=None)
ReturnsAgent[]

Parameters:

LocationParameterTypeRequiredDescription
Querysystem_idstringOptionalRestrict agents to one system UUID.
Queryagent_typestringOptionalRestrict by agent type.
QuerystatusstringOptionalRestrict by agent status.

client.agents.get(agentId)

Read one agent by id.

SDKclient.agents.get(agent_id)
ReturnsAgent

Parameters:

LocationParameterTypeRequiredDescription
Pathagent_idstringRequiredAgent UUID.

client.agents.run(agentId, params)

Trigger a run for an existing agent.

SDKclient.agents.run(agent_id, params=None, idempotency_key=None)
ReturnsAgentRun

Parameters:

LocationParameterTypeRequiredDefaultDescription
Pathagent_idstringRequiredAgent UUID.
Bodytrigger_sourcestringOptionalciSource label for the run.
Bodytrigger_detailstringOptionalAdditional trigger detail.
Bodyrun_modestringOptionalRequested run mode. The backend resolves it against the agent config.
BodymetadatadictOptionalArbitrary metadata stored on the run. The backend adds actor_label.
SDK optionidempotency_keystringOptionalSent as the Idempotency-Key header.

Notable behavior:

  • The agent must belong to the authenticated organization.
  • The agent must be in a runnable state.
  • If triggerSource resolves to CI, the agent must already have a configured gate.
  • The backend returns 409 when the agent already has an active or queued run.
  • The backend returns 429 when the agent daily run limit is reached.

Example:

run = client.agents.run(agent["id"], {
"triggerSource": "release-script",
"runMode": "offline",
"metadata": {"environment": "preprod"},
})

client.agents.getRun(agentId, runId)

Read one agent run.

SDKclient.agents.get_run(agent_id, run_id)
ReturnsAgentRun

Parameters:

LocationParameterTypeRequiredDescription
Pathagent_idstringRequiredAgent UUID.
Pathrun_idstringRequiredAgent run UUID.

client.agents.waitForGate(agentId, runId, options)

SDK helper that polls client.agents.getRun(...) until the run reaches a terminal state, then raises on failed gate decisions.

SDKclient.agents.wait_for_gate(agent_id, run_id, timeout_ms=..., interval_ms=..., on_poll=None)
ReturnsAgentRun

Parameters:

LocationParameterTypeRequiredDefaultDescription
SDKagent_idstringRequiredAgent UUID.
SDKrun_idstringRequiredAgent run UUID.
SDKtimeout_msintegerOptional1800000Maximum wait time in milliseconds.
SDKinterval_msintegerOptional5000Poll interval in milliseconds.
SDKon_pollcallableOptionalCallback called with each run payload.

Raises:

ErrorWhen
GateFailedErrorThe run completed and results.gate.passed or summary.gate.passed is false.
JobFailedErrorThe run terminal status is failed, canceled or timed out.
PollTimeoutErrorThe timeout is reached before a terminal state.