Skip to content

FHIR Context With A2A

Agents that support A2A can indicate that they require FHIR context. This is primarily handled by implementing the extensions feature of the A2A specification.

Extension Declaration

For agents that are configured with FHIR context, the extension with uri https://app.promptopinion.ai/schemas/a2a/v1/fhir-context.

This is how the agent card will look like:

json
{
  "capabilities": {
    "extensions": [
      {
        "uri": "https://app.promptopinion.ai/schemas/a2a/v1/fhir-context",
        "description": "FHIR context allowing the agent to query a FHIR server securely",
        "required": false
      }
    ]
  }
}

The extension is a resolvable url. It directs you to JSON schema that indicates how FHIR context will be passed to the A2A agent.

FHIR Context Payload

When a message is sent to an agent that supports this extension PromptOpinion will include the FHIR context in the message payload:

json
{
  "jsonrpc": "2.0",
  "method": "SendMessage",
  "params": {
    "message": {
      "role": "user",
      "parts": [
        {
          "text": "Hello World!"
        }
      ],
      "metadata": {
        "https://app.promptopinion.ai/schemas/a2a/v1/fhir-context": {
          "fhirUrl": "https://app.promptopinion.ai/api/workspaces/abc123/fhir",
          "fhirToken": "eyJ...",
          "patientId": "abc123"
        }
      }
    }
  }
}

The FHIR context will include the url to the FHIR server, the token required to authorize with the server, and a patient id.

NOTE

At this time, we support v0.3 of the a2a protocol. There has been some changes to extensions in v1, namely the extension metadata is included as part of the params object of the payload, rather than the message object. This will be updated in a future release.