Skip to content

AstrsomnStart AI Evolution with One Annotation

Deeply built on LangChain4j, transforming complex AI workflows into an effortless annotation experience. Providing Java developers with a standardized, production-ready AI integration foundation.

💡 Vision: Bring AI Implementation Back to "Engineering"

In enterprise-level production environments, the challenge of AI lies not in the "model itself", but in how to stably, safely, and controllably connect to business.

Astrsomn is a complete AI ecosystem: From astrsomn-core underlying abstraction, to astrsomn-starter seamless integration, and then to astrsomn-server centralized governance, we provide Java developers with an out-of-the-box "AI industrial base".


🏗️ Core Architecture View

Astrsomn adopts a layered decoupled architecture to ensure high availability and scalability in high-concurrency business scenarios.

LayerCore ComponentsTechnical Features
Access Layer@Astro Annotation / StarterZero-intrusive Bean injection, supporting multi-Agent instance isolation
Orchestration LayerAstroAssistantFactoryDynamically build AiServices, supporting LLM/Streaming mode switching
Capabilities LayerDynamicToolProvider / MCPCross-protocol tool invocation, supporting real-time conversion of Spring Bean methods to Tool
Governance LayerAssistantCacheManagerIn-memory management, Prompt version snapshot, multi-environment configuration distribution

The simplest way to access. Through @Astro annotation, the framework automatically retrieves parameters from the configuration center and completes the Agent's lifecycle management and model assembly.

java
@Service
public class OrderService {

    // Auto-assembly: The framework automatically retrieves configuration and injects cached instance based on agentKey
    @Astro(agentKey = "order-handler", envCode = "prod", temperature = 0.3)
    private OrderCreateAssistant orderAssistant;

    public String createOrder() {
        // Execute AI tasks like calling ordinary methods
        return orderAssistant.chat("Help me buy an iPhone17", UUID.randomUUID().toString());
    }
}

Method 2: Programmatic Construction

More flexible control method. When your business needs to build Assistant based on runtime context (such as dynamically adjusting the number of historical messages, switching tool strategies), you can use AstroAssistantFactory.

java
@Service
@RequiredArgsConstructor
public class TaskService {

    private final AstroAssistantFactory assistantFactory;

    public String createTask() {
        // 1. Dynamically build request parameters
        var param = AstroChatRequest.of(TaskCreateAssistant.class, "deepseek-sensor");
        param.setMaxHistoryMessages(5);        // Adjust context length at runtime
        param.setToolStrategy(new ToolStrategy()); // Dynamically specify tool strategy

        // 2. Get/create Assistant through factory (built-in AssistantCacheManager performance optimization)
        TaskCreateAssistant assistant = assistantFactory.createAssistant(param);
        
        return assistant.chat("Help me create a task, assignee is Liu Huipeng", UUID.fastUUID().toString());
    }
}