Skip to main content
Spring AI Alibaba

Calling Bailian Applications

Calling Bailian Agents and Workflow Applications in Spring AI

This guide explains how to call Alibaba Cloud Bailian agents and workflow applications using Spring AI Alibaba.

Prerequisites

  • Spring AI Alibaba dependency has been added
  • Bailian API Key has been configured
  • An application has been created and published in the Bailian console

Usage Example

import com.alibaba.cloud.ai.dashscope.app.DashScopeAppClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class AppService {

    @Autowired
    private DashScopeAppClient appClient;

    public String callApp(String prompt) {
        return appClient.call(
            "your-app-id",
            prompt
        );
    }
}

Streaming Calls

public Flux<String> streamCallApp(String prompt) {
    return appClient.stream(
        "your-app-id",
        prompt
    );
}

Configuration Properties

ConfigurationDescriptionDefault Value
spring.ai.dashscope.api-keyAPI Key-
spring.ai.dashscope.app.idApplication ID-
spring.ai.dashscope.app.workspace-idWorkspace ID-
Overview
Managed Agent API
Sandbox API
Memory API
Flow Agent API
RAG API
Connector API
Assistant API (Deprecating)
  • Overview