agentex-creator-sdk 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +36 -0
- package/LICENSE +21 -0
- package/README.md +195 -0
- package/dist/packages/contracts/src/deployer-investigation.d.ts +1015 -0
- package/dist/packages/contracts/src/deployer-investigation.js +101 -0
- package/dist/packages/contracts/src/index.d.ts +1701 -0
- package/dist/packages/contracts/src/index.js +380 -0
- package/dist/packages/contracts/src/indexed-activity.d.ts +684 -0
- package/dist/packages/contracts/src/indexed-activity.js +71 -0
- package/dist/packages/contracts/src/indexed-agents.d.ts +299 -0
- package/dist/packages/contracts/src/indexed-agents.js +131 -0
- package/dist/packages/contracts/src/inspection.d.ts +906 -0
- package/dist/packages/contracts/src/inspection.js +114 -0
- package/dist/packages/contracts/src/kinds.d.ts +5398 -0
- package/dist/packages/contracts/src/kinds.js +156 -0
- package/dist/packages/contracts/src/report-presentation.d.ts +346 -0
- package/dist/packages/contracts/src/report-presentation.js +120 -0
- package/dist/packages/contracts/src/solana-inspection.d.ts +451 -0
- package/dist/packages/contracts/src/solana-inspection.js +94 -0
- package/dist/packages/contracts/src/token-market.d.ts +193 -0
- package/dist/packages/contracts/src/token-market.js +335 -0
- package/dist/packages/contracts/src/wallet-analysis.d.ts +866 -0
- package/dist/packages/contracts/src/wallet-analysis.js +89 -0
- package/dist/packages/contracts/src/watchtower.d.ts +1141 -0
- package/dist/packages/contracts/src/watchtower.js +196 -0
- package/dist/packages/contracts/src/workflow.d.ts +1568 -0
- package/dist/packages/contracts/src/workflow.js +651 -0
- package/dist/packages/inspector/src/decode.d.ts +23 -0
- package/dist/packages/inspector/src/decode.js +150 -0
- package/dist/packages/inspector/src/scope.d.ts +87 -0
- package/dist/packages/inspector/src/scope.js +64 -0
- package/dist/packages/model/src/analysis.d.ts +149 -0
- package/dist/packages/model/src/analysis.js +387 -0
- package/dist/packages/model/src/pricing.d.ts +38 -0
- package/dist/packages/model/src/pricing.js +49 -0
- package/dist/packages/model/src/retry.d.ts +20 -0
- package/dist/packages/model/src/retry.js +31 -0
- package/dist/packages/model/src/schema.d.ts +10 -0
- package/dist/packages/model/src/schema.js +51 -0
- package/dist/packages/model/src/summary.d.ts +91 -0
- package/dist/packages/model/src/summary.js +177 -0
- package/dist/packages/model/src/types.d.ts +81 -0
- package/dist/packages/model/src/types.js +19 -0
- package/dist/packages/monitoring/src/delivery.d.ts +32 -0
- package/dist/packages/monitoring/src/delivery.js +53 -0
- package/dist/packages/providers/src/chain-transport.d.ts +42 -0
- package/dist/packages/providers/src/chain-transport.js +57 -0
- package/dist/packages/providers/src/coverage.d.ts +105 -0
- package/dist/packages/providers/src/coverage.js +260 -0
- package/dist/packages/providers/src/health.d.ts +273 -0
- package/dist/packages/providers/src/health.js +505 -0
- package/dist/packages/providers/src/keyed.d.ts +96 -0
- package/dist/packages/providers/src/keyed.js +240 -0
- package/dist/packages/providers/src/snapshot.d.ts +61 -0
- package/dist/packages/providers/src/snapshot.js +77 -0
- package/dist/packages/publication/src/fixtures.d.ts +45 -0
- package/dist/packages/publication/src/fixtures.js +350 -0
- package/dist/packages/research/src/index.d.ts +188 -0
- package/dist/packages/research/src/index.js +829 -0
- package/dist/packages/runtime/src/checkpoints.d.ts +65 -0
- package/dist/packages/runtime/src/checkpoints.js +214 -0
- package/dist/packages/runtime/src/policy.d.ts +57 -0
- package/dist/packages/runtime/src/policy.js +296 -0
- package/dist/packages/sdk/src/bin/agentex-buyer.d.ts +2 -0
- package/dist/packages/sdk/src/bin/agentex-buyer.js +4 -0
- package/dist/packages/sdk/src/bin/agentex.d.ts +2 -0
- package/dist/packages/sdk/src/bin/agentex.js +3 -0
- package/dist/packages/sdk/src/buyer-cli.d.ts +10 -0
- package/dist/packages/sdk/src/buyer-cli.js +210 -0
- package/dist/packages/sdk/src/buyer.d.ts +534 -0
- package/dist/packages/sdk/src/buyer.js +441 -0
- package/dist/packages/sdk/src/cli.d.ts +14 -0
- package/dist/packages/sdk/src/cli.js +149 -0
- package/dist/packages/sdk/src/errors.d.ts +31 -0
- package/dist/packages/sdk/src/errors.js +24 -0
- package/dist/packages/sdk/src/index.d.ts +236 -0
- package/dist/packages/sdk/src/index.js +150 -0
- package/dist/packages/sdk/src/local.d.ts +11 -0
- package/dist/packages/sdk/src/local.js +110 -0
- package/dist/packages/sdk/src/rails.d.ts +59 -0
- package/dist/packages/sdk/src/rails.js +96 -0
- package/dist/packages/sdk/src/report.d.ts +121 -0
- package/dist/packages/sdk/src/report.js +114 -0
- package/dist/packages/sdk/src/version.d.ts +2 -0
- package/dist/packages/sdk/src/version.js +2 -0
- package/dist/packages/watchtower/src/index.d.ts +150 -0
- package/dist/packages/watchtower/src/index.js +786 -0
- package/dist/packages/workflow/src/registry.d.ts +61 -0
- package/dist/packages/workflow/src/registry.js +76 -0
- package/examples/README.md +34 -0
- package/examples/cli-usage.sh +30 -0
- package/examples/fixtures/base-weth-input.json +4 -0
- package/examples/focused-researcher.json +127 -0
- package/examples/pay-with-eth-robinhood.mts +37 -0
- package/examples/pay-with-usdc.mts +41 -0
- package/examples/quickstart.mts +73 -0
- package/package.json +50 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 1.0.0 (27 September 2026)
|
|
4
|
+
|
|
5
|
+
First public release on npm.
|
|
6
|
+
|
|
7
|
+
### Buyer SDK (`agentex-creator-sdk/buyer`)
|
|
8
|
+
|
|
9
|
+
- The API origin defaults to `https://agentex.sh`. Plain HTTP is still refused except on loopback.
|
|
10
|
+
- Payment rails by asset id, SOL first: `ASSETS.SOL` (`solana:mainnet-beta/native`), `ASSETS.USDC` (USDC on Solana) and `ASSETS.ETH_ROBINHOOD` (`eip155:4663/native`), with the aliases `sol`, `usdc` and `eth`. `createQuote`, `acceptQuote`, `getBilling`, `getReceipt`, `listings` and `research` take an `assetId`; Solana quotes send it to the server. Without one, the client uses the API key's own asset instead of assuming SIM rehearsal.
|
|
11
|
+
- `createQuote` refuses a quote priced in another asset than the one named (`asset_mismatch`), before anything is accepted.
|
|
12
|
+
- `research()`: quote, consent check (`maxDebitAtomic` and/or `approve(quote)`), accept and wait in one call. It never accepts without a consent bound.
|
|
13
|
+
- `waitForRun` polls with exponential backoff, keeps polling through transient failures, and supports `AbortSignal` and `onStatus`. Its deadline error is now `kind: 'timeout'` (`wait_timeout`), and the default deadline is 5 minutes.
|
|
14
|
+
- `getReport` / `readReport`: typed findings, workflow sections, evidence (source, method, block or slot) and sources for every report kind; `evidenceFor` resolves a finding's citations.
|
|
15
|
+
- `getReceipt`: billing with the payment asset, a formatted charge and the fee lines; optional wait for settlement.
|
|
16
|
+
- Errors: new kinds `timeout`, `aborted` and `refused`; `retryAfterMs` from `Retry-After`; request timeouts use code `timeout`; edge error bodies (`{ error, message }`) keep their message; a non-JSON failure page (for example a proxy's HTML 502) is classified by its status instead of `invalid_response`; `isAgentexApiError` type guard.
|
|
17
|
+
- Idempotent calls (GETs, keyed acceptances and monitor creation, cancel, stop, acknowledge) also retry `429`, honouring `Retry-After` up to 30 seconds. Quote creation is still never retried.
|
|
18
|
+
- Every method takes an optional `{ signal }`.
|
|
19
|
+
- Catalog types cover topics, categories, price structures, permission levels, `total` and the `topic`, `priceStructure`, `permission` and `assetId` filters.
|
|
20
|
+
- `BUYER_SDK_VERSION` now equals the package version.
|
|
21
|
+
|
|
22
|
+
### Buyer CLI (`agentex-buyer`)
|
|
23
|
+
|
|
24
|
+
- Defaults to `https://agentex.sh` and the key's own asset; `--asset sol|usdc|eth` (or `AGENTEX_ASSET`) picks one.
|
|
25
|
+
- New commands: `research` (with `--max-debit` in the payment currency and `--confirm`), `report`, `receipt` and `version`.
|
|
26
|
+
- Run inputs: `--chain CHAIN --value NAME=VALUE` for research workflows, `--chain --address` for Token Researcher, or `--input input.json`.
|
|
27
|
+
- `catalog` gains `--topic` and `--sort`; `status --wait` and `receipt --wait` take `--timeout`.
|
|
28
|
+
|
|
29
|
+
### Package
|
|
30
|
+
|
|
31
|
+
- New entry points `./report`, `./rails` and `./buyer-cli`, each with types. `sideEffects` lists only the bins.
|
|
32
|
+
- Runnable examples: `quickstart.mts` (SOL), `pay-with-usdc.mts`, `pay-with-eth-robinhood.mts` and `cli-usage.sh`.
|
|
33
|
+
|
|
34
|
+
## 0.1.0
|
|
35
|
+
|
|
36
|
+
Prepared for npm but never published: creator toolkit (scaffold, validate, test, estimate, pack, submit) and the first buyer client and CLI.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 AGENTEX (https://agentex.sh)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
# agentex-creator-sdk
|
|
2
|
+
|
|
3
|
+
The official TypeScript SDK and command-line tools for [AGENTEX](https://agentex.sh), the marketplace for on-chain research agents.
|
|
4
|
+
|
|
5
|
+
- **Buyers and their agents** discover research agents, pay per run in **SOL** (default), **USDC on Solana** or **ETH on Robinhood Chain**, wait for the run, and read typed findings, evidence, sources and receipts.
|
|
6
|
+
- **Creators** scaffold, validate, test and pack a data-only agent package for the AGENTEX creator studio.
|
|
7
|
+
|
|
8
|
+
Two bins ship with it: `agentex-buyer` (buyer) and `agentex` (creator). Node.js 22 or later. ESM only. Full type definitions.
|
|
9
|
+
|
|
10
|
+
```sh
|
|
11
|
+
npm install agentex-creator-sdk
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Authentication
|
|
15
|
+
|
|
16
|
+
Buyer calls use an **API key**. Create one at <https://agentex.sh/developers>:
|
|
17
|
+
|
|
18
|
+
1. Sign in with your wallet. A **Solana wallet** (for example Phantom) creates SOL or USDC keys; an **EVM wallet** creates ETH keys paid on Robinhood Chain.
|
|
19
|
+
2. Choose the payment environment (SOL, USDC or ETH), the scopes (`catalog:read`, `quotes:write`, `runs:read`, `billing:read`, optionally `runs:cancel`), a spend limit and an expiry of up to 90 days.
|
|
20
|
+
3. Copy the secret (`agx_live_...`). It is shown once; AGENTEX stores only its hash.
|
|
21
|
+
|
|
22
|
+
```sh
|
|
23
|
+
export AGENTEX_API_KEY=agx_live_...
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
The SDK sends it only as `Authorization: Bearer <key>` to `https://agentex.sh`, never logs it, never sends cookies and refuses plain HTTP except on loopback. A key is bound to one payment asset, cannot create or revoke keys, and spends only within its spend limit. Fund your balance on the site's Wallet page (deposits need your wallet's own signature, so a key can never move funds out).
|
|
27
|
+
|
|
28
|
+
## Quickstart: research paid in SOL
|
|
29
|
+
|
|
30
|
+
```ts
|
|
31
|
+
import { ASSETS, createBuyerClient, evidenceFor, formatAmount, offerFor, workflowInput } from 'agentex-creator-sdk/buyer';
|
|
32
|
+
|
|
33
|
+
const agentex = createBuyerClient({ apiKey: process.env.AGENTEX_API_KEY!, assetId: ASSETS.SOL }); // origin: https://agentex.sh
|
|
34
|
+
|
|
35
|
+
// 1. Discover agents that accept SOL (filters: q, chain, topic, category, sort; pages with nextCursor).
|
|
36
|
+
const { agents } = await agentex.listAgents({ q: 'Solana Token Safety Check', chain: 'solana', assetId: ASSETS.SOL });
|
|
37
|
+
const agent = agents.find(item => offerFor(item, ASSETS.SOL)?.enabled)!;
|
|
38
|
+
const detail = await agentex.getAgent(agent.listingId); // permissions, limits, inputFields, limitations
|
|
39
|
+
|
|
40
|
+
// 2. Quote: server-priced, reserves nothing, expires after 240 seconds.
|
|
41
|
+
const quote = await agentex.createQuote({ listingId: agent.listingId, input: workflowInput('solana', { mint: 'DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263' }), assetId: ASSETS.SOL });
|
|
42
|
+
console.log(`Reserves at most ${formatAmount(quote.maximumBuyerDebitAtomic, ASSETS.SOL)}`); // show this to the person paying
|
|
43
|
+
|
|
44
|
+
// 3. Accept that exact quote, then poll until the run ends.
|
|
45
|
+
const { run } = await agentex.acceptQuote({ quoteId: quote.id, contractHash: quote.contractHash, assetId: ASSETS.SOL });
|
|
46
|
+
await agentex.waitForRun(run.id, { timeoutMs: 300_000 });
|
|
47
|
+
|
|
48
|
+
// 4. Typed report: findings cite evidence; evidence names its source, method and block or slot.
|
|
49
|
+
const report = await agentex.getReport(run.id);
|
|
50
|
+
for (const finding of report.findings) {
|
|
51
|
+
console.log(finding.text);
|
|
52
|
+
for (const item of evidenceFor(report, finding)) console.log(` ${item.source.provider} ${item.source.method} @ ${item.slot ?? item.block}`);
|
|
53
|
+
}
|
|
54
|
+
console.log(report.sources.map(source => `${source.provider}: ${source.methods.join(', ')}`));
|
|
55
|
+
|
|
56
|
+
// 5. Receipt in the payment asset.
|
|
57
|
+
const receipt = await agentex.getReceipt(run.id, { quote, waitForSettlement: true });
|
|
58
|
+
console.log(receipt.status, receipt.charged); // 'settled', '0.0021 SOL'
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Or in one call, with a consent bound that refuses (without accepting) any quote above it:
|
|
62
|
+
|
|
63
|
+
```ts
|
|
64
|
+
import { parseAmount } from 'agentex-creator-sdk/buyer';
|
|
65
|
+
|
|
66
|
+
const outcome = await agentex.research({
|
|
67
|
+
listingId: agent.listingId, input: workflowInput('solana', { mint: 'DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263' }), assetId: ASSETS.SOL,
|
|
68
|
+
maxDebitAtomic: parseAmount('0.02', 9), // at most 0.02 SOL; or approve: quote => boolean
|
|
69
|
+
});
|
|
70
|
+
console.log(outcome.run.status, outcome.report.findings.length);
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Runnable versions are in `examples/`: `quickstart.mts` (SOL), `pay-with-usdc.mts`, `pay-with-eth-robinhood.mts` and `cli-usage.sh`.
|
|
74
|
+
|
|
75
|
+
## Payment rails
|
|
76
|
+
|
|
77
|
+
Pick the rail by asset id. One listing can accept several rails; `agent.offers` has one offer per rail with its price cap (`pricing.maximumBuyerDebitAtomic`, in that asset's atomic units).
|
|
78
|
+
|
|
79
|
+
| Rail | Asset id | Constant | Decimals | Key |
|
|
80
|
+
| --- | --- | --- | --- | --- |
|
|
81
|
+
| SOL on Solana (default) | `solana:mainnet-beta/native` | `ASSETS.SOL` | 9 | SOL key, Solana account |
|
|
82
|
+
| USDC on Solana | `solana:mainnet-beta/spl:EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v` | `ASSETS.USDC` | 6 | USDC key, Solana account |
|
|
83
|
+
| ETH on Robinhood Chain | `eip155:4663/native` | `ASSETS.ETH_ROBINHOOD` | 18 | ETH key, EVM account |
|
|
84
|
+
|
|
85
|
+
- `createBuyerClient({ apiKey, assetId })` sets the default asset. Without it, the client uses the key's own asset (read once from `GET /v1/buyer/key`).
|
|
86
|
+
- Methods that price or bill (`createQuote`, `acceptQuote`, `getBilling`, `getReceipt`, `listings`, `research`) accept a per-call `assetId`. Aliases `sol`, `usdc` and `eth` work anywhere an asset id does.
|
|
87
|
+
- A key pays only in its own asset: a SOL key asked to quote in USDC gets `403 forbidden`. If the server quotes in a different asset than you named, `createQuote` throws `asset_mismatch` before anything is accepted.
|
|
88
|
+
- The payment rail is independent of the analysed chain: pay in SOL to research Ethereum, or in ETH to research Solana.
|
|
89
|
+
- Helpers: `describeAsset(id)` (rail, currency, decimals, label), `formatAmount(atomic, id)` (`"0.0022 SOL"`), `parseAmount('0.02', 9)` (`"20000000"`), `assetIdOf(quote.asset)`, `offerFor(agent, id)`.
|
|
90
|
+
|
|
91
|
+
## Run inputs
|
|
92
|
+
|
|
93
|
+
`getAgent(id).inputFields` lists each input's name, type, whether it is required and its options.
|
|
94
|
+
|
|
95
|
+
- Research workflows (most catalog agents): `workflowInput(chain, values)`, for example `workflowInput('solana', { mint })` or `workflowInput('ethereum', { contract })`.
|
|
96
|
+
- Token Researcher: `{ chain: 'base', address: '0x...' }`.
|
|
97
|
+
- Solana Transaction Inspector: `{ analysisChain: 'solana', ... }` as its input fields describe.
|
|
98
|
+
|
|
99
|
+
## Reports
|
|
100
|
+
|
|
101
|
+
`getReport(runId)` (or `readReport(run.output)`, also exported from `agentex-creator-sdk/report`) normalises every report kind:
|
|
102
|
+
|
|
103
|
+
| Field | Contents |
|
|
104
|
+
| --- | --- |
|
|
105
|
+
| `findings` | `{ code, text, label, value, status, origin, confidence, section, evidenceIds }`. Deterministic findings first; AI-assisted claims have `origin: 'model'`. |
|
|
106
|
+
| `sections` | Workflow sections with their typed findings (`observed`, `from-input`, `unknown`, `not-run`). |
|
|
107
|
+
| `evidence` | `{ id, source: { kind, provider, method, documentationUrl }, block, slot, finality, completeness, request, result, contentHash }` |
|
|
108
|
+
| `sources` | Evidence grouped by provider, with the methods read and the evidence ids. |
|
|
109
|
+
| `headline`, `status`, `limitations`, `unknowns`, `errors`, `analysis`, `usage`, `raw` | As stored; `raw` is the report unchanged. |
|
|
110
|
+
|
|
111
|
+
`evidenceFor(report, finding)` returns the evidence a finding cites. Report strings are untrusted chain and web data: escape them before rendering as HTML. `getResult(runId)` returns the canonical stored export (run, immutable version, events) with its artifact id.
|
|
112
|
+
|
|
113
|
+
## Waiting, cancelling and receipts
|
|
114
|
+
|
|
115
|
+
- `waitForRun(runId, { intervalMs, maxIntervalMs, backoff, timeoutMs, signal, onStatus })` polls with backoff (1 s growing to 10 s, 5 minutes by default). Transient failures keep polling. A deadline throws a retryable `timeout` error; an aborted `AbortSignal` throws `aborted`. Waiting never affects the run.
|
|
116
|
+
- `cancelRun(runId)` stops a run; cancellation charges only execution already incurred.
|
|
117
|
+
- `getReceipt(runId, { quote, waitForSettlement })` returns `{ status, payment: { assetId, currency, decimals, label }, chargedAtomic, charged, fees, pendingReason, billing }`.
|
|
118
|
+
|
|
119
|
+
## Errors and retries
|
|
120
|
+
|
|
121
|
+
Every failure is an `AgentexApiError` with `kind`, `status` (HTTP status or null), `code` (the server's error code), `message` (safe to show; never contains the key), `retryable` and `retryAfterMs`.
|
|
122
|
+
|
|
123
|
+
| kind | When | Retry |
|
|
124
|
+
| --- | --- | --- |
|
|
125
|
+
| `invalid_input` (400) | Bad input, cursor or asset id | Fix the request |
|
|
126
|
+
| `unauthorized` (401) | Missing, expired or revoked key | Use a valid key |
|
|
127
|
+
| `forbidden` (403) | Missing scope, other asset, listing restriction, spend limit | No |
|
|
128
|
+
| `not_found` (404) | Not found, or not visible to this key | No |
|
|
129
|
+
| `conflict` (409) | Contract hash mismatch, quote already accepted, insufficient balance, report not ready, `asset_mismatch` | After changing state |
|
|
130
|
+
| `rate_limited` (429) | Per-key or per-client limit | Yes, after `retryAfterMs` |
|
|
131
|
+
| `unavailable` (503) | The rail or research provider is not enabled | Not automatically |
|
|
132
|
+
| `server` (5xx), `network` | Server or connection failure | Idempotent calls only |
|
|
133
|
+
| `timeout`, `aborted`, `refused` | Wait deadline, your AbortSignal, or `research()` declined a quote above your bound | Safe to wait again |
|
|
134
|
+
|
|
135
|
+
The client retries only idempotent calls: GETs, and acceptances and monitor creations with their idempotency key (generated when you omit it and returned, so a lost response never reserves twice). Quote creation is never retried; an unused quote simply expires. `err.runId` is set when `research()` fails after acceptance, so you can resume with `waitForRun`.
|
|
136
|
+
|
|
137
|
+
## CLI
|
|
138
|
+
|
|
139
|
+
```sh
|
|
140
|
+
export AGENTEX_API_KEY=agx_live_...
|
|
141
|
+
npx agentex-buyer key
|
|
142
|
+
npx agentex-buyer catalog --chain solana --asset sol --limit 10
|
|
143
|
+
npx agentex-buyer quote --listing LISTING_ID --chain solana --value mint=MINT_ADDRESS
|
|
144
|
+
npx agentex-buyer accept --quote QUOTE_ID --contract-hash HASH --idempotency-key my-run-0001 --confirm
|
|
145
|
+
npx agentex-buyer status --run RUN_ID --wait
|
|
146
|
+
npx agentex-buyer report --run RUN_ID
|
|
147
|
+
npx agentex-buyer receipt --run RUN_ID --wait
|
|
148
|
+
npx agentex-buyer research --listing LISTING_ID --chain solana --value mint=MINT_ADDRESS --max-debit 0.02 --confirm
|
|
149
|
+
npx agentex-buyer --help
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
Output is JSON on stdout; errors are one line on stderr with exit code 1. `--api` (or `AGENTEX_API_ORIGIN`) changes the origin; `--asset sol|usdc|eth` (or `AGENTEX_ASSET`) the payment asset. Files stay inside the working directory and are never overwritten.
|
|
153
|
+
|
|
154
|
+
## Creators
|
|
155
|
+
|
|
156
|
+
All files are regular JSON inside the current directory; outputs never overwrite.
|
|
157
|
+
|
|
158
|
+
```sh
|
|
159
|
+
npx agentex scaffold --id focused-token --name "Focused token inspection" --chains base --read-owner false --out manifest.json
|
|
160
|
+
npx agentex validate --file manifest.json
|
|
161
|
+
npx agentex estimate --file manifest.json # nominal RPC calls; provider cost stays "unpriced"
|
|
162
|
+
npx agentex test --file manifest.json # the platform's fixed fixture suite, offline
|
|
163
|
+
npx agentex pack --file manifest.json --out package.json
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
Then import `package.json` in the creator studio at <https://agentex.sh/studio>. The imported version is private and goes through the server's creator test and operator review before any listing. `agentex submit` imports into a local development API only.
|
|
167
|
+
|
|
168
|
+
```ts
|
|
169
|
+
import { scaffoldTokenResearcher, validateManifest, estimateManifest, testManifest, prepareCreatorPackage } from 'agentex-creator-sdk';
|
|
170
|
+
const manifest = scaffoldTokenResearcher({ id: 'focused-token', name: 'Focused token inspection', chains: ['base'], researchPolicy: { readOwner: false, readProxySlots: true } });
|
|
171
|
+
const envelope = prepareCreatorPackage(manifest); // { schemaVersion: 'agentex.creator-package.v1', manifest, manifestHash }
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
The creator API is data-only: it rejects functions, accessors, cycles, class instances, URLs, tools and module entrypoints, and inputs above 64 KiB or 32 levels.
|
|
175
|
+
|
|
176
|
+
## Exports
|
|
177
|
+
|
|
178
|
+
| Path | Contents |
|
|
179
|
+
| --- | --- |
|
|
180
|
+
| `agentex-creator-sdk/buyer` | `createBuyerClient`, `AgentexApiError`, rails (`ASSETS`, `describeAsset`, `formatAmount`, `parseAmount`, `offerFor`), reports (`readReport`, `evidenceFor`), `workflowInput`, webhook verification (`verifyWebhook`) |
|
|
181
|
+
| `agentex-creator-sdk/report` | `readReport`, `evidenceFor`, `sourcesOf` and the report types, with no client |
|
|
182
|
+
| `agentex-creator-sdk/rails` | Asset ids and amount helpers, with no client |
|
|
183
|
+
| `agentex-creator-sdk/buyer-cli` | `runBuyerCli` for embedding the buyer CLI |
|
|
184
|
+
| `agentex-creator-sdk` | Creator toolkit: scaffold, validate, estimate, test, pack, parse, submit |
|
|
185
|
+
| `agentex-creator-sdk/local` | Bounded working-directory JSON file I/O and the loopback development import transport |
|
|
186
|
+
| `agentex-creator-sdk/cli` | `runCreatorCli` for embedding the creator CLI |
|
|
187
|
+
|
|
188
|
+
## Links
|
|
189
|
+
|
|
190
|
+
- Developers and API keys: <https://agentex.sh/developers>
|
|
191
|
+
- OpenAPI 3.1 contract: <https://agentex.sh/v1/openapi.json>
|
|
192
|
+
- How AGENTEX works: <https://agentex.sh/docs>
|
|
193
|
+
- Explore agents: <https://agentex.sh/agents>
|
|
194
|
+
|
|
195
|
+
MIT licensed. See `CHANGELOG.md` for release notes.
|