Skip to main content
HASP AI Studio supports agent-to-agent (A2A) workflows: external agents and services invoke published agent-callable workflows over HTTPS on your org runtime host (*.usehasp.run). Discovery is public; invocation is authenticated.

The AgentCaller (substrate model)

Every caller in the HASP system — human, API key, or agent — is classified for audit and policy. The agent caller type is AgentCaller (OAuth 2.1 + RAR–aligned credentials under delegated human authority per ADR-3RWY4P):
AgentCaller is distinguished by three properties that the others lack:
  1. Delegating user — the human whose authority the agent acts under. Audit liability flows here.
  2. Granted scopes — an explicit, bounded set of what the agent is authorized to do. Not “whatever seems right.”
  3. Delegation chain — when an agent delegates to another agent, the full chain of authority is captured and preserved.

Authentication for POST /a2a/...

The A2A route accepts either credential type as a bearer token:
In both cases the token’s org must match the runtime subdomain org (acme.usehasp.run → org acme), and the caller must hold the workflow.run capability. An org API key gets it from the workflow:invoke or control:workflows scope; an agent credential gets it from a workflow.invoke grant. A credential whose grant names specific workflow_ids may invoke only those. Any failure is rejected with JSON-RPC -32002. Issue and rotate agent credentials through the Agents API or Settings → Agent Access; create org API keys under Settings → API Keys. Invoke against the endpoint URL from /.well-known/agents.json (see below).
Prefer a delegated agent credential (hasp_agt_*) for agent traffic: it carries the delegating user, an expiry, and a revocation handle, so the audit chain records who the agent acted for. An org API key carries none of that.

AgentCaller credential shape (ADR-3RWY4P)

A credential issuance includes: See Issuing credentials for the request/response shape and Revocation for kill vs. drain semantics.

Scope grants

Resource-action scope types describe the RAR-style grants attached to an AgentCaller credential — see Scope grants for the full grammar and constraint syntax.

Agent-callable workflows

In AI Studio, a workflow with audience Agent-callable can be listed in discovery and invoked via A2A. Author it in chat:
“Create a workflow that can be invoked by an agent to look up a patient’s current status and return the summary.”
When a client calls POST /a2a/{project_slug}/{workflow_slug}, the platform:
  1. Resolves the bearer token to a caller, ensures its org matches the request’s org subdomain, and requires the workflow.run capability.
  2. Resolves the workflow, then narrows against the credential’s granted workflow_ids if it names any.
  3. Runs policy, PHI guard, and audit as for other gateway executions.
  4. Dispatches the workflow run and returns a JSON-RPC result (or error).
Invocation metadata — including the caller identity and, for a delegated agent credential, the delegating user and delegation chain — is recorded in the audit chain for compliance review.

Capability discovery

Public org-level discovery is served on your runtime host, not on api.usehasp.com. No authentication is required.
The response matches what the platform serves today (CapabilityDiscoveryController): top-level org_id, org_slug, and an agents array of capability cards (not the older TypeSpec AgentsDiscoveryDocument sample shape). Illustrative example:
Only agent-callable workflows in org-visible projects appear. The manifest is cacheable (Cache-Control: public, max-age=300); send If-None-Match against the response ETag for conditional requests. Use each card’s endpoint as the JSON-RPC URL.

Invoking a workflow (JSON-RPC 2.0)

V1 contract: the JSON-RPC method must be the literal string "invoke". Workflow-specific names are not accepted as method (other values yield JSON-RPC -32601). Pass workflow inputs inside params.
Long-running workflows may return a run identifier for polling; trace APIs on the Internal API cover run inspection.

Multi-agent delegation

Under the AgentCaller model, an agent can delegate to another agent for a sub-task. The delegating agent’s credential produces a child credential bounded by its own scopes. The delegation chain is preserved and audited.
The chain is recorded on the child credential’s delegation_chain and emitted as a handoff event in the audit chain. agent.delegate carries a max_chain_depth (1–10); exceeding it fails with AGENT_DELEGATION_CHAIN_DEPTH_EXCEEDED.

Standards alignment

HASP’s agent identity layer aligns with:
  • OAuth 2.1 — delegated authorization for agent credentials
  • Rich Authorization Requests (RAR) — structured scopes
  • MCP authorization specification — agent-to-server patterns
External products should consume these standards; prefer AgentCaller credentials over org-wide API keys for sensitive agent flows.

Revoking access

Revoke an agent credential per issuance via POST /v1/agents/{agent_id}/credentials/{credential_id}/revoke or from Settings → Agent Access. Revocation supports kill (terminate in-flight runs) and drain (let in-flight runs finish, refuse new ones) — see Revocation. Org API keys are rotated or revoked in Settings → API Keys. New invocations fail immediately with an invalid key; in-flight runs started before revocation complete normally.