Aller au contenu principal

Agents

Choisissez votre langage :

Agents are Mankinds automation units attached to systems.

client.agents.list(filters)

List agents in the authenticated organization.

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

Parameters:

EmplacementParamètreTypeRequisDescription
Querysystem_idstringOptionnelRestrict agents to one system UUID.
Queryagent_typestringOptionnelRestrict by agent type.
QuerystatusstringOptionnelRestrict by agent status.

client.agents.get(agentId)

Read one agent by id.

SDKclient.agents.get(agent_id)
RetourneAgent

Parameters:

EmplacementParamètreTypeRequisDescription
Pathagent_idstringRequisAgent UUID.

client.agents.run(agentId, params)

Trigger a run for an existing agent.

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

Parameters:

EmplacementParamètreTypeRequisDéfautDescription
Pathagent_idstringRequisAgent UUID.
Bodytrigger_sourcestringOptionnelciSource label for the run.
Bodytrigger_detailstringOptionnelAdditional trigger detail.
Bodyrun_modestringOptionnelRequested run mode. The backend resolves it against the agent config.
BodymetadatadictOptionnelArbitrary metadata stored on the run. The backend adds actor_label.
SDK optionidempotency_keystringOptionnelSent 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)
RetourneAgentRun

Parameters:

EmplacementParamètreTypeRequisDescription
Pathagent_idstringRequisAgent UUID.
Pathrun_idstringRequisAgent 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)
RetourneAgentRun

Parameters:

EmplacementParamètreTypeRequisDéfautDescription
SDKagent_idstringRequisAgent UUID.
SDKrun_idstringRequisAgent run UUID.
SDKtimeout_msintegerOptionnel1800000Maximum wait time in milliseconds.
SDKinterval_msintegerOptionnel5000Poll interval in milliseconds.
SDKon_pollcallableOptionnelCallback 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.