๐Ÿ“ฆ agentscope-ai / agentscope-java

๐Ÿ“„ README.md ยท 57 lines
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57# AgentScope Micronaut Example

Simple example demonstrating AgentScope integration with Micronaut framework dependency injection.

## Features

โœ… **Micronaut Dependency Injection** - Beans configured via application.yml  
โœ… **Multiple LLM Providers** - DashScope, OpenAI, Gemini, Anthropic  
โœ… **Simple Configuration** - Just set environment variables and run

## Quick Start

### 1. Prerequisites

- Java 17 or later
- Maven 3.8+

### 2. Configuration

The example uses configuration from `src/main/resources/application.yml`. Set your API key via environment variable:

```bash
export DASHSCOPE_API_KEY=your-api-key
```

### 3. Run

```bash
mvn clean compile exec:java
```

## How It Works

This example demonstrates:

1. **Micronaut ApplicationContext** - Starts the DI container
2. **Bean Injection** - `ReActAgent` is injected from Micronaut factory
3. **Configuration** - All settings loaded from `application.yml`

The key difference from manual setup is that beans are created and configured automatically by Micronaut.

## Configuration

You can change the LLM provider in `application.yml`:

```yaml
agentscope:
  model:
    provider: dashscope  # or: openai, gemini, anthropic
  
  dashscope:
    api-key: ${DASHSCOPE_API_KEY}
    model-name: qwen-plus
```

See the [Micronaut Integration README](../../agentscope-extensions/agentscope-micronaut/README.md) for full configuration options.