Skip to content

Phil-Hills/q-protocol

Repository files navigation

Q Protocol (A2AC) — Specification

Protocol Status Type

Agent-to-Agent Communication Protocol for Federated Cognitive Mesh Architectures

The constitutional document of the agent swarm


Specification · Agent Voxel · Coordinate System · Receipts · Implementations


Overview

The Q Protocol (internally: A2AC — AI-to-AI Communication) is a communication standard designed for high-velocity agent mesh architectures. It replaces verbose JSON payloads with minimal hex-coordinate addressing and cryptographic receipts.

The Problem

Traditional agent communication:

{
  "intent": "case_resolution",
  "source_agent": "gcp_service_agent",
  "target_entity": "Case",
  "entity_id": "5001a000001abcDEF",
  "action": "resolve",
  "context": {
    "customer_id": "0011a000002xyzABC",
    "priority": "high",
    "sentiment": "negative"
  },
  "timestamp": "2026-01-15T06:11:19Z"
}

Cost: ~500 tokens per exchange

The Solution

0x600:02:CASE:RSLV:a1b2c3

Cost: ~10 tokens — 98% reduction


Core Metrics

Metric Traditional Q Protocol Savings
Tokens per operation 500 10 98%
Monthly cost (1M ops) $2,500 $50 98%
Latency 2-5 sec <100ms 95%
Storage per message 2KB 40B 98%
Hallucination rate Variable 0% Schema-enforced

Specification

Coordinate Structure

Every Q Protocol message is a hex coordinate with five components:

0x600 : 02 : CASE : RSLV : a1b2c3
  │      │     │      │       │
  │      │     │      │       └── State Hash (8-char verification)
  │      │     │      └────────── Action Code (4-char verb)
  │      │     └───────────────── Entity Code (4-char noun)
  │      └─────────────────────── Space Code (coordination space)
  └────────────────────────────── Base Address (protocol identifier)

Base Address

All Q Protocol messages begin with 0x600 — the protocol identifier.

Space Codes

Code Name Purpose
01 INTENT What the agent wants to do
02 ACTION What the agent is doing
03 STATE Current execution state
04 RECEIPT Proof of completed execution
FF ERROR Error conditions

Entity Codes

Code Entity Platform
CASE Case Salesforce
LEAD Lead Salesforce
ACCT Account Salesforce
KNOW Knowledge Article Salesforce/Data Cloud
FLOW Automation Flow Salesforce
MODL AI Model GCP Vertex AI
VOXEL Agent Voxel Q Protocol

Action Codes

Code Action
READ Query/retrieve
CREA Create new
UPDT Update existing
DELE Delete
RSLV Resolve/complete
ESCL Escalate
INFE Inference
SYNC Synchronize

Agent Voxel

The Agent Voxel is a compressed cognitive profile — the atomic unit of agent state.

Structure (Protobuf)

syntax = "proto3";
package q.protocol;

// The Agent Voxel: A compressed cognitive profile
message AgentVoxel {
  string agent_id = 1;
  string session_id = 2;
  
  // The Latent Space Coordinates
  // Representing intent in the vector space
  repeated float intent_vector = 3 [packed=true];
  
  // Metadata for Mesh Orchestration
  map<string, string> mesh_metadata = 4;
  
  // Verification hash to prevent tampering
  string integrity_hash = 5;
}

JSON Representation

{
  "agentId": "clair_root_agent",
  "sessionId": "sess_abc123",
  "intentVector": [0.123, 0.456, ...],
  "meshMetadata": {
    "source": "salesforce",
    "priority": "high"
  },
  "integrityHash": "sha256:a1b2c3d4e5f6"
}

Receipts

Every action produces a cryptographic receipt, implementing "Silence is Success" methodology.

Structure

{
  "receiptId": "RCPT-c8f1a2b7cc70",
  "coordinate": "0x600:04:CASE:RSLV:a1b2c3",
  "success": true,
  "timestamp": "2026-01-15T06:11:19.539646Z",
  "signature": "7890abcdef123456"
}

Verification

The signature is a SHA-256 hash of receiptId + coordinate + success, truncated to 16 characters. Any agent can verify receipt authenticity without a central authority.


Architecture

Federated Schema-First Polyrepo

┌─────────────────────────────────────────────────────────┐
│              q-protocol (Schema Registry)               │
│                   "The Hub"                             │
│     Protobuf definitions, OpenAPI specs, SDK           │
└────────────────────────┬────────────────────────────────┘
                         │
         ┌───────────────┴───────────────┐
         │                               │
         ▼                               ▼
┌─────────────────────┐       ┌─────────────────────┐
│   GCP Cortex        │       │   Salesforce        │
│   "The Brain"       │       │   "The Ledger"      │
│                     │       │                     │
│  - Vertex AI        │       │  - Agentforce       │
│  - BigQuery         │       │  - Data Cloud       │
│  - Cloud Run        │       │  - Apex/Flow        │
└─────────────────────┘       └─────────────────────┘

Repository Structure

Repository Role Technology
q-protocol Schema Registry (Hub) Protobuf, Python, OpenAPI
gcp-cortex-engine AI Engine (Spoke) Python, Terraform, Dataform
SalesforceAIAdmin CRM Logic (Spoke) Apex, SFDX, Data Cloud

Implementations

Salesforce (Apex)

// Build a coordinate
A2ACProtocol.HexCoordinate coord = A2ACProtocol.buildActionCoordinate(
    'CASE',    // Entity
    'RESOLVE', // Action  
    caseId     // Context for hash
);

// Encode to string
String encoded = coord.encode();
// Result: "0x600:02:CASE:RSLV:a1b2c3"

// Issue a receipt
A2ACProtocol.AgentReceipt receipt = A2ACProtocol.issueReceipt(coord, true);

Full Implementation: Phil-Hills/SalesforceAIAdmin

Python (GCP)

from q_protocol import AgentVoxel, Receipt

# Create a cube
voxel = AgentVoxel(
    agent_id="gcp_analyzer",
    intent_vector=[0.123, 0.456, ...]
)

# Generate receipt
receipt = Receipt.generate(
    action="PROCESS",
    entity="CASE",
    success=True
)

Full Implementation: Phil-Hills/ai-summary-cube


Design Philosophy

"Communication is a Failure Mode"

The best communication is no communication. Agents should:

  1. Know what to do based on coordinates alone
  2. Act without confirmation dialogs
  3. Prove execution with receipts only

"Silence is Success"

No news is good news. If you receive a receipt, the action succeeded. Verbose confirmations waste tokens and introduce latency.


Integration Patterns

Salesforce ↔ GCP (Zero Copy)

Salesforce Data Cloud  ←── Zero Copy ──→  GCP BigQuery
         │                                      │
         ▼                                      ▼
    Agentforce                            Vertex AI
         │                                      │
         └──────── Q Protocol (A2AC) ───────────┘

Real-Time Agent Communication

POST /agents/{agent_name}/run
Content-Type: application/json

{
  "instruction": "Resolve case with priority update",
  "context": {"source": "salesforce"},
  "protocol": "A2AC-v1.2"
}

Response:

{
  "success": true,
  "receipt": "RCPT-c8f1a2b7cc70",
  "result": {
    "coordinate": "0x600:04:CASE:RSLV:a1b2c3"
  }
}

License

MIT — See LICENSE


Author: Phil Hills
Version: 1.2
Identity: PH-SEA-98101 | KERNEL: ACTIVE

Releases

No releases published

Packages

No packages published