OpenHands Agent-Computer Interface (ACI)
OpenHands-ACI (Agent-Computer Interface) provides essential tools and interfaces for AI agents to interact with computer systems for software development tasks. This includes capabilities for sophisticated code editing, file management, code linting, and executing shell commands, acting as a foundational layer for AI software engineer agents like OpenHands. The project is currently archived as its functionalities have been migrated to the OpenHands Agent SDK.
Warnings
- breaking The `openhands-aci` repository is officially archived, and the file editor tool, a core component, has been migrated to the OpenHands Agent SDK under `openhands/tools/str_replace_editor`. This means direct usage of `openhands-aci` for file editing functionality is deprecated and likely to be broken or not maintained.
- gotcha Practical use of OpenHands (which utilizes ACI) often requires a running Docker environment for sandboxed code execution. Without Docker installed and running, core functionalities related to agent interaction with the system may fail.
- gotcha Earlier versions of `openhands-aci` (and potentially `openhands` CLI interactions) have reported issues with invalid JSON output, which can lead to parsing errors for agents or consuming applications.
Install
-
pip install openhands-aci
Imports
- Code Editor and related tools
from openhands.tools.str_replace_editor import StrReplaceEditor # For file editing functionality
- Shell execution
from openhands_aci.utils.shell import execute_shell_command
Quickstart
import os
import asyncio
from openhands_aci.utils.shell import execute_shell_command
async def main():
print("Demonstrating a basic utility from openhands-aci (shell command execution).")
print("Note: The openhands-aci library is deprecated. For modern usage, refer to the OpenHands Agent SDK.")
# Example: Execute a simple shell command
command = "echo Hello from OpenHands ACI"
print(f"Executing: '{command}'")
result = await execute_shell_command(command, os.environ.get('AUTH_TOKEN', ''))
print(f"Stdout: {result.stdout.strip()}")
print(f"Stderr: {result.stderr.strip()}")
print(f"Return Code: {result.return_code}")
# Example: List files in the current directory
command_ls = "ls -la"
print(f"\nExecuting: '{command_ls}'")
result_ls = await execute_shell_command(command_ls, os.environ.get('AUTH_TOKEN', ''))
print(f"Stdout:\n{result_ls.stdout.strip()}")
if __name__ == "__main__":
asyncio.run(main())