Skip to Content
SDKRun Your First Script

Run Your First SDK Script

This is the fastest way to prove a Beav3r setup works end to end:

  1. Create a project.
  2. Issue an API key.
  3. Add one simple money approval rule in Beav3r.
  4. Pair a signer.
  5. Run a script with @beav3r/sdk.
  6. 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:

  1. Open Projects.
  2. Create a project.
  3. Open Integrations.
  4. Create an API key for that project.
  5. 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:

  1. Create a pairing session.
  2. Scan the QR code with the mobile signer.
  3. 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 install

Step 5: Set environment variables

Copy the example env file:

cp .env.example .env

Then update .env with the project API key:

BEAV3R_API_KEY=your_project_api_key

The demo already defaults to:

  • BEAV3R_BASE_URL=https://staging.server.beav3r.ai
  • BEAV3R_AGENT_ID=sdk_quickstart
  • BEAV3R_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 .env with dotenv
  • creates a Beav3r client
  • submits a payments.send_usdt action for 25 USDT
  • waits for the final decision with guardAndWait()

Run it:

node beav3r-quickstart.mjs

Expected 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 action
  • executed: Beav3r executed the action immediately after approval
  • denied: policy denied the action before it reached a signer
  • rejected: signer rejected the action
  • expired: the request timed out before a decision

Why this script works

This script uses:

  • Beav3r from @beav3r/sdk
  • guardAndWait() 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_URL points 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

Next steps