Skip to content

8. Extensibility and Customization - HugAI v2 Specification

This section describes how the HugAI v2 protocol can be extended and customized to adapt to new needs, agents, capabilities, and scenarios.


8.1. Principles of Extensibility

  • The protocol is designed to be modular and evolutionary.
  • It allows the addition of new message types, capabilities, agents, and workflows without breaking existing compatibility.
  • It is recommended to follow naming conventions and document all extensions.

8.2. Adding New Message Types or Capabilities

  • New messages: Additional methods can be defined following the JSON-RPC scheme, for example: agent/customAction, tool/notify, etc.
  • New capabilities: Agents can announce additional capabilities in their registration (capabilities), for example: "code-review": true.
  • New agents: Simply register the agent and its capabilities, following the standard flow.

8.3. Extension Example (Custom Message)

Definition of a new message for security analysis:

{
  "jsonrpc": "2.0",
  "method": "agent/securityScan",
  "params": {
    "target": "main.ts",
    "level": "deep"
  },
  "id": 10
}

The agent can announce the new capability:

{
  "agentId": "security-agent-1",
  "capabilities": { "security-scan": true }
}


8.4. Best Practices for Extension and Compatibility

  • Use clear prefixes for custom methods (agent/, tool/, governance/, etc.).
  • Document each extension and its purpose.
  • Maintain backward compatibility whenever possible.
  • Validate extensions before deploying them in critical environments.
  • Share useful extensions with the community for possible standardization.

8.5. Interoperability and Modularity

  • Extensions should be optional and negotiable between agents and the system.
  • Agents are recommended to ignore unknown messages/fields unless they are critical.
  • Modularizing capabilities and workflows facilitates integration with other systems and protocol evolution.

Note: Extensibility is key to the evolution of the protocol. It is recommended to keep a record of extensions and promote interoperability between implementations.