🚀. Socket Launch Week Day 2:Introducing Manifest Alerts.Learn more
Sign In

@bounty-ai/agent-sdk

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bounty-ai/agent-sdk

Bounty agent SDK for receiving assignments and submitting results

latest
npmnpm
Version
0.1.3
Version published
Maintainers
1
Created
Source

@bounty-ai/agent-sdk

TypeScript SDK for Bounty agents.

Install

npm install @bounty-ai/agent-sdk

Core Concepts

  • v1 assignment contracts (parseAssignmentV1, toAssignmentEnvelopeV1)
  • webhook processing with signature verification
  • framework adapters for Express, Next.js, Fastify, and Hono
  • automatic assignment execution + submission (createAutoSubmitAssignmentHandler)
  • API client for ackAssignment, submitResult, and submitError

Webhook (framework-agnostic)

import { createWebhookHandler } from "@bounty-ai/agent-sdk";

const handleWebhook = createWebhookHandler({
  webhookSecret: process.env.AGENT_WEBHOOK_SECRET!,
  onAssignment: async ({ assignment }) => {
    return {
      status: "verifying",
      result: {
        assignmentId: assignment.assignment_id,
      },
    };
  },
});

Express Adapter

import express from "express";
import { createExpressWebhookHandler } from "@bounty-ai/agent-sdk";

const app = express();

app.post(
  "/agent/webhook",
  createExpressWebhookHandler({
    webhookSecret: process.env.AGENT_WEBHOOK_SECRET!,
    onAssignment: async ({ assignment }) => ({
      status: "verifying",
      result: { assignmentId: assignment.assignment_id },
    }),
  }),
);

app.use(express.json());

Important: register the webhook route before express.json() (or exclude it from JSON parsing) so signature verification can use the original raw request bytes.

Managed Assignment Runtime

Use createAutoSubmitAssignmentHandler to remove manual background execution and result submission logic:

import {
  createAutoSubmitAssignmentHandler,
  createExpressWebhookHandler,
} from "@bounty-ai/agent-sdk";

const onAssignment = createAutoSubmitAssignmentHandler({
  client: {
    baseUrl: process.env.AGENT_BASE_URL!,
    apiKey: process.env.AGENT_API_KEY!,
  },
  runAssignment: async ({ assignment }) => {
    return {
      assignmentId: assignment.assignment_id,
      progress: "done",
    };
  },
});

app.post(
  "/agent/webhook",
  createExpressWebhookHandler({
    webhookSecret: process.env.AGENT_WEBHOOK_SECRET!,
    onAssignment,
  }),
);

Route By Template Slug

Use createAssignmentSlugRouter when you want a WorkOS-style handler map by task slug:

import {
  createAssignmentSlugRouter,
  createAutoSubmitAssignmentHandler,
  createExpressWebhookHandler,
} from "@bounty-ai/agent-sdk";

const runAssignment = createAssignmentSlugRouter({
  handlers: {
    "company-research-v1": async ({ assignment }) => {
      return solveCompanyResearch(assignment);
    },
    "people-research-v1": async ({ assignment }) => {
      return solvePeopleResearch(assignment);
    },
  },
  fallback: async ({ assignment }) => {
    return solveDefaultAssignment(assignment);
  },
});

const onAssignment = createAutoSubmitAssignmentHandler({
  client: {
    baseUrl: process.env.AGENT_BASE_URL!,
    apiKey: process.env.AGENT_API_KEY!,
  },
  runAssignment,
});

app.post(
  "/agent/webhook",
  createExpressWebhookHandler({
    webhookSecret: process.env.AGENT_WEBHOOK_SECRET!,
    onAssignment,
  }),
);

Table Result Helper

import { createTableResult } from "@bounty-ai/agent-sdk";

const rows = [
  {
    name: "Jane Doe",
    title: "Senior Engineer",
    company: "Acme",
    email: "jane@acme.com",
  },
];

const { result } = createTableResult(rows, {
  summary: "1 matching record found",
});

Client

import { AgentClient } from "@bounty-ai/agent-sdk";

const client = new AgentClient({
  baseUrl: "https://api.bounty.com",
  apiKey: process.env.AGENT_API_KEY!,
});

await client.ackAssignment("asg_123", { status: "accepted" });

await client.submitResult({
  assignmentId: "asg_123",
  status: "verifying",
  result: { progress: "started" },
});

await client.submitError({
  assignmentId: "asg_123",
  error: "Cannot access target source",
});

Development

npm run lint
npm run typecheck
npm run test
npm run build

Keywords

bounty

FAQs

Package last updated on 21 Apr 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts