What you’re building
Step 1: Create the project
Click New Project. Name it Care Coordination.Step 2: Author the workflow
In chat:“I need a workflow that an AI care coordination agent can invoke on Dr. Patel’s behalf. The workflow should: look up the patient’s current care plan, check for any open care gaps, book a follow-up appointment if there’s a gap, update the EHR chart with the action taken, and notify the care team in Slack. The agent should be able to do this without Dr. Patel being at her keyboard.”The system:
- Asks: “I’ll make this an agent-callable workflow — accessible to an
AgentCalleracting under Dr. Patel’s authority. Does that sound right?” → Confirm. - Creates a
care_planentity with fields:patient_id,open_gaps,last_reviewed,next_appointment,status - Creates the care coordination workflow with trigger: agent invocation
- Compiles steps: look up care plan → check for open gaps → condition → book appointment (scheduling integration) → update chart (EHR integration) → notify care team (Slack integration)
Step 3: Add the integrations
Add three integrations in Settings → Integrations:- EHR API — Custom HTTP, base URL:
https://ehr.acme-health.com/fhir/r4, Bearer auth - Scheduling — Custom HTTP, base URL:
https://schedule.acme-health.com/api, API key auth - Slack — Slack incoming webhook, workspace: Acme Health, channel:
#care-team
Step 4: Issue an agent credential
Register the agent and issue it a credential under Dr. Patel’s authority — via Settings → Agent Access or the Agents API:- Register
CareCoordinatorAgentand note itsagent_id. - Issue a credential with an
expires_atand the grants the automation needs — at minimum aworkflow.invokegrant naming this workflow, since A2A invocation requires it. - Copy the plaintext secret once (
hasp_agt_live_...). Store it in your agent’s secret manager.
The runtime also accepts a plain org API key (
hasp_api_live_*), but that carries no delegating user, no expiry, and no per-issuance revocation handle — so the audit chain cannot record who the agent acted for. Prefer a delegated credential.Step 5: Simulate an agent invocation
From the test/run console (the center pane for headless workflows), compose a trigger payload matching what you will later send as JSON-RPCparams on A2A:
Step 6: Inspect the trace
The trace shows:credential_validate— credential valid and unexpired; org matches runtime subdomain; delegating user resolvedentity_read— looked up care plan forpat_01JA7QG2. Found 1 open care gap: annual diabetes screening overdue.condition—open_gaps > 0→ truebook_appointment— sandbox: “would have booked follow-up appointment on 2026-05-15 at 10:00 AM.”update_ehr— sandbox: “would have updated EHR chart with note: Follow-up booked for diabetes screening.”entity_write— care plan updated:status: follow_up_scheduled,next_appointment: 2026-05-15notify_slack— sandbox: “would have posted to #care-team: Patient [anonymized] follow-up scheduled.”
Step 7: Release and connect the agent
After release, the workflow is live. Configure theCareCoordinatorAgent with a delegated agent credential (see A2A protocol and Issuing credentials). Discover the exact JSON-RPC URL from GET https://acme.usehasp.run/.well-known/agents.json: each capability card includes an endpoint field — POST to that URL (not a separate invocation_url field).
Audit trail
Every invocation produces an audit record:- Org,
agent_id,credential_id, delegating user, workflow, and run identifiers - Full execution trace with step-level inputs and outputs
- EHR API payload and response (PHI-processed)
- Slack notification content (anonymized)
- Care plan entity mutation with before/after values
kill terminates in-flight runs, drain lets them finish and refuses new ones (see Revocation).
What changes between shifts
Issue a fresh credential per shift against the sameagent_id: one persistent agent identity, many short-lived issuances. The agent configuration picks up the new secret; revoke the previous credential when the shift ends. Because expires_at is required, a forgotten credential expires on its own.
Extending the example
- Multi-agent delegation: the
CareCoordinatorAgentdelegates a sub-task (e.g., medication reconciliation) to aMedRecAgentwith a narrower scope credential — entity read only, no EHR write, no scheduling. - Escalation: add a step that checks if the agent’s scope is insufficient for the action required and escalates to a human via the on-call notification integration.
- Approval gate: for actions above a risk threshold, require a human approval step in the workflow before the EHR write executes.