You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
By default, AstrBot uses the built-in Agent Runner as the default executor. You don't need to configure anything to use AstrBot's powerful built-in Agent Runner.
With the built-in Agent Runner, you can use AstrBot's [MCP Server](/use/mcp), [Knowledge Base](/use/knowledge-base), [Web Search](/use/websearch), and persona features.
AstrBot v4.2.1 and later versions support connecting to [Coze](https://www.coze.cn/) Agent service.
4
+
5
+
## Preparation: Get API Key
6
+
7
+
First, register and log in to your [Coze](https://www.coze.cn/) account, then go to the [API Key Management Page](https://www.coze.cn/open/oauth/pats) to create a new API Key.
8
+
9
+
You can follow the steps in the image to reach the API Key management page, or click the link above to go directly.
10
+
11
+

12
+
13
+
Then, click "Create", fill in your API Key name on the following page, select an expiration time (permanent tokens are not recommended), click "Select All" under "Permissions", select a workspace, and then click "Confirm".
14
+
15
+

16
+
17
+
After that, we will get a new API Key. Please copy and save it, as it will be needed later.
18
+
19
+

20
+
21
+
## Preparation: Configure the Agent
22
+
23
+
Go to the [Project Development](https://www.coze.cn/space/develop) page, click "+Project" in the upper right corner to create a new project, and select to create an agent.
**Note**: After creating the agent, you must first click the **Publish** button in the upper right corner to publish the agent. In the "Select Publishing Platform" section, check all API options, then click "Publish".
30
+
31
+
> If you don't publish or don't check the API options during publishing, you won't be able to call the agent via API.
32
+
33
+

34
+
35
+
After clicking publish, the agent creation is complete. You can see the publish history on the left side of the publish button on the agent development page to confirm the agent has been published successfully.
For example, if the URL in the example is: "https://www.coze.cn/space/7553214941005004863/bot/7553248674860826660"
42
+
43
+
Then the `bot_id` is the string of numbers after `bot/` in the URL: `7553248674860826660`
44
+
45
+
We need to record the `bot_id` for later use.
46
+
47
+
## Configure Coze in AstrBot
48
+
49
+
After completing all the preparation work, we can now configure Coze in AstrBot.
50
+
51
+
Go to AstrBot Admin Panel -> Service Provider -> Add Service Provider -> Coze to enter the configuration page.
52
+
53
+

54
+
55
+
Fill in the API Key and bot_id you just created, then click Save.
56
+
57
+
> Other configuration notes:
58
+
>
59
+
> - API Base URL: Generally no modification is needed. If you are using the international version of Coze, change this to: "https://api.coze.com"
60
+
> - Let Coze manage conversation history: As described.
61
+
62
+
## Select Agent Runner
63
+
64
+
Go to the Configuration page in the left sidebar, click "Agent Execution Method", select "Coze", then select the ID of the Coze Agent Runner you just created in the new configuration options that appear below, and click "Save" in the bottom right corner to complete the configuration.
Since v3.4.30, AstrBot supports connecting to Alibaba Cloud Bailian Application.
4
+
5
+
## Configure Alibaba Cloud Bailian Application in AstrBot
6
+
7
+
On the [Alibaba Cloud Bailian Application](https://bailian.console.aliyun.com/app-center#/app-center) website, click to add a new application. Create an agent application, workflow application, or agent orchestration application according to your needs, and build the agent or workflow as required.
8
+
9
+
Record the Application ID:
10
+
11
+

12
+
13
+
Click to enter the application, click Publishing Channel -> API Call -> API KEY, create and copy the API KEY:
14
+
15
+

16
+
17
+
In the WebUI, click "Model Provider" -> "Add Provider", select "Agent Runner", select "Alibaba Cloud Bailian Application", and enter the Alibaba Cloud Bailian Application configuration page.
18
+
19
+
According to Alibaba Cloud Bailian Application, there are four application types:
20
+
21
+
- Agent Application (agent)
22
+
- Task Workflow Application (task-workflow)
23
+
- Dialog Workflow Application (dialog-workflow)
24
+
- Agent Orchestration Application (agent-arrange)
25
+
26
+
> [!TIP]
27
+
> Multi-turn conversations are only supported for agent applications and dialog workflow applications. AstrBot will automatically attach conversation history for these two types of applications to support multi-turn conversations.
28
+
29
+
Please ensure that the `Application Type` configured in AstrBot matches the application type created in Alibaba Cloud Bailian Application.
30
+
31
+
Then fill in the Application ID in `dashscope_app_id` and the API KEY in `dashscope_api_key`.
32
+
33
+
After filling in these three items, click Save.
34
+
35
+
## Select Agent Runner
36
+
37
+
Go to the Configuration page in the left sidebar, click "Agent Execution Method", select "Alibaba Cloud Bailian Application", then select the ID of the Alibaba Cloud Bailian Application Agent Runner you just created in the new configuration options that appear below, and click "Save" in the bottom right corner to complete the configuration.
38
+
39
+
## Appendix: Dynamically Set Workflow Input Variables During Chat (Optional)
40
+
41
+
For the two workflow applications, you can dynamically set input variables in the chat area.
42
+
43
+
Use the `/set` command to dynamically set input variables, as shown in the figure below:
44
+
45
+

46
+
47
+
After setting variables, AstrBot will attach the variables you set in the next request to Alibaba Cloud Bailian Application, flexibly adapting to your Workflow.
48
+
49
+
Of course, you can use the `/unset` command to cancel the variables you set. For example, `/unset name`
50
+
51
+
Variables are permanently valid in the current session.
If you haven't installed Dify yet, please refer to the [Dify Installation Documentation](https://docs.dify.ai/getting-started/install-self-hosted) to install it.
6
+
7
+
## Configure Dify in AstrBot
8
+
9
+
In the WebUI, click "Model Provider" -> "Add Provider", select "Agent Runner", select "Dify", and enter the Dify configuration page.
10
+
11
+

12
+
13
+
In Dify, one `API Key` uniquely corresponds to one Dify application. Therefore, you can create multiple Providers to adapt to multiple Dify applications.
14
+
15
+
According to the current Dify project, there are three types:
16
+
17
+
- chat
18
+
- agent
19
+
- workflow
20
+
21
+
>[!TIP]
22
+
>Please ensure that the APP type you set in AstrBot matches the application type created in Dify.
23
+
>
24
+
25
+
26
+
### Chat and Agent Applications
27
+
28
+
Create your Dify Chat and Agent application keys as shown in the figure below:
Copy the key and paste it into the `API Key` field in the configuration, then click "Save".
35
+
36
+
### Workflow Applications
37
+
38
+
#### Configure Input and Output Variable Names
39
+
40
+
Workflow applications receive input variables, execute the workflow, and output the results.
41
+
42
+

43
+
44
+
For Workflow applications, AstrBot will attach two variables with each request:
45
+
46
+
-`astrbot_text_query`: Input variable name. This is the text content entered by the user.
47
+
-`astrbot_session_id`: Session ID
48
+
49
+
You can customize the input variable name in the configuration, which is the "Prompt Input Variable Name" shown in the figure above.
50
+
51
+
You need to modify the input variable name of your Workflow to adapt to AstrBot's input.
52
+
53
+
Finally, the Workflow will output a result. You can customize the variable name of this result, which is the "Dify Workflow Output Variable Name" in the configuration above, with a default value of `astrbot_wf_output`. You need to configure this variable name in the output node of the Dify Workflow, otherwise AstrBot cannot parse it correctly.
54
+
55
+
#### Create API Key
56
+
57
+
Create your Dify Workflow application's API Key as shown in the figure below:
58
+
59
+
Click the Publish button in the upper right corner -> Access API -> click API Key in the upper right corner -> Create Key, then copy the API Key.
Copy the key and paste it into the `API Key` field in the configuration, then click "Save".
64
+
65
+
### Select Agent Runner
66
+
67
+
Go to the Configuration page in the left sidebar, click "Agent Execution Method", select "Dify", then select the ID of the Dify Agent Runner you just created in the new configuration options that appear below, and click "Save" in the bottom right corner to complete the configuration.
68
+
69
+
## Appendix: Dynamically Set Workflow Input Variables During Chat (Optional)
70
+
71
+
You can use the `/set` command to dynamically set input variables, as shown in the figure below:
72
+
73
+

74
+
75
+
After setting variables, AstrBot will attach the variables you set in the next request to Dify, flexibly adapting to your Workflow.
76
+
77
+

78
+
79
+
Of course, you can use the `/unset` command to cancel the variables you set.
80
+
81
+
Variables are permanently valid in the current session.
0 commit comments