DEV Community

Cover image for Building AI Agents in A2A and MCP: 5 Live Demos to Get You Started
vishalmysore
vishalmysore

Posted on

Building AI Agents in A2A and MCP: 5 Live Demos to Get You Started

Hey there! 👋 I'm excited to show you how to build AI agents using a2ajava, an open-source framework I created to make agent development fun and accessible. Instead of diving into theoretical stuff, let me walk you through 5 real, working agents I've built and deployed. Each demonstrates different aspects of what you can do with a2ajava.

What's a2ajava All About?

I built a2ajava because I wanted to make it super easy for developers to create AI agents without getting bogged down in protocol details. Whether you're into A2A or MCP protocols, a2ajava handles all the complexity so you can focus on building cool stuff.

🛠️ Quick Overview

  • Open source and community-driven
  • Works with both A2A and MCP protocols out of the box
  • Write your agents in Java, Kotlin, or Groovy
  • Plays nice with Gemini, OpenAI, Claude, and Grok
  • Simple annotation-based development

Let's Look at Some Real Agents!

1. Basic Spring Agent

🔗 Try it Live

This is the simplest agent I've built - perfect for getting started. It shows how to turn regular Spring services into AI agents with just a few annotations.

# Give it a try! List available tools:
curl -H "Content-Type: application/json" -d '{
    "jsonrpc": "2.0",
    "method": "tools/list",
    "params": {},
    "id": 1
}' https://vishalmysore-a2amcpspring.hf.space/
Enter fullscreen mode Exit fullscreen mode

2. Multi-User Agent with Security

🔗 Try it Live

This one's cool - it shows how to handle different users and permissions. I built it to demonstrate how:

  • Different users can access different tools
  • @PreAuthorize annotations control access
  • agent.json changes based on who's asking
  • You can connect from Python or Java clients

3. Database Whisperer Agent

🔗 Try it Live

This is probably my favorite demo - it turns database operations into natural language conversations. Check this out:

# Create a database using plain English!
curl -u admin:admin -H "Content-Type: application/json" -d '{
    "jsonrpc": "2.0",
    "method": "tools/call",
    "params": {
        "name": "createDatabase",
        "arguments": {
            "provideAllValuesInPlainEnglish": {
                "name": "cookgpt"
            }
        }
    },
    "id": 25
}' https://vishalmysore-a2amcpdatabase.hf.space/
Enter fullscreen mode Exit fullscreen mode

4. MongoDB RAG Agent

🔗 Try it Live

Ever wanted to build a RAG system with MongoDB? This agent shows how! Features I'm particularly proud of:

  • Vector search for semantic task matching
  • Stores and retrieves A2A tasks automatically
  • Simple REST API for everything
  • Built with Spring Boot because, why not?

5. Web Automation Agent

🔗 Try it Live

My latest experiment - combining Selenium with AI agents. Use it for:

  • Automated testing
  • Web scraping
  • Browser automation
  • Whatever else you can think of!

Getting Your Hands Dirty

Want to build something similar? It's easier than you think! Here's a super quick start:

  1. Add a2ajava to your project:
<dependency>
    <groupId>io.github.vishalmysore</groupId>
    <artifactId>a2ajava</artifactId>
    <version>0.1.8.2</version>
</dependency>
Enter fullscreen mode Exit fullscreen mode
  1. Turn any class into an agent:
@Agent(groupName = "My Cool Agent")
public class MyAgent {
    @Action(description = "Does something awesome")
    public String doStuff() {
        return "Magic happens here!";
    }
}
Enter fullscreen mode Exit fullscreen mode

Join the Fun!

I'm building a2ajava in the open and would love your help:

What's Coming Up?

I'm working on some exciting stuff:

  • WebSocket support for real-time agents
  • Better LLM integration
  • More examples and templates
  • Whatever cool ideas you bring!

Want to try it out? Head over to any of the live demos or grab the code from GitHub. Can't wait to see what you build! 🚀

Top comments (0)