policy.set

set(agentId, spendingLimit?, allowedTargets?) → UpdateReceipt

Update an agent's on-chain spending policy. The owner submits the transaction via WaaS. Omitted fields keep their current value.

Parameters

Name Type Required Description
agentId string ✓ The agent's UUID.
spendingLimit string - Max OKRW per transaction as a decimal string (e.g. '100'). '0' = unlimited.
allowedTargets string - Comma-separated destination addresses. Empty string ('') = allow all.

Returns

Type: object

Returns txHashes for the metadata updates.

Errors

Code Name Description
AGENT_PENDING AgentPending Agent has no on-chain record yet.

Examples

Set 100 OKRW Limit

{
  "agentId": "123e4567-e89b-12d3-a456-426614174000",
  "spendingLimit": "100"
}

Restrict to Specific Address

The two addresses are examples: put in the contracts this agent may call, comma-separated.

{
  "agentId": "123e4567-e89b-12d3-a456-426614174000",
  "allowedTargets": "0x8f3ac2b1d9e74c05a6b18fe27dc4913e5a0f7b62,0x2c7f09b81a6d3ff1e5a0d4c6bc2a8f7e19dc3a4b"
}
ESC
Type to search