Agentic Workforce ME Developer PortalDocs 1.1 · Widget 0.1.0

Backend integration

Overview & reference architecture

The closed loop the demo portals implement: signed triggers, MCP tools, signed webhooks and human approvals — who owns what, the security model and a build checklist.

Connecting a backend to Agentic Workforce ME is one closed loop, and the demo portals (Meridian, Dubai Police) all implement the same one: a business event in your system becomes a signed request to the platform; a published workflow or agent runs; the agent reads and writes your data through an MCP server your backend exposes; privileged steps pause for a human; signed webhooks tell your backend what happened. Everything is created by a script so every environment looks the same.

The loop, end to end

Steps 1–2 and 5 are HTTP calls between your servers and the platform; step 3 is the platform calling you; step 4 is a person, in the console or in your UI. Each number links to the page that documents that piece.

Who owns what

AreaThe platform ownsYour backend owns
Identity of callersAPI keys (hashed), roles, tenant isolation with row-level security, audit of every privileged mutation.Keep API keys and secrets server-side; one key per service; rotate by create-switch-revoke.
Inbound eventsVerifies x-hive-signature, maps the body to run input, enqueues the run, records the trigger as the run origin.Sign the raw body with the trigger secret; carry your own record id and an idempotency key in the payload.
Agent behaviourRuns the published manifest: persona, model, tools ∩ grants, guardrails, budgets, HITL rules.Author and publish the agent/workflow; grant only the tools it needs.
Acting on your systemsCalls your MCP tools through the Tool Gateway; decrypts the connection credential per call; validates args against your JSON Schema; redacts inputs/outputs in run steps.Host the MCP server; check the bearer token in constant time; make mutations idempotent; return clear errors.
Human approvalInterrupts the run on matching policies, expires by SLA, escalates, records who decided.Surface pending approvals in your UI and decide through the API with a server-held key, or use the console.
Outbound notificationsSigns and delivers webhooks with retries and a ledger you can read.Verify, de-duplicate on the event id, ACK 2xx quickly, apply asynchronously, tolerate out-of-order delivery.

Security model in one screen

Identity of your servers

  • A tenant API key (Authorization: Bearer hive_… + X-Tenant-Id) identifies your service. Keys are hashed at rest, shown once, act with the admin role and appear as apikey:<id> in the audit log. One key per service; rotate by create → switch → revoke. API keys & authentication

HMAC in both directions

  • You → platform (triggers): x-hive-signature: sha256=<hex>, HMAC-SHA256 of the trigger secret over the raw request body bytes, exactly as sent. There is no timestamp in the signed material, so put your own idempotency key in the payload and make your MCP mutations idempotent. Triggers
  • Platform → you (webhooks): Hive-Signature: t=<unix seconds>,v1=<hex HMAC-SHA256>, HMAC-SHA256 of the endpoint secret over "<t>.<raw body>"; reject anything older than 300 s and de-duplicate on the event id. Webhooks

Credentials never reach a model

  • The bearer token your MCP server expects is stored platform-side as a connection: AES-256-GCM encrypted at rest, decrypted only inside the Tool Gateway for the duration of a call, never returned by the API, never serialised into prompts, run state or checkpoints. MCP
  • Tool grants are default-deny; the agent manifest can only narrow them further. Approval policies interrupt the run itself (a checkpointed interrupt()), so nothing runs while a request is pending. They pause direct agent runs; inside a workflow, gate a step with a gate node instead. Approvals

Everything is audited

Runs and their steps (runs, run_steps with redacted inputs/outputs), model and tool consumption (usage_events), and every privileged mutation, approval decision and credential access (audit_log, append-only). A run started by a trigger records the trigger as its origin; one started by your key records the key.

Build checklist

  1. Create a dedicated API key for the integration and store it with your other secrets.
  2. Publish the agent (and workflow, if you orchestrate) that will handle the event.
  3. Expose an MCP server with the two or three tools the agent needs; protect it with a bearer token.
  4. Register the MCP server, store the token as a connection, grant the tools to the agent.
  5. Put an approval policy on every tool that moves money or changes state irreversibly — and run that agent directly (POST /v1/agents/:id/runs), not as a workflow agent node; inside workflows gate steps with a gate node.
  6. Create a webhook trigger on the workflow/agent; save the once-shown secret; sign requests over the raw body.
  7. Subscribe a webhook endpoint to run.completed, run.failed, approval.requested; verify Hive-Signature; de-duplicate on id.
  8. Store the returned run_id on your record so the completion webhook can find it.
  9. Decide approvals from your UI via a server-side proxy (never ship the key to the browser) or from the console.
  10. Put all of the above in an idempotent setup-hive script and run it in every environment.

A runnable reference

examples/backend-integration-node is a small Express service that does all of the above in about 400 lines: a signed-trigger endpoint, an MCP server with orders.get and orders.refund, a webhook receiver that verifies and de-duplicates, an approvals proxy, and a setup-hive script that provisions the platform side idempotently. The portal’s drift tests execute its signing and verification helpers against the platform’s own signer and verifier.