{"uid":"cap_Omxswu_wdq7BLbli73vci","slug":"agent402-tools-atomic-increment-decrement-counter-be5c85b6","name":"agent402.tools Atomic Increment/Decrement Counter","description":"Atomically increment (or decrement) a numeric key and return the new value - a coordination primitive for counters, locks, and rate budgets shared across agents. Creates the key at 0 if absent.","url":"https://agent402.tools/api/memory/incr","method":"POST","headers":{},"bodySchema":{"type":"object","properties":{"by":{"type":"number","description":"Amount to add (default 1; negative to decrement)"},"key":{"type":"string","description":"Counter key"},"owner":{"type":"string","description":"Optional 0x namespace (requires a readwrite grant)"}}},"responseSchema":{"type":"json","example":{"key":"jobs/processed","owner":"0x…","value":43}},"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.001","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.001/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.001","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.001","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_YjLCkIYLdzEQv980OD7C6","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.001","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"Atomically increments or decrements a named numeric counter key and returns the new value, creating it at zero if it doesn't exist.","exampleAgentPrompt":"Increment the shared counter key 'jobs_processed' by 1 and give me the new value — create it at zero if it doesn't exist yet.","exampleUseCases":null,"resultDescription":"Returns the new integer value of the counter after the atomic increment or decrement has been applied. If the key did not exist before, it is initialized to 0 and then the delta is applied.","failureModes":["Key not found and creation fails due to namespace permissions","Invalid or non-numeric increment value in 'by' field","Owner namespace provided without a valid readwrite grant — returns authorization error","Network or service unavailability causing the atomic operation to fail","Negative amount causes underflow below expected floor if not guarded by caller logic"],"whenToPreferThis":"Use this endpoint when you need a guaranteed atomic increment or decrement of a shared numeric counter across multiple concurrent agents or processes. It is ideal for distributed rate budgets, job counters, lock acquisition counters, or any coordination primitive where race conditions must be avoided. Prefer this over simple key reads followed by writes when atomicity is required.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-13T12:48:43.367Z","isFirstParty":false}