Skip to content

autohandai/agent-sdk-java

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Autohand Code Agent SDK for Java

Build AI agents with Autohand Code. Clean public APIs, provider-agnostic backends, and an ecosystem dashboard.

Note: This SDK is designed to work with the Autohand Code CLI. While the SDK can be used standalone, we recommend installing the CLI for the best experience.

Installation

Maven

<dependency>
    <groupId>com.autohand</groupId>
    <artifactId>autohand-agents</artifactId>
    <version>0.1.0</version>
</dependency>

Gradle

implementation 'com.autohand:autohand-agents:0.1.0'

Prerequisites:

Quick Start

import com.autohand.agents.Agent;
import com.autohand.agents.Runner;

Agent agent = new Agent("Assistant", "You are a helpful assistant");
String result = Runner.runSync(agent, "Write a haiku about coding.");
System.out.println(result);

Basic Usage

Using Tools

import com.autohand.agents.Agent;
import com.autohand.agents.Runner;
import com.autohand.agents.Tool;

Agent agent = new Agent(
    "Code Explorer",
    "You are a software engineering assistant. Read code, understand it, and answer questions.",
    new Tool[] { Tool.READ_FILE, Tool.BASH },
    15
);

String result = Runner.runSync(agent, "What does the auth module in src/auth/Auth.java do?");
System.out.println(result);

Configuration

Configure providers and models via environment variables:

export AUTOHAND_PROVIDER=openrouter
export AUTOHAND_API_KEY=sk-or-v1-...
export AUTOHAND_MODEL=your-model-name-here

Or programmatically:

import com.autohand.agents.Config;

Config config = Config.load();
config.setProvider("openrouter");
config.setApiKey("sk-or-v1-...");
config.setModel("your-model-name-here");

Available Tools

The SDK provides 40+ built-in tools organized by category:

Category Tools
Filesystem readFile, writeFile, editFile, applyPatch, find, glob, searchInFiles
Commands bash
Git gitStatus, gitDiff, gitLog, gitCommit, gitAdd, gitReset, gitPush, gitPull, gitFetch, gitCheckout, gitSwitch, gitBranch, gitMerge, gitRebase, gitStash, gitApplyPatch, gitWorktreeList, gitWorktreeAdd
Web webSearch
Notebook notebookRead, notebookEdit
Dependencies readPackageManifest, addDependency, removeDependency
Formatters formatFile, formatDirectory, listFormatters, checkFormatting
Linters lintFile, lintDirectory, listLinters

Providers

The SDK is provider-agnostic and supports multiple LLM backends:

Provider Notes
OpenRouter Primary/default, 200+ models
OpenAI Direct OpenAI API
Ollama Local models
Azure Enterprise Azure OpenAI
LlamaCpp Local LLaMA.cpp server
MLX Apple Silicon local runtime
LLMGateway Internal gateway proxy

Documentation

Development

If you're contributing to this project:

# Build the project
mvn clean install

# Run tests
mvn test

# Run tests with coverage
mvn test jacoco:report

For development with the Autohand Code CLI, see the CLI repository.

Docker

Run the SDK in an isolated Docker environment:

# Build the Docker image
docker build -t autohand-agents-java .

# Run tests in Docker
docker run --rm autohand-agents-java mvn test

License

Apache License 2.0

About

Java SDK for Autohand Code Agent SDK - Build AI agents with clean public APIs, provider-agnostic backends, and comprehensive tool support

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors