Embabel Agent ,Java 的 AI 框架 —— Spring 创始人 Rod Johnson 的杰作
Embabel Agent是一个基于JVM的AI框架,由Rod Johnson等开发者创建,支持Java21+和Maven3.9+。它提供Java和Kotlin模板,集成OpenAI/Anthropic API,通过Maven依赖快速接入。框架采用注解驱动开发,支持自定义Agent(如故事创作与审核)和LLM调用。与Spring AI并列成为Java生态两大AI解决方案,标志着从Python转向J
https://docs.embabel.com/embabel-agent/guide/0.1.3/
Author
Rod Johnson, Alex Hein-Heifetz, Dr. Igor Dayen, Jim Clark, Arjen Poutsma, Jasper Blues
Project
Java template - github.com/embabel/java-agent-template
Kotlin template - github.com/embabel/kotlin-agent-template
要求
— Java 21+
— Maven 3.9 +
— API _ OpenAI or Anthropic
Maven
<dependency>
<groupId>com.embabel.agent</groupId>
<artifactId>embabel-agent-starter-shell</artifactId>
<version>${embabel-agent.version}</version>
</dependency>
MCP Server
<dependency>
<groupId>com.embabel.agent</groupId>
<artifactId>embabel-agent-starter-mcpserver</artifactId>
<version>${embabel-agent.version}</version>
</dependency>
环境配置
.env 文件配置
OPENAI_API_KEY=your_openai_api_key_here ANTHROPIC_API_KEY=your_anthropic_api_key_here
Agent
@Agent(description = "Agent that writes and reviews stories")
public class WriteAndReviewAgent {
@Action
public Story writeStory(UserInput userInput, OperationContext context) {
return context.ai()
.withAutoLlm()
.createObject("""
You are a creative writer who aims to delight and surprise.
Write a story about %s
""".formatted(userInput.getContent()),
Story.class);
}
@AchievesGoal(description = "Review a story")
@Action
public ReviewedStory reviewStory(Story story, OperationContext context) {
return context.ai()
.withLlmByRole("reviewer")
.createObject("""
You are a meticulous editor.
Carefully review this story:
%s
""".formatted(story.text),
ReviewedStory.class);
}
}
和 Spring AI Alibaba 成为 Java的 两大 AI 框架。
https://blog.csdn.net/D1237890/article/details/152141649?spm=1011.2124.3001.6209
参 考
https://github.com/embabel/embabel-agent
https://docs.embabel.com/embabel-agent/guide/0.1.3/
弃 Python 拥抱 JVM,Spring 之父 20 年后再造“革命性框架”:我从未如此确信一个新项目的必要性
https://www.infoq.cn/article/3ezs1yoviwkh7y2vtafk
https://blog.csdn.net/D1237890/article/details/152141649?spm=1011.2124.3001.6209
更多推荐
所有评论(0)