Run Your First SDK Script
This is the fastest way to prove a Beav3r setup works end to end:
- Create a project.
- Issue an API key.
- Add one simple money approval rule in Beav3r.
- Pair a signer.
- Run a script with
@beav3r/sdk. - Approve the request from the signer.
The result should be:
- the script sends an action to Beav3r
- Beav3r evaluates the policy
- the request lands in the signer inbox
- the final decision resolves back to the script
Before starting
Required:
- a running Beav3r server
- the Beav3r dashboard
- one active signer paired to the same project
If platform setup is not complete yet, start here:
Step 1: Create a project and API key
In the Beav3r dashboard:
- Open
Projects. - Create a project.
- Open
Integrations. - Create an API key for that project.
- Copy the key.
Keep the project open. The same project will be used for the policy and signer steps. After creating the project, the default settings can remain unchanged.
Step 2: Add one simple policy
In Policy Studio, create a rule with:
- action type:
payments.send_usdt - user-facing label:
Send USDT - effect:
Require approval - reason:
Require approval above 10 USDT - condition field:
amount - operator:
gt - value:
10
This makes any request above 10 USDT route to signer approval.
The important part is:
- the technical action type and condition field in the dashboard must exactly match the script payload
- the user-facing label is the action text shown in policy and approval surfaces
Step 3: Pair a signer
In Integrations:
- Create a pairing session.
- Scan the QR code with the mobile signer.
- Confirm the signer shows as active.
If the demo browser signer is in use, make sure it is explicitly enabled in the environment first.
Step 4: Clone the demo repo
Use the official demo project:
git clone https://github.com/beav3r-ai/beav3r-demo.git
cd beav3r-demo
npm installStep 5: Set environment variables
Copy the example env file:
cp .env.example .envThen update .env with the project API key:
BEAV3R_API_KEY=your_project_api_keyThe demo already defaults to:
BEAV3R_BASE_URL=https://staging.server.beav3r.aiBEAV3R_AGENT_ID=sdk_quickstartBEAV3R_DEFAULT_EXPIRY_SECONDS=180
If the Beav3r server is hosted elsewhere, replace the base URL in .env.
Step 6: Run the demo script
The demo repo already includes beav3r-quickstart.mjs, which:
- loads
.envwithdotenv - creates a
Beav3rclient - submits a
payments.send_usdtaction for25 USDT - waits for the final decision with
guardAndWait()
Run it:
node beav3r-quickstart.mjsExpected result
In Beav3r:
- the request appears in
Inbox - the request status is
pending - the paired signer receives it
Because this example sends 25 USDT, it is above the 10 USDT threshold and should require approval.
After approval:
- the signer returns the decision
- Beav3r updates the action state
- the script logs a final result
Typical outcomes:
approved: signer approved the actionexecuted: Beav3r executed the action immediately after approvaldenied: policy denied the action before it reached a signerrejected: signer rejected the actionexpired: the request timed out before a decision
Why this script works
This script uses:
Beav3rfrom@beav3r/sdkguardAndWait()to submit the action and poll for the final state- the API key from the active Beav3r project
The action is routed through the normal Beav3r action flow. There is no local shortcut or fake demo bypass in the SDK path.
Common mistakes
If the request does not show up:
- check that the API key belongs to the intended project
- confirm the action type matches the rule exactly
- confirm the payload field name matches the rule condition
this example uses
amount - confirm the signer is paired to that same project
- verify
BEAV3R_BASE_URLpoints at the running Beav3r server
If the request is denied immediately:
- check the project policy
- look for a deny rule that matches before the approval rule
If the request stays pending:
- check that the signer is still active
- confirm the mobile signer can receive notifications
- increase the script timeout for manual testing