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.
<dependency>
<groupId>com.autohand</groupId>
<artifactId>autohand-agents</artifactId>
<version>0.1.0</version>
</dependency>implementation 'com.autohand:autohand-agents:0.1.0'Prerequisites:
- Java 1.5 or higher
- Autohand Code CLI (recommended for full functionality)
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);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);Configure providers and models via environment variables:
export AUTOHAND_PROVIDER=openrouter
export AUTOHAND_API_KEY=sk-or-v1-...
export AUTOHAND_MODEL=your-model-name-hereOr programmatically:
import com.autohand.agents.Config;
Config config = Config.load();
config.setProvider("openrouter");
config.setApiKey("sk-or-v1-...");
config.setModel("your-model-name-here");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 |
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 |
- Examples - Working examples covering common use cases
- Autohand Code CLI - The companion CLI for Autohand Code
If you're contributing to this project:
# Build the project
mvn clean install
# Run tests
mvn test
# Run tests with coverage
mvn test jacoco:reportFor development with the Autohand Code CLI, see the CLI repository.
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 testApache License 2.0