A2A Protocol

The HMS4all A2A (Agent-to-Agent) endpoint enables structured agent communication via JSON-RPC. 26 skills with task persistence and keyword-based automatic routing.


Agent Card

The agent card is discoverable at the standard Well-Known URL:

GET https://your-api.hms4all.com/.well-known/agent.json

{
  "name": "HMS4all Hospital Management AI",
  "description": "Multi-tenant hospital management platform with specialized AI agents",
  "version": "1.0.0",
  "url": "https://your-api.hms4all.com",
  "capabilities": { "streaming": true },
  "authentication": { "schemes": ["bearer"] },
  "skills": [ ... ]
}

Sending a Task

curl -X POST https://your-api.hms4all.com/a2a \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer hms4all_sk_your_api_key" \
  -d '{
    "jsonrpc": "2.0",
    "method": "tasks/send",
    "id": "req-1",
    "params": {
      "id": "task-unique-id",
      "message": {
        "role": "user",
        "parts": [
          { "type": "text", "text": "Analyze these lab results: CBC Hb 10.2, WBC 12000" }
        ]
      }
    }
  }'

Skill Routing

When you send a task, the system automatically routes to the best skill using keyword matching on the message text. You can also specify a skill explicitly in the task metadata:

{
  "params": {
    "id": "task-002",
    "metadata": { "skillId": "lab-interpretation" },
    "message": {
      "role": "user",
      "parts": [{ "type": "text", "text": "..." }]
    }
  }
}

Task Lifecycle

SUBMITTED → WORKING → COMPLETED
                    → FAILED
                    → INPUT_REQUIRED (HITL skills)
  • SUBMITTED: Task received, routing to skill
  • WORKING: Skill is processing
  • COMPLETED: Result available in response
  • FAILED: Error during processing
  • INPUT_REQUIRED: HITL skills — human review needed. Send follow-up with actionId to check status

Task Persistence

All tasks are persisted in the database. You can retrieve a task at any time:

{
  "jsonrpc": "2.0",
  "method": "tasks/get",
  "id": "req-2",
  "params": { "id": "task-unique-id" }
}

Skill Reference

26 skills organized by category. All output JSON.

Architecture (1 skill)

Skill IDNameInputHITL
hospital-designHospital ArchitectTEXTNo

Billing (3 skills)

Skill IDNameInputHITL
billing-checkBilling Health CheckTEXTNo
billing-summaryBilling SummaryJSONNo
cost-estimationCost EstimatorTEXT, JSONNo

Clinical (2 skills)

Skill IDNameInputHITL
clinical-decisionClinical Decision SupportTEXT, JSONNo
clinical-notesClinical ScribeTEXTNo

Hospital-setup (1 skill)

Skill IDNameInputHITL
department-planningDepartment PlannerTEXT, JSONNo

Hr (1 skill)

Skill IDNameInputHITL
roster-generationSmart Roster GeneratorJSONNo

Human-in-the-Loop (3 skills)

Skill IDNameInputHITL
admit-patientAdmit Patient (HITL)JSONHITL
discharge-patientDischarge Patient (HITL)JSONHITL
prescribe-medicationPrescribe Medication (HITL)JSONHITL

Monitoring (1 skill)

Skill IDNameInputHITL
vitals-assessmentVitals MonitorTEXT, JSONNo

Operations (2 skills)

Skill IDNameInputHITL
bed-availabilityBed AvailabilityJSONNo
queue-statusOPD Queue StatusJSONNo

Pathology (1 skill)

Skill IDNameInputHITL
lab-interpretationLab InterpreterTEXT, JSONNo

Pharmacy (2 skills)

Skill IDNameInputHITL
pharmacy-scanPharmacy Expiry ScannerJSONNo
stock-checkPharmacy Stock CheckJSONNo

Radiology (1 skill)

Skill IDNameInputHITL
radiology-qaRadiology QATEXT, JSONNo

Reception (3 skills)

Skill IDNameInputHITL
appointment-managementAppointment ManagementJSONNo
patient-lookupPatient LookupTEXT, JSONNo
registration-parserRegistration ParserTEXTNo

Setup (1 skill)

Skill IDNameInputHITL
onboarding-chatOnboarding AssistantTEXTNo

Support (3 skills)

Skill IDNameInputHITL
get-fix-proposalGet Code Fix ProposalTEXT, JSONNo
support-querySupport AssistantTEXTNo
support-triageSupport Ticket TriageTEXT, JSONNo

Surgical (1 skill)

Skill IDNameInputHITL
ot-protocolOT Protocol VerifierJSONNo

HITL Skills Flow

HITL skills use INPUT_REQUIRED state to pause for human review:

  1. Send task with clinical data (e.g., prescription items)
  2. Skill creates an AgentAction and returns INPUT_REQUIRED with actionId
  3. Human reviews in the admin dashboard → approves or rejects
  4. Send follow-up task with {"actionId":"..."} to check result
  5. Returns COMPLETED with final status (APPROVED/REJECTED/PENDING)

Interactive Skill Tester

A2A Skill Tester

Error Handling

// JSON-RPC error response
{
  "jsonrpc": "2.0",
  "id": "req-1",
  "error": {
    "code": -32600,  // Invalid request
    "message": "..."
  }
}

// Codes:
// -32700 Parse error
// -32600 Invalid request
// -32601 Method not found
// -32000 Server error

Next Steps