๐Ÿš€ A2A Scala: AI-Powered Action Framework

May 31, 2025 ยท View on GitHub

Welcome to A2A Scala, a powerful integration of A2AJava's AI capabilities with Scala's elegant syntax and type safety. This project demonstrates how to leverage the A2A (Action to Automation) framework in a Scala environment.

โœจ Features

  • ๐Ÿค– AI-Powered Action Detection
  • ๐Ÿ” Smart Context Understanding
  • ๐ŸŽฏ Automated Task Execution
  • ๐ŸŒ Multi-Platform Support
  • ๐Ÿ“Š Natural Language Processing
  • ๐Ÿ”„ Seamless Integration with OpenAI, Anthropic, and Google's Vertex AI

๐Ÿ›  Tech Stack

  • Scala 2.13.8
  • A2AJava 0.1.8.2
  • Tools4AI 1.1.5
  • Spring Boot (Optional) 3.2.5
  • Google Cloud Vertex AI 0.7.0

๐Ÿš€ Quick Start

  1. Prerequisites

    # Ensure you have SBT installed
    sbt --version
    
  2. Configuration Create tools4ai.properties in src/main/resources:

    # OpenAI Configuration
    openAiKey=your_key_here
    openAiModelName=gpt-4
    
    # Optional: Google Cloud Configuration
    gemini.projectId=your_project_id
    gemini.location=your_location
    gemini.modelName=gemini-pro
    
  3. Run the Application

    sbt run
    

๐Ÿ“ Example Usage

// Create an AI-powered weather agent
@Agent(groupName = "Weather Service", groupDescription = "Provides weather information")
class WeatherAgent {
  @Action(description = "Get temperature for a city")
  def getTemperature(city: String): String = {
    // Your implementation here
    s"The temperature in $city is 25ยฐC"
  }
}

// Process actions using OpenAI
val processor = new OpenAiActionProcessor()
val result = processor.processSingleAction("What's the weather in Toronto?")

๐ŸŒŸ Key Features Explained

AI Action Detection

The framework automatically detects and processes natural language commands, mapping them to appropriate actions using advanced AI models.

Multi-Model Support

  • ๐Ÿค– OpenAI: GPT-4 and GPT-3.5
  • ๐ŸŒ Google Vertex AI: Gemini Pro
  • ๐ŸŽฏ Anthropic: Claude

Smart Context Processing

A2A automatically:

  • ๐Ÿ“š Loads annotated actions
  • ๐ŸŽฏ Matches user intent to actions
  • ๐Ÿ”„ Processes parameters
  • ๐Ÿ“Š Returns formatted results

๐Ÿ”ง Advanced Configuration

Custom Action Groups

@Agent(groupName = "Custom Service", groupDescription = "Your custom service")
class CustomAgent {
  @Action(description = "Your custom action")
  def customAction(param: String): String = {
    // Your implementation
  }
}

๐Ÿค Contributing

Contributions are welcome! Feel free to:

  • ๐Ÿ› Report bugs
  • โœจ Suggest features
  • ๐Ÿ”ง Submit PRs

๐Ÿ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

๐Ÿ™ Acknowledgments

  • A2AJava framework developers
  • Tools4AI team
  • The Scala community

Built with โค๏ธ using Scala and A2AJava