๐ 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
-
Prerequisites
# Ensure you have SBT installed sbt --version -
Configuration Create
tools4ai.propertiesinsrc/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 -
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