{"id":28624945,"url":"https://github.com/a2ap/a2a4j","last_synced_at":"2026-01-14T02:15:46.851Z","repository":{"id":297474923,"uuid":"985535400","full_name":"a2ap/a2a4j","owner":"a2ap","description":"A2A4J is a comprehensive Java implementation of the Agent2Agent Protocol, including server, client, examples, and starters.","archived":false,"fork":false,"pushed_at":"2025-06-24T14:57:27.000Z","size":778,"stargazers_count":34,"open_issues_count":3,"forks_count":15,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-24T15:52:44.866Z","etag":null,"topics":["a2a","a2a-client","a2a-protocol","a2a-server","ai","java","llm","mcp","spring","springboot"],"latest_commit_sha":null,"homepage":"","language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/a2ap.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-05-18T01:16:25.000Z","updated_at":"2025-06-23T10:11:19.000Z","dependencies_parsed_at":"2025-06-05T17:36:15.873Z","dependency_job_id":"77885847-6e10-4d81-bc7d-b4b51228da05","html_url":"https://github.com/a2ap/a2a4j","commit_stats":null,"previous_names":["a2ap/a2a4j"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/a2ap/a2a4j","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/a2ap%2Fa2a4j","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/a2ap%2Fa2a4j/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/a2ap%2Fa2a4j/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/a2ap%2Fa2a4j/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/a2ap","download_url":"https://codeload.github.com/a2ap/a2a4j/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/a2ap%2Fa2a4j/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28408711,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T01:52:23.358Z","status":"online","status_checked_at":"2026-01-14T02:00:06.678Z","response_time":107,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["a2a","a2a-client","a2a-protocol","a2a-server","ai","java","llm","mcp","spring","springboot"],"created_at":"2025-06-12T08:01:23.124Z","updated_at":"2026-01-14T02:15:46.839Z","avatar_url":"https://github.com/a2ap.png","language":"Java","funding_links":[],"categories":["A2A","⚙️ Implementations \u0026 Libraries","人工智能"],"sub_categories":["A2A"],"readme":"# A2A4J - Agent2Agent Protocol for Java\n\n[![Maven Central](https://img.shields.io/maven-central/v/io.github.a2ap/a2a4j)](https://search.maven.org/artifact/io.github.a2ap/a2a4j)\n[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n[![Java Version](https://img.shields.io/badge/Java-17%2B-green.svg)](https://openjdk.org/projects/jdk/17/)\n\n📖 **[中文文档](README_CN.md)**\n\n[Agent2Agent (A2A)](https://github.com/google-a2a/A2A) providing an open standard for communication and interoperability between independent AI agent systems.\n\n[A2A4J](https://github.com/a2ap/a2a4j) A2A4J is a comprehensive Java implementation of the Agent2Agent (A2A) Protocol, including server, client, examples, and starters. Built on Reactor for reactive programming support, A2A4J enables agents to discover each other's capabilities, collaborate on tasks, and securely exchange information without needing access to each other's internal state.\n\n## 🚀 Features\n\n- ✅ **Complete A2A Protocol Support** - Full implementation of the Agent2Agent specification\n- ✅ **JSON-RPC 2.0 Communication** - Standards-based request/response messaging\n- ✅ **Server-Sent Events Streaming** - Real-time task updates and streaming responses\n- ✅ **Task Lifecycle Management** - Comprehensive task state management and monitoring\n- ✅ **Spring Boot Integration** - Easy integration with Spring Boot applications\n- ✅ **Reactive Programming Support** - Built on Reactor for scalable, non-blocking operations\n- ✅ **Multiple Content Types** - Support for text, files, and structured data exchange\n- ⚪️ **Agent Card Discovery** - Dynamic capability discovery mechanism\n- ⚪️ **Push Notification Configuration** - Asynchronous task updates via webhooks\n- ⚪️ **Enterprise Security** - Authentication and authorization support\n\n## 📋 Prerequisites\n\n- **Java 17+** - Required for running the application\n- **Maven 3.6+** - Build tool\n\n## 🏗️ Project Structure\n\n```\na2a4j/\n├── a2a4j-bom/                     # A2A4J dependency management\n├── a2a4j-core/                    # Core A2A protocol implementation\n├── a2a4j-spring-boot-starter/     # Spring Boot auto-configuration\n│   ├── a2a4j-server-spring-boot-starter/   # Server-side starter\n│   └── a2a4j-client-spring-boot-starter/   # Client-side starter\n├── a2a4j-samples/                 # Example implementations\n│   └── server-hello-world/        # Hello World server example\n│   └── client-hello-world/        # Hello World client example\n├── specification/                 # A2A protocol specification\n├── tools/                        # Development tools and configuration\n```\n\n## 🚀 Quick Start\n\n### 1. Use A2Aj Build Agent\n\n#### Integrate A2A4j SDK\n\nIf you’re building on the `SpringBoot` framework, it is recommended to use `a2a4j-server-spring-boot-starter`.\n\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003eio.github.a2ap\u003c/groupId\u003e\n    \u003cartifactId\u003ea2a4j-server-spring-boot-starter\u003c/artifactId\u003e\n    \u003cversion\u003e0.0.1\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\nFor other frameworks, it is recommended to use `a2a4j-core`.\n\n```xml\n\u003cdependency\u003e\n    \u003cgroupId\u003eio.github.a2ap\u003c/groupId\u003e\n    \u003cartifactId\u003ea2a4j-core\u003c/artifactId\u003e\n    \u003cversion\u003e0.0.1\u003c/version\u003e\n\u003c/dependency\u003e\n```\n\n#### Expose an External Endpoint\n\n```java\n@RestController\npublic class MyA2AController {\n\n    @Autowired\n    private A2AServer a2aServer;\n    @Autowired\n    private final Dispatcher a2aDispatch;\n\n    @GetMapping(\".well-known/agent.json\")\n    public ResponseEntity\u003cAgentCard\u003e getAgentCard() {\n        AgentCard card = a2aServer.getSelfAgentCard();\n        return ResponseEntity.ok(card);\n    }\n\n    @PostMapping(value = \"/a2a/server\", produces = MediaType.APPLICATION_JSON_VALUE)\n    public ResponseEntity\u003cJSONRPCResponse\u003e handleA2ARequestTask(@RequestBody JSONRPCRequest request) {\n        return ResponseEntity.ok(a2aDispatch.dispatch(request));\n    }\n\n    @PostMapping(value = \"/a2a/server\", produces = MediaType.TEXT_EVENT_STREAM_VALUE)\n    public Flux\u003cServerSentEvent\u003cJSONRPCResponse\u003e\u003e handleA2ARequestTaskSubscribe(@RequestBody JSONRPCRequest request) {\n        return a2aDispatch.dispatchStream(request).map(event -\u003e ServerSentEvent.\u003cJSONRPCResponse\u003ebuilder()\n                .data(event).event(\"task-update\").build());\n    }\n}\n```\n\n#### Implementing the `AgentExecutor` Interface for Agent Task Execution\n\n```java\n@Component\npublic class MyAgentExecutor implements AgentExecutor {\n\n    @Override\n    public Mono\u003cVoid\u003e execute(RequestContext context, EventQueue eventQueue) {\n        // your agent logic code\n        TaskStatusUpdateEvent completedEvent = TaskStatusUpdateEvent.builder()\n                .taskId(taskId)\n                .contextId(contextId)\n                .status(TaskStatus.builder()\n                        .state(TaskState.COMPLETED)\n                        .timestamp(String.valueOf(Instant.now().toEpochMilli()))\n                        .message(createAgentMessage(\"Task completed successfully! Hi you.\"))\n                        .build())\n                .isFinal(true)\n                .metadata(Map.of(\n                        \"executionTime\", \"3000ms\",\n                        \"artifactsGenerated\", 4,\n                        \"success\", true))\n                .build();\n\n        eventQueue.enqueueEvent(completedEvent);\n        return Mono.empty();\n    }\n}\n```\n\n#### Done\n\nThat’s it — these are the main steps. For detailed implementation, please refer to our [Agent Demo example](./a2a4j-samples/server-hello-world).\n\n### 2. Test Run Agent Example\n\n#### Run the Server Hello World\n\n```bash\ngit clone https://github.com/a2ap/a2a4j.git\n\ncd a2a4j\n\nmvn clean install\n\ncd a2a4j-samples/server-hello-world\n\nmvn spring-boot:run\n```\n\nThe server will start at `http://localhost:8089`.\n\n#### Get Agent Card\n```bash\ncurl http://localhost:8089/.well-known/agent.json\n```\n\n#### Send a Message\n```bash\ncurl -X POST http://localhost:8089/a2a/server \\\n  -H \"Content-Type: application/json\" \\\n  -d '{\n    \"jsonrpc\": \"2.0\",\n    \"method\": \"message/send\",\n    \"params\": {\n      \"message\": {\n        \"role\": \"user\",\n        \"parts\": [\n          {\n            \"kind\": \"text\",\n            \"text\": \"Hello, A2A!\"\n          }\n        ],\n        \"messageId\": \"9229e770-767c-417b-a0b0-f0741243c589\"\n      }\n    },\n    \"id\": \"1\"\n  }'\n```\n\n#### Stream Messages\n```bash\ncurl -X POST http://localhost:8089/a2a/server \\\n  -H \"Content-Type: application/json\" \\\n  -H \"Accept: text/event-stream\" \\\n  -d '{\n    \"jsonrpc\": \"2.0\",\n    \"method\": \"message/stream\",\n    \"params\": {\n      \"message\": {\n        \"role\": \"user\",\n        \"parts\": [\n          {\n            \"kind\": \"text\",\n            \"text\": \"Hello, streaming A2A!\"\n          }\n        ],\n        \"messageId\": \"9229e770-767c-417b-a0b0-f0741243c589\"\n      }\n    },\n    \"id\": \"1\"\n  }'\n```\n\n## 📚 Core Modules\n\n### A2A4J Core (`a2a4j-core`)\n\nThe core module provides the fundamental A2A protocol implementation:\n\n- **Models**: Data structures for Agent Cards, Tasks, Messages, and Artifacts\n- **Server**: Server-side A2A protocol implementation\n- **Client**: Client-side A2A protocol implementation\n- **JSON-RPC**: JSON-RPC 2.0 request/response handling\n- **Exception Handling**: Comprehensive error management\n\n[📖 View Core Documentation](a2a4j-core/README.md)\n\n### Spring Boot Starters\n\n#### Server Starter (`a2a4j-server-spring-boot-starter`)\nAuto-configuration for A2A servers with Spring Boot, providing:\n- Automatic endpoint configuration\n- Agent Card publishing\n- Task management\n- SSE streaming support\n\n#### Client Starter (`a2a4j-client-spring-boot-starter`)\nAuto-configuration for A2A clients with Spring Boot, providing:\n- Agent discovery\n- HTTP client configuration\n- Reactive client support\n\n### Examples (`a2a4j-samples`)\n\nComplete working examples demonstrating A2A4J usage:\n- **[Hello World Server](./a2a4j-samples/server-hello-world)**: Basic A2A4j server implementation\n- **[Hello World Client](./a2a4j-samples/client-hello-world)**: Basic A2A4j client implementation\n\n## 📊 JSON-RPC Methods\n\n### Core Methods\n- `message/send` - Send a message and create a task\n- `message/stream` - Send a message with streaming updates\n\n### Task Management\n- `tasks/get` - Get task status and details\n- `tasks/cancel` - Cancel a running task\n- `tasks/resubscribe` - Resubscribe to task updates\n\n### Push Notifications\n- `tasks/pushNotificationConfig/set` - Configure push notifications\n- `tasks/pushNotificationConfig/get` - Get notification configuration\n\n\n## 📖 Documentation\n\n- [A2A Protocol Specification](specification/specification.md)\n- [Core Module Documentation](a2a4j-core/README.md)\n- [API Reference](a2a4j-core/API_REFERENCE.md)\n- [Hello World Example](a2a4j-samples/server-hello-world/README.md)\n\n## 🤝 Contributing\n\nWe welcome contributions! Please see our [Contributing Guidelines](CONTRIBUTING.md) for details.\n\n1. Fork the repository\n2. Create a feature branch: `git checkout -b feature/my-feature`\n3. Commit your changes: `git commit -am 'Add new feature'`\n4. Push to the branch: `git push origin feature/my-feature`\n5. Submit a Pull Request\n\n## 📄 License\n\nThis project is licensed under the Apache License 2.0 - see the [LICENSE](LICENSE) file for details.\n\n## 🌟 Support\n\n- **Issues**: [GitHub Issues](https://github.com/a2ap/a2a4j/issues)\n- **Discussions**: [GitHub Discussions](https://github.com/a2ap/a2a4j/discussions)\n- **CI/CD**: [GitHub Actions](https://github.com/a2ap/a2a4j/actions)\n\n## 🔗 Refer Projects\n\n- [A2A Protocol Specification](https://google-a2a.github.io/A2A/specification/)\n- [A2A Protocol Website](https://google-a2a.github.io)\n\n---\n\nBuilt with ❤️ by the A2AP Community\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fa2ap%2Fa2a4j","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fa2ap%2Fa2a4j","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fa2ap%2Fa2a4j/lists"}