diff --git a/agents/assistant.agent.kts b/arc-agent/agents/assistant.agent.kts similarity index 91% rename from agents/assistant.agent.kts rename to arc-agent/agents/assistant.agent.kts index 1807418..1518aa4 100644 --- a/agents/assistant.agent.kts +++ b/arc-agent/agents/assistant.agent.kts @@ -25,7 +25,8 @@ agent { ### Knowledge **Customer would like to know about Arc.** - Read the content from https://eclipse.dev/lmos/arc/ and provide the answer. - + **Customer has a general query.** + - Use the search function to search the internet for the query. """ } } diff --git a/build.gradle.kts b/arc-agent/build.gradle.kts similarity index 96% rename from build.gradle.kts rename to arc-agent/build.gradle.kts index df3f906..006df2b 100644 --- a/build.gradle.kts +++ b/arc-agent/build.gradle.kts @@ -26,7 +26,7 @@ kotlin { } dependencies { - val arcVersion = "0.121.0" + val arcVersion = "0.122.0-SNAPSHOT" val langchain4jVersion = "0.36.2" // Arc @@ -38,6 +38,7 @@ dependencies { implementation("org.eclipse.lmos:arc-reader-html:$arcVersion") implementation("org.eclipse.lmos:arc-api:$arcVersion") implementation("org.eclipse.lmos:arc-graphql-spring-boot-starter:$arcVersion") + implementation("org.eclipse.lmos:arc-mcp:$arcVersion") // Tracing implementation("io.micrometer:micrometer-tracing-bridge-otel") diff --git a/src/main/kotlin/Application.kt b/arc-agent/src/main/kotlin/Application.kt similarity index 100% rename from src/main/kotlin/Application.kt rename to arc-agent/src/main/kotlin/Application.kt diff --git a/arc-agent/src/main/resources/application.yml b/arc-agent/src/main/resources/application.yml new file mode 100644 index 0000000..020ea7f --- /dev/null +++ b/arc-agent/src/main/resources/application.yml @@ -0,0 +1,78 @@ +# SPDX-FileCopyrightText: 2025 Deutsche Telekom AG and others +# SPDX-License-Identifier: Apache-2.0 +spring: + application: + name: Arc Agent + jackson: + default-property-inclusion: NON_NULL + main: + banner-mode: off + web-application-type: reactive + reactor: + context-propagation: auto + graphql: + graphiql: + enabled: true + +server: + port: 8080 + +arc: + cors: + enabled: true + scripts: + enabled: true + folder: agents + hotReload: + enable: true + delay: PT1S + chat: + ui: + enabled: true + subscriptions: + events: + enable: true + ai: + clients: + - id: GPT-4o + model-name: gpt-4o + api-key: ${OPENAI_API_KEY} + client: openai + - id: llama3.3 + modelName: llama3.3 + client: ollama + mcp: + tools: + urls: http://localhost:8888 + +logging: + level: + root: WARN + org.eclipse.lmos.arc: DEBUG + org.eclipse.lmos.arc.app: WARN + ArcDSL: DEBUG + +management: + tracing: + enabled: false + sampling: + probability: 1.0 + server: + port: 9090 + endpoints: + web: + base-path: / + exposure: + include: prometheus,metrics,info,health,shutdown + endpoint: + metrics: + enabled: true + health: + probes: + enabled: true + shutdown: + access: unrestricted + prometheus: + metrics: + export: + enabled: true diff --git a/arc-mcp-server/build.gradle.kts b/arc-mcp-server/build.gradle.kts new file mode 100644 index 0000000..c90fad2 --- /dev/null +++ b/arc-mcp-server/build.gradle.kts @@ -0,0 +1,76 @@ +// SPDX-FileCopyrightText: 2025 Deutsche Telekom AG and others +// +// SPDX-License-Identifier: Apache-2.0 + +plugins { + kotlin("jvm") version "2.1.10" + kotlin("plugin.serialization") version "2.1.10" + kotlin("plugin.spring") version "2.1.10" + id("org.springframework.boot") version "3.4.3" + id("io.spring.dependency-management") version "1.1.7" + id("org.graalvm.buildtools.native") version "0.10.2" +} + +group = "org.eclipse.lmos.app" + +java { + toolchain { + languageVersion = JavaLanguageVersion.of(21) + } +} + +kotlin { + compilerOptions { + freeCompilerArgs.addAll("-Xjsr305=strict", "-Xcontext-receivers") + } +} + +dependencies { + val arcVersion = "0.122.0-SNAPSHOT" + val langchain4jVersion = "0.36.2" + + // Arc + implementation("org.eclipse.lmos:arc-azure-client:$arcVersion") + implementation("org.eclipse.lmos:arc-spring-boot-starter:$arcVersion") + implementation("org.eclipse.lmos:arc-reader-pdf:$arcVersion") + implementation("org.eclipse.lmos:arc-reader-html:$arcVersion") + implementation("org.eclipse.lmos:arc-assistants:$arcVersion") + implementation("org.eclipse.lmos:arc-reader-html:$arcVersion") + implementation("org.eclipse.lmos:arc-api:$arcVersion") + implementation("org.eclipse.lmos:arc-graphql-spring-boot-starter:$arcVersion") + + // MCP + implementation("org.springframework.ai:spring-ai-mcp-server-webflux-spring-boot-starter:1.0.0-M6") + + // Tracing + implementation("io.micrometer:micrometer-tracing-bridge-otel") + implementation("io.opentelemetry:opentelemetry-exporter-zipkin") + implementation("com.google.protobuf:protobuf-java:4.30.0") + implementation("io.opentelemetry.proto:opentelemetry-proto:1.3.2-alpha") + + // Azure + implementation("com.azure:azure-identity:1.15.4") + + // Spring Boot + implementation("org.springframework.boot:spring-boot-starter-actuator") + + // Langchain4j + implementation("dev.langchain4j:langchain4j-bedrock:$langchain4jVersion") + implementation("dev.langchain4j:langchain4j-google-ai-gemini:$langchain4jVersion") + implementation("dev.langchain4j:langchain4j-ollama:$langchain4jVersion") + implementation("dev.langchain4j:langchain4j-open-ai:$langchain4jVersion") + + // Metrics + implementation("io.micrometer:micrometer-registry-prometheus") + + // Test + testImplementation("org.springframework.boot:spring-boot-testcontainers") + testImplementation("org.testcontainers:mongodb:1.20.6") + testImplementation("org.springframework.boot:spring-boot-starter-test") +} + +repositories { + mavenLocal() + mavenCentral() + maven(url = "https://oss.sonatype.org/content/repositories/snapshots/") +} diff --git a/agents/get_web_content.functions.kts b/arc-mcp-server/functions/get_web_content.functions.kts similarity index 100% rename from agents/get_web_content.functions.kts rename to arc-mcp-server/functions/get_web_content.functions.kts diff --git a/arc-mcp-server/functions/search.functions.kts b/arc-mcp-server/functions/search.functions.kts new file mode 100644 index 0000000..a47403f --- /dev/null +++ b/arc-mcp-server/functions/search.functions.kts @@ -0,0 +1,20 @@ +// SPDX-FileCopyrightText: 2025 Deutsche Telekom AG and others +// +// SPDX-License-Identifier: Apache-2.0 + +import com.sun.tools.javac.tree.TreeInfo.types + +function( + name = "search", + description = "Searches the internet.", + params = types( + string("query", "The Query to search for.") + ) +) { (url) -> + httpGet( + "https://api.search.brave.com/res/v1/web/search", headers = mapOf( + "Accept" to "application/json", + "X-Subscription-Token" to "BRAVE_KEY", + ) + ) +} diff --git a/arc-mcp-server/src/main/kotlin/Application.kt b/arc-mcp-server/src/main/kotlin/Application.kt new file mode 100644 index 0000000..13a73e6 --- /dev/null +++ b/arc-mcp-server/src/main/kotlin/Application.kt @@ -0,0 +1,19 @@ +// SPDX-FileCopyrightText: 2025 Deutsche Telekom AG and others +// +// SPDX-License-Identifier: Apache-2.0 + + +package org.eclipse.lmos.arc.app + +import org.springframework.boot.autoconfigure.SpringBootApplication +import org.springframework.boot.runApplication + +/** + * Simple Spring Boot application that demonstrates how to use the Arc Agents. + */ +@SpringBootApplication +class ArcAIApplication + +fun main(args: Array) { + runApplication(*args) +} diff --git a/src/main/resources/application.yml b/arc-mcp-server/src/main/resources/application.yml similarity index 76% rename from src/main/resources/application.yml rename to arc-mcp-server/src/main/resources/application.yml index bb6ef45..b4399d5 100644 --- a/src/main/resources/application.yml +++ b/arc-mcp-server/src/main/resources/application.yml @@ -10,19 +10,22 @@ spring: web-application-type: reactive reactor: context-propagation: auto - graphql: - graphiql: + threads: + virtual: enabled: true server: - port: 8080 + port: 8888 arc: + mcp: + tools: + expose: true cors: enabled: true scripts: enabled: true - folder: agents + folder: functions hotReload: enable: true delay: PT1S @@ -32,6 +35,15 @@ arc: subscriptions: events: enable: true + ai: + clients: + - id: llama3.3 + modelName: llama3.3 + client: ollama + - id: GPT-4o-Azure + model-name: GPT-4o + url: ${AZURE_OPENAI_URL} + client: azure logging: level: @@ -46,7 +58,7 @@ management: sampling: probability: 1.0 server: - port: 9090 + port: 9999 endpoints: web: base-path: / diff --git a/config/application.yml b/config/application.yml deleted file mode 100644 index e975da8..0000000 --- a/config/application.yml +++ /dev/null @@ -1,18 +0,0 @@ -# SPDX-FileCopyrightText: 2023 Deutsche Telekom AG -# -# SPDX-License-Identifier: CC0-1.0 - -arc: - ai: - clients: - - id: GPT-4o - model-name: gpt-4o - api-key: ${OPENAI_API_KEY} - client: openai - - id: llama3.3 - modelName: llama3.3 - client: ollama - - id: GPT-4o-Azure - model-name: GPT-4o - url: ${AZURE_OPENAI_URL} - client: azure \ No newline at end of file diff --git a/settings.gradle.kts b/settings.gradle.kts index e48d0dd..98046c2 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -5,3 +5,5 @@ rootProject.name = "arc-spring-init" +include("arc-mcp-server") +include("arc-agent") \ No newline at end of file