DOCS · SDK

SDK

SDKs are convenience layers for generating ACC-compatible tool specs, signing visitor tickets, verifying hub signatures, implementing authz probes, and calling hub APIs. The stable integration contract remains OpenAPI + x-agent-capability + HMAC.

Available SDKs

PHP / PHP 7

Annotation or builder-based tool specs, tickets, tool call verification, callback verification, authz probes, and HubClient.

Node / Python

Builders for tool specs, tickets, HMAC verification helpers, authz probes, and HubClient.

Java / Go / .NET

Reference backend SDKs for enterprise stacks, implemented with standard libraries.

Any language

Publish OpenAPI with x-agent-capability ACC metadata and implement HMAC verification. No official SDK is required.

Install

GETPHP SDK package from your hub
curl -O {hub}/connect/bailing-connect-php.tgz
curl -O {hub}/connect/bailing-connect-php7.tgz
NPM@bailinghub/connect
npm install @bailinghub/connect
PIPbailing-connect
pip install bailing-connect
REFJava / Go / .NET
sdk/java
sdk/go
sdk/dotnet

Serve a protected or public spec with PHP / PHP 7

PHP 8+ and PHP 7.3+ expose the same SpecServer runtime API. The console exposes exactly two configurable policies, signed_required and public_allowed. New URL providers default to the former; select the latter only when catalog disclosure is intentional.

PHPBare PHP: choose one mode
use Bailing\Connect\SpecServer;

// Protected. Verifies the provider secret and emits private, no-store.
SpecServer::respond($spec, $toolProviderSecret);

// Explicitly public. Use instead of the line above with public_allowed.
SpecServer::respondPublic($spec);
PHPFramework route: preserve response headers
// Protected
[$status, $body] = SpecServer::handle(
    $spec, $toolProviderSecret, $method, $originalPathWithQuery, $requestHeaders
);
$responseHeaders = SpecServer::responseHeaders($toolProviderSecret);
// Apply every $responseHeaders entry to the framework response before sending it.

// Explicitly public; choose instead of the protected call above.
[$status, $body] = SpecServer::handlePublic(
    $spec, $method, $originalPathWithQuery, $requestHeaders
);

The older handle(..., null, ...) and respond(..., null, ...) forms remain compatible, but explicit public helpers keep intent visible in code. Existing older SDKs remain wire-compatible; after upgrading the hub, download the refreshed PHP package or at least add Cache-Control: private, no-store manually to protected responses.

Plain HTTP without the PHP SDK

Any language can serve a spec. A signed_required endpoint verifies the same sha256= HMAC used for tool calls. A spec fetch is GET, with an empty body, empty on-behalf-of subject, and empty job id.

GET/bailing/tools.json
X-Bailing-Timestamp: <unix-seconds>
X-Bailing-Signature: sha256=<hex-hmac-sha256>

canonical = "<ts>.GET.<path?query>.<sha256hex(empty-body)>.."
signature = "sha256=" + HMAC_SHA256(tool_provider_secret, canonical)
RequestProtected endpointPublic endpoint
Validly signed GET2xx with valid OpenAPI plus Cache-Control: private, no-store2xx with valid OpenAPI
Unsigned GETPrefer 401; 403 or 404 may hide the endpoint2xx with valid OpenAPI
Invalidly signed GETPrefer 401; 403 or 404 may hide the endpointHandle as a public request

New policies do not follow 3xx redirects, so configure the final URL. A request exceeding 10 seconds, a positive body over 5 MiB, an invalid spec, or inconclusive negative probes causes the hub to reject the refresh and preserve the old catalog.

Node example

JSTool spec builder
import { buildOpenApiSpec, param, tool } from '@bailinghub/connect';

export default buildOpenApiSpec({
  title: 'CRM Tools',
  version: '1.0.0',
  authzProbe: { method: 'POST', path: '/.well-known/bailing/authz-probe' },
  tools: [
    tool({
      name: 'member_query',
      method: 'GET',
      path: '/api/members/{id}',
      description: 'Query member profile',
      scope: 'member.read',
      requiresSubject: true,
      params: [param('id', { in: 'path', required: true, description: 'Member ID' })],
    }),
  ],
});

Common helper surface

Method names follow each language's style, but the capability surface is intentionally aligned.

CapabilityPHPNodePythonJava / Go / .NET
Tool specannotations / builderbuildOpenApiSpecbuild_openapi_specBuildOpenApiSpec
Visitor ticketTicket::signsignTicketsign_ticketSignTicket
Tool call verificationVerify::gateverifyToolCallverify_tool_callVerifyToolCall
Callback verificationVerify::callbackverifyCallbackverify_callbackVerifyCallback
Authz probeSpecServer::authzProbeauthzProbeResponseauthz_probe_responseAuthzProbeResponse
Hub APIsHubClientHubClientHubClientHubClient

Verification rule

Every write-capable business tool should verify the hub signature, timestamp freshness, tool name, job id, and the on-behalf-of subject before applying business authorization. Signature verification proves the request came from the hub; business authorization still belongs to your backend.