Human-to-Agent Protocol — Core transport, types, validation, presence, and sanitization for agent backends with adapters for LangGraph and Vercel AI
H2A Protocol is a custom agent communication protocol, not an MCP server. It defines 19 tools for bidirectional agent-client messaging, session management, and protocol validation. Critical issues: (1) Tool names lack action verbs, 'sendFrame', 'sendPresence', 'handleSignal' use camelCase instead of verb_noun convention; (2) Most parameter descriptions are minimal (10-30 chars), below the 50-200 char baseline for LLM-optimized descriptions; (3) No output schemas documented for any tool, responses are opaque; (4) Error handling is absent, no recovery guidance, categorization, or actionable error messages; (5) Security concerns: session IDs passed as parameters, no permission gates, no audit trail patterns. Tools like 'createH2AHandler' and 'H2ALangGraphBridge.processStream' are infrastructure utilities, not user-facing agent tools. The mock agent and test suite are testing utilities, not production tools.
Connect to an H2A agent endpoint and establish a session
Send a user signal (message or interrupt) to the agent
Process LangGraph event stream and convert to H2A frames
Check if a presence state transition is valid
Transition presence state with validation and trigger tracking
Close a session and clean up resources
Create an HTTP handler for LangGraph agents via H2A protocol
Create a deterministic mock H2A agent for testing with 4 scenarios
No output schemas documented for any tool. LLMs cannot plan downstream calls or extract required fields without knowing response structure.
Tool names use camelCase (sendFrame, handleSignal) instead of verb_noun convention (send_frame, handle_signal). Violates LLM naming conventions and reduces discoverability.
Parameter descriptions are minimal (10-35 chars), far below the 50-200 char baseline. Descriptions like 'Session identifier' and 'Frame content payload' lack context for LLM selection and usage.
| Scored | Grade | Overall | Spec posture | Rubric |
|---|---|---|---|---|
| 2026-09-23 | F | 34 | 2026-07-28+ | v2 |
Handle session.open or session.resume requests and establish SSE connection
Process a user signal (message or interrupt) from the client
Run H2A protocol conformance tests against an endpoint
Sanitize frame content to prevent injection attacks
Sanitize HTML content to prevent XSS attacks
Send an agent frame (text, tool_card, progress, error, end) to the client with sequence tracking
Send a presence state update (rest, conversing, thinking, etc.) with trigger and confidence
Validate an agent card against H2A schema
Validate an agent frame against H2A schema
Validate an H2A message against schema
Validate a user signal against H2A schema
No error handling guidance. Tools provide no recovery hints, error categorization, or actionable messages. LLMs cannot self-correct on failures.
Session IDs exposed as tool parameters. Credentials and session tokens should use server-side injection, not parameter passing, to prevent leakage into logs and traces.