A Kotlin-based framework for creating and managing tools that can be used with various AI models including Anthropic's Claude and GigaChat. This project provides a structured way to implement tool-based interactions with AI models, allowing for file operations and other system interactions.
- Tool-based interaction system supporting multiple AI providers:
- Anthropic's Claude AI
- GigaChat API
- Built-in file operation tools:
- File reading
- File listing
- File modification
- File creation
- File deletion
- In file text search
- Bash command execution
- Extensible tool framework
- Interactive command-line interface
- Kotlin
- For Anthropic Claude:
- Anthropic API key (set as an
ANTHROPIC_API_KEYenvironment variable) - can be obtained from Anthropic Console
- Anthropic API key (set as an
- For GigaChat:
- GigaChat credentials (Authorization token required), API page.
- Clone the repository
- Set your Anthropic API key as an environment variable
- Build the project using Gradle:
./gradlew buildsrc/main/kotlin/anthropic/- Anthropic agent implementationgiga/- GigaChat integrationGigaAgent.kt- GigaChat agent implementationGigaChatAPI.kt- API client implementationGigaAuth.kt- Authentication handlingGigaToolSetup.kt- Tool setup for GigaChatDTO.kt- Data transfer objectsGigaKtorClientDefaults.kt- HTTP client configuration
tool/- Tool framework and implementationsfiles/- File operation tools
Main.kt- Application entry point
ββββββββββββββββββββββββββββββββ Loop 1-5 ββββββββββββββββββββ
β User Agent LLM β
β | | | β
β |1. msg input | | β
β βββββββββββββββΆ|2. add msg into msgs | β
β | | | β
β | | βββββββββββββ Loop 3-5 βββββββββββββββ β
β | | β | β
β | | β3. send(msgs, tools) βββββββββββββββΆ| β
β | | β | β
β | | β4-1. plain text βββββββββββββββββββ| β
β | | β βββΊ print text | β
β | | β | β
β | | β4-2. function call βββββββββββββββ | β
β | | β β | β
β | | β β exec tool | β
β | | β β add resultβmsgs | β
β | | β β | β
β | | βββββββββββββ5. fn call? ββββββββββββββββΆβ
β | | ββββββββββββββββββββββββββββββββββββββ β
β | | | β
β |ββββββββββββββ| | β
β | 6. go to 1 | | β
ββββ΄βββββββββββββββ΄βββββββββββββββββββββββββββββββββββββββ΄ββββRun the application:
./gradlew runThe application will start an interactive session where you can communicate with Claude AI. Type 'exit' to quit the session.
- Create a new tool by implementing the
ToolSetupinterface:
interface ToolSetup<Input> {
val name: String
val description: String
operator fun invoke(input: Input): String
}- Define the input parameters using a data class with
@InputParamDescriptionannotations - Add the tool to the tools list in a specific Agent implementation.
- Anthropic Java Client:
com.anthropic:anthropic-java:1.0.0 - Kotlin Coroutines: For asynchronous operations
- Jackson: For JSON processing
- Kotlin Reflect: For runtime reflection
[License information not provided in source]
Copyright Β© 2025 Artur Dumchev
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.