We use essential cookies for the website to function, as well as analytics cookies for analyzing and creating statistics of the website performance. To agree to the use of analytics cookies, click "Accept All". You can manage your preferences at any time by clicking "Cookie Settings" on the footer. More Information.

Only Essential Cookies
Accept All

On-Device A2A Framework Overview

When to Use

As intelligence continues to evolve, an increasing number of apps need to support intelligent interaction and cross-app collaboration. Interactions between traditional apps usually require predefined tightly coupled interfaces, which incur high development costs and poor scalability. Starting from API version 24, the on-device agent framework (on-device A2A) provides a standardized communication and interaction mechanism for agents. This framework extends the on-device capabilities of HMAF (Harmony Agent Framework) and supports the unified A2A protocol specification and on-device-cloud interoperation.

Take the "travel planning" composite task scenario as an example. The collaboration process of each component is as follows:

  • Client scheduling: The intelligent assistant, acting as the Agent client, captures the user intent (for example, "Help me plan tomorrow's travel itinerary").

  • Dynamic service discovery: The system automatically discovers and connects to multiple Agent servers, such as "weather query", "flight booking", and "hotel recommendation".

  • Multi-skill collaborative closed loop: Each server performs capability description, data exchange, and security authentication through the A2A protocol, without needing to know each other's implementation details in advance. Heterogeneous independent skills are dynamically combined to collaboratively complete complex end-to-end business loops.

Basic Concepts

  • Agent: An app component that can autonomously execute tasks and provide intelligent services.

  • A2A protocol: An Agent-to-Agent open protocol that defines the specifications for standardized communication and collaboration between agents, including mechanisms such as capability description, data exchange, security authentication, and skill invocation.

  • AgentCard: Describes the capabilities and skills of an agent. It contains the agent's basic information, capability description, and skill list.

  • AgentSkill: Represents a specific function that an agent can execute. Each skill defines its purpose, tags, input/output patterns, and usage examples, and supports multi-skill composition.

Take the "travel planning" scenario as an example: a travel assistant agent can contain multiple agent skills such as "flight query", "hotel booking", and "attraction recommendation". Each skill describes its input/output specifications to other agents through the agent card. Other agents (such as a voice assistant) read the agent card through the A2A protocol to learn which skills the agent provides and how to invoke them, thereby achieving automated task coordination.

Working Mechanism

The on-device agent framework adopts a client-server architecture and communicates and collaborates through the Agent management service based on the A2A protocol. The overall working mechanism is as follows:

  • Capability registration: Developers configure the AgentCard in agent_config.json to describe the agent's name, description, skill list, input/output schema, and other information. The Agent management service manages this registration information.

  • Connection establishment: A system app (Agent client) establishing a communication channel.

  • A2A communication: After the connection is established, the client and server perform bidirectional data communication through standardized interfaces. The client The server receives and processes data in the onData() callback, and then sends data to the client through the sendData() method of AgentHostProxy.

  • Security authentication (optional): The client and server support bidirectional security authentication to ensure that both communicating parties are trusted. The client, and the server processes the authentication request in the onAuth() callback, then replies to the client through the authorize() method of AgentHostProxy.

  • Result rendering (optional): The server can display the agent's UI in the client app through AgentUIExtensionAbility, delivering a rich interactive experience.

  • Disconnection: After the task is complete, the client to disconnect from the server.

Figure 1 Agent architecture diagram

Search in Guides
Enter a keyword.