@balchemyai/agent-sdk 0.3.8 → 0.3.10
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 +28 -2
- package/README.md +11 -0
- package/docs/DEPLOYMENT.md +6 -4
- package/docs/QUICKSTART.md +41 -30
- package/docs/partner-integration-checklist.md +16 -1
- package/docs/release-policy.md +8 -0
- package/package.json +9 -8
- package/LICENSE +0 -21
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,27 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
|
|
7
7
|
|
|
8
8
|
---
|
|
9
9
|
|
|
10
|
+
## [0.3.10] — 2026-06-30
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- Prepare the SDK and CLI package line for the next coordinated patch release.
|
|
15
|
+
- Align package examples and docs with default MCP exposure, safe read wrappers,
|
|
16
|
+
Hub Access, walletless setup, and live-armed fail-closed boundaries.
|
|
17
|
+
- Remove the CLI automatic npm registry update check from launch paths and stop
|
|
18
|
+
package docs/templates from suggesting global installs.
|
|
19
|
+
- Build CLI package output from a production `tsconfig` so package dist does not
|
|
20
|
+
include compiled test artifacts.
|
|
21
|
+
|
|
22
|
+
### Notes
|
|
23
|
+
|
|
24
|
+
- This is a release-prep source entry only. npm publish, public mirror sync, and
|
|
25
|
+
live package install proof remain separate release steps.
|
|
26
|
+
- No live-trade proof, Base live coverage, or source-owner payout rails are
|
|
27
|
+
claimed by this package release.
|
|
28
|
+
- Publish `@balchemyai/agent-sdk@0.3.10` before `balchemy@0.3.10` so the CLI
|
|
29
|
+
dependency resolves from npm semver.
|
|
30
|
+
|
|
10
31
|
## [0.3.7] — 2026-06-08
|
|
11
32
|
|
|
12
33
|
### Fixed
|
|
@@ -221,8 +242,13 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm
|
|
|
221
242
|
- `getIdentityTokenRevokeStatus()` — check revocation status
|
|
222
243
|
- `connectMcp()` — instantiate a typed MCP client
|
|
223
244
|
- `BalchemyMcpClient` — JSON-RPC MCP client with automatic retry and SSE envelope parsing
|
|
224
|
-
-
|
|
225
|
-
|
|
245
|
+
- Historical early typed helpers were narrowed in later releases. Current
|
|
246
|
+
public convenience methods are the safe helper surface: `askBot`,
|
|
247
|
+
`agentStatus`, `agentReadinessReport`, `agentContextSnapshot`,
|
|
248
|
+
`agentMarketBrief`, `agentCandidateReport`, and `agentRiskReport`.
|
|
249
|
+
- Direct quote, swap, wallet mutation, and privileged instruction helpers are
|
|
250
|
+
not exposed as typed public SDK methods. Use `tools/list` and `callTool()`
|
|
251
|
+
for the current scoped MCP surface.
|
|
226
252
|
- `requestSeed()` — disabled stub (throws `AgentSdkError` deterministically)
|
|
227
253
|
- `listTools()`, `callTool()`, `ping()`
|
|
228
254
|
- `connectMcp()` — factory shortcut for `BalchemyMcpClient`
|
package/README.md
CHANGED
|
@@ -8,6 +8,13 @@ Balchemy does not ask an inner model to make trade decisions. Your outer LLM
|
|
|
8
8
|
chooses tools. Balchemy checks policy, executes through the authorized path, and
|
|
9
9
|
keeps the record.
|
|
10
10
|
|
|
11
|
+
## Release Line
|
|
12
|
+
|
|
13
|
+
This source tree is prepared for `@balchemyai/agent-sdk@0.3.10`. npm publish,
|
|
14
|
+
public mirror sync, and live package installation proof happen in separate
|
|
15
|
+
release steps; this README does not claim that `0.3.10` has already been
|
|
16
|
+
published.
|
|
17
|
+
|
|
11
18
|
## Install
|
|
12
19
|
|
|
13
20
|
```sh
|
|
@@ -132,6 +139,10 @@ Use `agent_status` for read-scope runtime state. Safe read wrappers are
|
|
|
132
139
|
enough. The backend runtime must report `autonomous_runtime.mode=live_armed`,
|
|
133
140
|
`armed=true`, and `paused=false` from a fresh `agent_status` response.
|
|
134
141
|
|
|
142
|
+
The public SDK does not claim live-trade proof, Base live coverage, or
|
|
143
|
+
source-owner payout rails. Treat those as runtime/backend facts that must be
|
|
144
|
+
verified from current advertised tools and production evidence before use.
|
|
145
|
+
|
|
135
146
|
## Errors
|
|
136
147
|
|
|
137
148
|
All SDK methods throw `AgentSdkError` on failure.
|
package/docs/DEPLOYMENT.md
CHANGED
|
@@ -104,10 +104,12 @@ Similar to Railway. Use Render's "Background Worker" service type (not Web Servi
|
|
|
104
104
|
|
|
105
105
|
If you prefer to run the agent directly as a system service:
|
|
106
106
|
|
|
107
|
-
**1. Install
|
|
107
|
+
**1. Install locally in the agent directory:**
|
|
108
108
|
|
|
109
109
|
```bash
|
|
110
|
-
|
|
110
|
+
cd /home/ubuntu/agent
|
|
111
|
+
npm init -y
|
|
112
|
+
npm install --omit=dev balchemy@0.3.10 @balchemyai/agent-sdk@0.3.10
|
|
111
113
|
```
|
|
112
114
|
|
|
113
115
|
**2. Create a systemd unit file:**
|
|
@@ -122,7 +124,7 @@ After=network.target
|
|
|
122
124
|
Type=simple
|
|
123
125
|
User=ubuntu
|
|
124
126
|
WorkingDirectory=/home/ubuntu/agent
|
|
125
|
-
ExecStart=/
|
|
127
|
+
ExecStart=/home/ubuntu/agent/node_modules/.bin/balchemy start /home/ubuntu/agent/agent.config.yaml
|
|
126
128
|
EnvironmentFile=/home/ubuntu/agent/.env
|
|
127
129
|
Restart=always
|
|
128
130
|
RestartSec=10
|
|
@@ -186,7 +188,7 @@ logging:
|
|
|
186
188
|
|
|
187
189
|
**Agent starts but makes no decisions:**
|
|
188
190
|
- Verify your API key has `trade` scope (Hub > API Keys > Scopes)
|
|
189
|
-
- Check that
|
|
191
|
+
- Check that setup is complete and the backend reports the expected runtime mode
|
|
190
192
|
- Lower `min_confidence` in `behavior_rules`
|
|
191
193
|
|
|
192
194
|
**Budget exhausted quickly:**
|
package/docs/QUICKSTART.md
CHANGED
|
@@ -1,25 +1,27 @@
|
|
|
1
1
|
# Balchemy Agent — Quickstart
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Connect a local CLI/SDK runner to a Balchemy Hub agent in under 5 minutes.
|
|
4
4
|
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
## Prerequisites
|
|
8
8
|
|
|
9
9
|
- Node.js 18+ (or Docker)
|
|
10
|
-
- A Balchemy account with at least one agent
|
|
11
|
-
|
|
10
|
+
- A Balchemy account with at least one Hub agent, or an explicit walletless
|
|
11
|
+
onboarding flow
|
|
12
|
+
- A scoped MCP/API key from Hub > Agents > your agent > Access/API Keys
|
|
12
13
|
- An LLM API key (Anthropic or OpenAI)
|
|
13
14
|
|
|
14
15
|
---
|
|
15
16
|
|
|
16
|
-
## Step 1: Create
|
|
17
|
+
## Step 1: Create or select a Hub agent
|
|
17
18
|
|
|
18
19
|
1. Go to [balchemy.ai](https://balchemy.ai) and sign in
|
|
19
20
|
2. Open Hub > Agents > New Agent
|
|
20
|
-
3. Complete the setup wizard
|
|
21
|
-
4.
|
|
22
|
-
5.
|
|
21
|
+
3. Complete the setup wizard enough to create the agent and runtime state
|
|
22
|
+
4. Open the agent Access/API key flow
|
|
23
|
+
5. Copy the MCP endpoint: `https://api.balchemy.ai/mcp/YOUR_PUBLIC_ID`
|
|
24
|
+
6. Generate a scoped API key and copy it (shown once)
|
|
23
25
|
|
|
24
26
|
---
|
|
25
27
|
|
|
@@ -30,36 +32,41 @@ npx balchemy
|
|
|
30
32
|
```
|
|
31
33
|
|
|
32
34
|
The wizard asks:
|
|
33
|
-
-
|
|
34
|
-
-
|
|
35
|
-
-
|
|
36
|
-
-
|
|
37
|
-
- Strategy preset
|
|
35
|
+
- LLM provider, API key, and model
|
|
36
|
+
- New walletless agent or existing MCP endpoint/API key
|
|
37
|
+
- Strategy preset and natural-language behavior rules
|
|
38
|
+
- Whether to open the local cockpit
|
|
38
39
|
|
|
39
|
-
|
|
40
|
+
New walletless agents are provisioned first. Root/recovery wallet binding and
|
|
41
|
+
chain-specific setup happen later through the authenticated MCP setup flow.
|
|
42
|
+
Existing agents can be resumed from the encrypted local agent store.
|
|
40
43
|
|
|
41
44
|
---
|
|
42
45
|
|
|
43
|
-
## Step 3: Start the
|
|
46
|
+
## Step 3: Start the local runner
|
|
44
47
|
|
|
45
48
|
```bash
|
|
46
49
|
npx balchemy start
|
|
47
50
|
```
|
|
48
51
|
|
|
49
|
-
You should see:
|
|
50
|
-
|
|
51
|
-
```
|
|
52
|
-
Starting Balchemy agent from: /path/to/agent.config.yaml
|
|
53
|
-
[agent] Running. Press Ctrl+C to stop.
|
|
54
|
-
[agent] status=running events=0 decisions=0 trades=0 llmCost=$0.0000/5
|
|
55
|
-
```
|
|
56
|
-
|
|
57
52
|
The agent:
|
|
58
53
|
1. Connects to the Balchemy SSE event stream
|
|
59
54
|
2. Receives market signals and platform events
|
|
60
|
-
3.
|
|
61
|
-
|
|
62
|
-
|
|
55
|
+
3. Fetches fresh `agent_status` and behavior rules before asking your LLM to
|
|
56
|
+
decide whether to buy, sell, hold, block, or mark data degraded
|
|
57
|
+
4. Blocks trade calls in `shadow`, `live_unarmed`, `paused`, stale status, or
|
|
58
|
+
missing-rule states
|
|
59
|
+
5. Calls `trade_command` only when local live mode and backend runtime are both
|
|
60
|
+
live-armed and the policy/approval path allows it
|
|
61
|
+
6. Can be monitored and adjusted through the Balchemy CLI cockpit (`npx balchemy`)
|
|
62
|
+
|
|
63
|
+
`shadow_mode` remains the safe default. Setting local `shadow_mode: false` is
|
|
64
|
+
not enough to trade; the backend must report `autonomous_runtime.mode` as
|
|
65
|
+
`live_armed`, `armed=true`, and `paused=false`.
|
|
66
|
+
|
|
67
|
+
This quickstart does not claim live-trade proof, Base live coverage, or
|
|
68
|
+
source-owner payout rails. Verify those from current runtime/backend evidence
|
|
69
|
+
before relying on them.
|
|
63
70
|
|
|
64
71
|
---
|
|
65
72
|
|
|
@@ -83,11 +90,6 @@ The generated `docker-compose.yml` runs the agent with:
|
|
|
83
90
|
```typescript
|
|
84
91
|
import { AgentLoop } from '@balchemyai/agent-sdk';
|
|
85
92
|
|
|
86
|
-
// From YAML config file
|
|
87
|
-
const loop = AgentLoop.fromConfig('./agent.config.yaml');
|
|
88
|
-
await loop.start();
|
|
89
|
-
|
|
90
|
-
// Or inline config
|
|
91
93
|
const statusEvents: string[] = [];
|
|
92
94
|
const decisionEvents: unknown[] = [];
|
|
93
95
|
const errorEvents: string[] = [];
|
|
@@ -106,6 +108,15 @@ const loop2 = new AgentLoop({
|
|
|
106
108
|
await loop2.start();
|
|
107
109
|
```
|
|
108
110
|
|
|
111
|
+
The SDK constructs `AgentLoop` from explicit config. Use `npx balchemy start`
|
|
112
|
+
when you want the CLI to load `agent.config.yaml` for you.
|
|
113
|
+
|
|
114
|
+
For read-first integrations, use `connectMcp()`/`listTools()` and call only the
|
|
115
|
+
runtime-advertised tools. Safe read wrappers include `agent_status`,
|
|
116
|
+
`agent_context_snapshot`, `agent_market_brief`, `agent_candidate_report`, and
|
|
117
|
+
`agent_risk_report`. Raw provider, approval, withdrawal, swap-bypass, and
|
|
118
|
+
privileged manage surfaces are not public SDK helpers.
|
|
119
|
+
|
|
109
120
|
---
|
|
110
121
|
|
|
111
122
|
## Strategy presets
|
|
@@ -11,7 +11,11 @@
|
|
|
11
11
|
- [ ] Enable at least one onboarding mode (`siwe` or `walletless`)
|
|
12
12
|
- [ ] Verify `POST /api/public/erc8004/onboarding/siwe`
|
|
13
13
|
- [ ] Verify `POST /api/public/erc8004/onboarding/identity` (if walletless enabled)
|
|
14
|
-
- [ ]
|
|
14
|
+
- [ ] For Hub-managed agents, use the Hub agent Access/API key flow and the
|
|
15
|
+
returned `POST /mcp/{publicId}` endpoint
|
|
16
|
+
- [ ] For walletless onboarding, complete the explicit MCP flow:
|
|
17
|
+
`walletless/init` -> `walletless/provision` -> `walletless/bind-wallet`
|
|
18
|
+
-> `setup_agent`
|
|
15
19
|
- [ ] Validate replay protection (token/jti reuse rejection)
|
|
16
20
|
|
|
17
21
|
## Headers and Claims
|
|
@@ -25,6 +29,17 @@
|
|
|
25
29
|
- [ ] Onboarding route limits configured and monitored
|
|
26
30
|
- [ ] Discovery feed and health endpoint limits configured
|
|
27
31
|
|
|
32
|
+
## MCP Exposure Boundaries
|
|
33
|
+
|
|
34
|
+
- [ ] Treat `balchemy-backend/src/core/tools/mcp-exposure.policy.ts` as the
|
|
35
|
+
public MCP exposure source of truth
|
|
36
|
+
- [ ] Confirm default public tools and granular read-only tools are distinct
|
|
37
|
+
- [ ] Do not document raw provider, wallet mutation, withdrawal, approval,
|
|
38
|
+
swap-bypass, or privileged manage helpers as public SDK APIs unless they
|
|
39
|
+
are advertised by `tools/list` for the caller and scope
|
|
40
|
+
- [ ] Confirm live actions fail closed unless the backend runtime is
|
|
41
|
+
`live_armed`, `armed=true`, `paused=false`, and policy/approval gates pass
|
|
42
|
+
|
|
28
43
|
## Operational
|
|
29
44
|
|
|
30
45
|
- [ ] JWKS endpoint reachable (`/.well-known/jwks.json`)
|
package/docs/release-policy.md
CHANGED
|
@@ -17,6 +17,14 @@
|
|
|
17
17
|
2. Onboarding smoke examples updated.
|
|
18
18
|
3. Changelog entry added.
|
|
19
19
|
4. Backward compatibility review complete for public exports.
|
|
20
|
+
5. Package build output resolves every exported path and CLI bin.
|
|
21
|
+
6. `npm pack --dry-run --json` or equivalent package preview passes.
|
|
22
|
+
7. Clean install/import smoke passes in an approved container, VPS, or CI
|
|
23
|
+
context.
|
|
24
|
+
|
|
25
|
+
Publishing is not complete until the npm publish goal succeeds and the registry
|
|
26
|
+
serves the intended versions. Release-prep commits must not claim publish
|
|
27
|
+
completion.
|
|
20
28
|
|
|
21
29
|
## Deprecation Rule
|
|
22
30
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@balchemyai/agent-sdk",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.10",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"private": false,
|
|
6
6
|
"description": "Balchemy external AI agent onboarding and MCP client SDK",
|
|
@@ -47,6 +47,13 @@
|
|
|
47
47
|
"engines": {
|
|
48
48
|
"node": ">=18.0.0"
|
|
49
49
|
},
|
|
50
|
+
"scripts": {
|
|
51
|
+
"build": "tsc -p tsconfig.json",
|
|
52
|
+
"typecheck": "tsc --noEmit -p tsconfig.json",
|
|
53
|
+
"test": "jest",
|
|
54
|
+
"test:cov": "jest --coverage",
|
|
55
|
+
"prepublishOnly": "pnpm run typecheck && pnpm run build"
|
|
56
|
+
},
|
|
50
57
|
"dependencies": {
|
|
51
58
|
"js-yaml": "^4.1.0"
|
|
52
59
|
},
|
|
@@ -57,11 +64,5 @@
|
|
|
57
64
|
"jest": "^30.0.0",
|
|
58
65
|
"ts-jest": "^29.3.4",
|
|
59
66
|
"typescript": "5.8.3"
|
|
60
|
-
},
|
|
61
|
-
"scripts": {
|
|
62
|
-
"build": "tsc -p tsconfig.json",
|
|
63
|
-
"typecheck": "tsc --noEmit -p tsconfig.json",
|
|
64
|
-
"test": "jest",
|
|
65
|
-
"test:cov": "jest --coverage"
|
|
66
67
|
}
|
|
67
|
-
}
|
|
68
|
+
}
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2025 Balchemy Team
|
|
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.
|