Sitelet https://github.com/feuyeux/aloha-a2a/tree/main/aloha-java
Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

README.md

Aloha A2A - Java Implementation

A pure Java implementation of the A2A (Agent-to-Agent) protocol with support for three transport modes: gRPC, JSON-RPC, and REST (HTTP+JSON).

Features

  • Three Transport Modes: gRPC, JSON-RPC, and REST (HTTP+JSON)
  • Pure Java + Netty: No framework (no Quarkus / Spring Boot) — just plain Java 21 with Netty
  • LLM Integration: Uses Ollama with qwen2.5 model via Langchain4j
  • Tool Support: Roll dice and check prime numbers
  • A2A SDK: Uses A2A Java SDK v0.3.3.Final (compatible with A2A Protocol v0.3.x)

Port Configuration

Transport Mode Server Port Agent Card URL
gRPC 11000 http://localhost:11001/.well-known/agent-card.json
JSON-RPC 11001 http://localhost:11001/.well-known/agent-card.json
REST (HTTP+JSON) 11002 http://localhost:11002/.well-known/agent-card.json

In gRPC mode, the gRPC service runs on port 11000 while the Agent Card HTTP endpoint runs on http.port (default 11001).

Prerequisites

  • Java 21+
  • Maven 3.9+
  • Ollama running locally (http://localhost:11434) with the qwen2.5 model

Build

cd aloha-java && mvn clean install

# Or use the build script:

cd aloha-java && ./scripts/build

# PowerShell
cd aloha-java ; ./scripts/build.bat

Quick Start with Scripts

Convenience scripts are provided for running servers and clients:

Server Scripts

Script Transport Port
server/scripts/grpc_server gRPC 11000
server/scripts/jsonrpc_server JSON-RPC 11001
server/scripts/rest_server REST 11002

Client Scripts

Script Transport Port
client/scripts/grpc_client gRPC 11000
client/scripts/jsonrpc_client JSON-RPC 11001
client/scripts/rest_client REST 11002

Configuration

All settings are in server/src/main/resources/application.properties. Override any property with -Dkey=value system properties.

Property Default Description
transport.mode grpc Transport: grpc, jsonrpc, or rest
grpc.server.port 11000 gRPC server port
http.port 11001 HTTP port (agent card / JSON-RPC)
rest.port 11002 REST server port
ollama.base-url http://localhost:11434 Ollama API base URL
ollama.model qwen2.5 Ollama model name
ollama.temperature 0.7 LLM temperature
ollama.timeout 60 Ollama timeout (seconds)

Agent Tools

  1. roll_dice(N): Rolls an N-sided dice

    • Example: "Roll a 20-sided dice"
    • Example (Chinese): "投掷一个6面骰子"
  2. check_prime(nums): Checks if numbers are prime

    • Example: "Check if 2, 4, 7, 9, 11 are prime"
    • Example (Chinese): "检查17是否为质数"

References