Core domain type definitions for the Embabel Agent Framework, providing foundational data classes and interfaces for agent-based AI workflows including content assets, research entities, and person types with Jackson serialization and PromptContributor capabilities.
Domain models for research workflows in agent systems.
Represents a research topic with specific questions to investigate.
@JsonClassDescription("topic to research")
open class ResearchTopic(
@get:JsonPropertyDescription("topic to research")
val topic: String,
@get:JsonPropertyDescription("specific questions")
val questions: List<String>
)Properties:
topic: String - Research topic (e.g., "Quantum Computing", "AI Ethics")questions: List<String> - Specific questions to investigateMethods:
toString(): String - Format: "ResearchTopic(topic='...', questions=[...])"Note: Open class - can be extended with additional properties.
Container for multiple research topics.
open class ResearchTopics(
val topics: List<ResearchTopic>
)Properties:
topics: List<ResearchTopic> - List of research topicsNote: Open class - can be extended.
Comprehensive research report with content and linked internet resources.
@JsonClassDescription("Research report, containing a topic, content and links")
open class ResearchReport(
@get:JsonPropertyDescription("topic of the report")
val topic: String,
@get:JsonPropertyDescription("content of the report")
override val content: String,
@get:JsonPropertyDescription("links to internet resources")
override val links: List<InternetResource>
) : InternetResources, HasInfoString, ContentAssetProperties:
topic: String - Report topic (e.g., "Quantum Computing", "AI Ethics")content: String - Report text (from HasContent via ContentAsset)links: List<InternetResource> - Referenced internet resources (from InternetResources)timestamp: Instant - Creation timestamp (from Timestamped via ContentAsset), auto-set to Instant.now()Interfaces:
InternetResources - Provides links property and contribution() methodHasInfoString - Provides infoString() methodContentAsset - Provides content, timestamp, and LLM integrationMethods:
infoString(verbose: Boolean? = null, indent: Int = 0): String - Formatted info string with content and linkstoString(): String - Returns infoString(verbose = false, indent = 0)contribution(): String - Formatted report for LLM promptsNote: Open class - can be extended.
import com.embabel.agent.domain.library.ResearchTopic
val topic = ResearchTopic(
topic = "AI Ethics in Modern Systems",
questions = listOf(
"What are key ethical concerns in AI deployment?",
"How can we mitigate algorithmic bias?",
"What frameworks exist for ethical AI development?"
)
)
println(topic.topic) // "AI Ethics in Modern Systems"
println(topic.questions) // [What are key..., How can we..., What frameworks...]import com.embabel.agent.domain.library.ResearchTopics
import com.embabel.agent.domain.library.ResearchTopic
val topics = ResearchTopics(
topics = listOf(
ResearchTopic(
topic = "Machine Learning",
questions = listOf("What are latest developments?")
),
ResearchTopic(
topic = "Distributed Systems",
questions = listOf("How to ensure consistency?")
)
)
)
// Access topics
topics.topics.forEach { topic ->
println("Topic: ${topic.topic}")
topic.questions.forEach { question ->
println(" - $question")
}
}import com.embabel.agent.domain.library.InternetResource
import com.embabel.agent.domain.library.ResearchReport
import java.time.Instant
val report = ResearchReport(
topic = "AI Ethics in Healthcare",
content = """
# AI Ethics in Healthcare
## Executive Summary
AI systems in healthcare must balance innovation with patient safety...
## Key Findings
1. Bias in diagnostic algorithms affects marginalized populations
2. Data privacy concerns are paramount
3. Transparency in AI decision-making is essential
## Recommendations
- Implement rigorous testing for algorithmic bias
- Establish clear data governance policies
- Require explainable AI for critical decisions
""".trimIndent(),
links = listOf(
InternetResource(
url = "https://www.nature.com/ai-healthcare-ethics",
summary = "Comprehensive study on AI ethics in healthcare"
),
InternetResource(
url = "https://www.who.int/ai-ethics-guidelines",
summary = "WHO guidelines for ethical AI"
),
InternetResource(
url = "https://arxiv.org/abs/bias-diagnostic-ai",
summary = "Research on algorithmic bias in diagnostics"
)
)
)
// Access properties
println(report.topic) // "AI Ethics in Healthcare"
println(report.content) // Markdown content
println(report.timestamp) // Instant when created
println(report.links) // List of InternetResourceval report = ResearchReport(
topic = "Quantum Computing Applications",
content = "Quantum computing has emerged...",
links = listOf(
InternetResource(
url = "https://quantum.ibm.com/applications",
summary = "IBM quantum applications"
),
InternetResource(
url = "https://www.nature.com/quantum-applications",
summary = "Nature article on quantum apps"
)
)
)
// Info string (for logging/debugging)
val info = report.infoString(verbose = false, indent = 0)
// Returns:
// |Report:
// |Quantum computing has emerged...
// |Links: [urls]
// toString uses infoString
println(report.toString())
// LLM contribution
val contribution = report.contribution()
// Returns:
// Research Report:
// Topic: Quantum Computing Applications
// Content: Quantum computing has emerged...
// Links: [url - summary, ...]
// Date: 2026-02-06val report = ResearchReport(
topic = "AI Agent Frameworks",
content = """
# Framework Landscape
## Overview
The ecosystem has evolved significantly...
## Leading Frameworks
1. Embabel - JVM-based, sophisticated planning
2. LangChain - Python/JS, wide ecosystem
3. AutoGen - Microsoft, multi-agent focus
""".trimIndent(),
links = listOf(
InternetResource(
url = "https://github.com/embabel/embabel-agent",
summary = "Embabel repository"
),
InternetResource(
url = "https://www.langchain.com/",
summary = "LangChain docs"
)
)
)
val promptContext = """
Research Context:
${report.contribution()}
Based on this, recommend...
""".trimIndent()import java.time.Instant
class PrioritizedResearchTopic(
topic: String,
questions: List<String>,
val priority: Int,
val deadline: Instant?
) : ResearchTopic(topic, questions) {
override fun toString(): String =
"PrioritizedResearchTopic(topic='$topic', questions=$questions, " +
"priority=$priority, deadline=$deadline)"
}
val urgentTopic = PrioritizedResearchTopic(
topic = "Security Vulnerabilities",
questions = listOf("Current threats?", "Patching strategy?"),
priority = 1,
deadline = Instant.now().plusSeconds(86400)
)class AnnotatedResearchReport(
topic: String,
content: String,
links: List<InternetResource>,
val annotations: List<String>,
val reviewers: List<String>
) : ResearchReport(topic, content, links) {
override fun contribution(): String =
super.contribution() +
"\nAnnotations: ${annotations.joinToString("; ")}"
}
val annotated = AnnotatedResearchReport(
topic = "Security Best Practices",
content = "The following practices...",
links = listOf(),
annotations = listOf("Needs TLS 1.3 update", "Add zero-trust section"),
reviewers = listOf("Alice", "Bob")
)import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule
val mapper = jacksonObjectMapper().registerModule(JavaTimeModule())
// ResearchTopic
val topic = ResearchTopic(
topic = "Quantum Computing",
questions = listOf("What is quantum supremacy?", "Practical applications?")
)
val topicJson = mapper.writeValueAsString(topic)
val topicDeserialized = mapper.readValue(topicJson, ResearchTopic::class.java)
// ResearchReport
val report = ResearchReport(
topic = "Cloud Security",
content = "Cloud security encompasses...",
links = listOf(
InternetResource(
url = "https://cloud.google.com/security",
summary = "GCP security best practices"
)
)
)
val reportJson = mapper.writeValueAsString(report)
val reportDeserialized = mapper.readValue(reportJson, ResearchReport::class.java)ResearchTopic JSON Format:
{
"topic": "Quantum Computing",
"questions": [
"What is quantum supremacy?",
"What are practical applications?"
]
}ResearchReport JSON Format:
{
"topic": "Cloud Security",
"content": "Cloud security encompasses...",
"links": [
{
"url": "https://cloud.google.com/security",
"summary": "GCP security best practices"
}
],
"timestamp": "2026-02-06T12:00:00Z"
}import com.embabel.agent.domain.library.*
// 1. Define research topics
val topics = ResearchTopics(
topics = listOf(
ResearchTopic(
topic = "AI Agent Frameworks",
questions = listOf(
"What are leading frameworks?",
"How do they compare?",
"What are adoption trends?"
)
)
)
)
// 2. Conduct research (in agent action)
// ...
// 3. Create research report
val report = ResearchReport(
topic = "AI Agent Frameworks",
content = """
# Framework Landscape
## Overview
The ecosystem has evolved...
## Leading Frameworks
1. Embabel - JVM, planning
2. LangChain - Python/JS
3. AutoGen - Multi-agent
## Comparison
[Detailed comparison...]
""".trimIndent(),
links = listOf(
InternetResource(
url = "https://github.com/embabel/embabel-agent",
summary = "Embabel framework"
),
InternetResource(
url = "https://www.langchain.com/",
summary = "LangChain docs"
),
InternetResource(
url = "https://microsoft.github.io/autogen/",
summary = "Microsoft AutoGen"
)
)
)
// 4. Use in LLM prompts
val prompt = """
Research:
${report.contribution()}
Recommend...
""".trimIndent()fun summarizeResearch(report: ResearchReport): Summary {
return Summary(
"Research on '${report.topic}': ${report.content.take(200)}... " +
"References ${report.links.size} sources."
)
}fun createBlogFromResearch(report: ResearchReport, author: String): Blog {
val linksSection = report.links.joinToString("\n") { link ->
"- [${link.summary}](${link.url})"
}
val content = """
${report.content}
## References
$linksSection
""".trimIndent()
return Blog(
title = report.topic,
author = author,
content = content,
keywords = setOf("research", report.topic.lowercase())
)
}fun enrichResearchWithNews(
report: ResearchReport,
news: RelevantNewsStories
): String {
return """
${report.contribution()}
## Recent News
${news.contribution()}
""".trimIndent()
}data class Researcher(
override val name: String,
val affiliation: String
) : Person
val researchers = listOf(
Researcher("Dr. Alice", "MIT"),
Researcher("Dr. Bob", "Stanford")
)
val report = ResearchReport(
topic = "Collaborative AI",
content = """
Research by: ${researchers.joinToString { "${it.name} (${it.affiliation})" }}
Findings...
""".trimIndent(),
links = listOf()
)tessl i tessl/maven-com-embabel-agent--embabel-agent-domain@0.3.0