はじめに
OpenHandsからClaude CodeのようにCLIで動作するOpenHands CLIがリリースされました。
今回は早速触ってみた感触などをお伝えできればと思います。
OpenHandsCLIとは
OpenHandsはこれまでDocker環境とGUIが必須だったが、もっと手軽に使えるようになりたいというユーザの声を元に開発されたとのことです。
MITライセンスで完全にオープンソースとして提供されているといった特徴があります。
また公式のSNSでも言及されていますがClaude Codeに似ています。
similar to Claude Code
公式ドキュメントはこちら
触ってみた
準備編
python3.12 or 3.13が動作する環境で
$ pip install openhands-ai
もしくはuvxを用いて$ uvx --python 3.12 --from openhands-ai openhands
でopenhandsをインストールします。
私はローカル環境にて動作させることを躊躇ったため,Docker環境を用意してインストールしました。
$ openhands
で起動します。
その後、anthropicを使いますか?モデルは何を使いますか?
などの質問に回答していき最後にAPIキーを設定すればOKです。
ここまでのプロセスで迷うところは特にありませんでした。
___ _ _ _
/ _ \ _ __ ___ _ __ | | | | __ _ _ __ __| |___
| | | | '_ \ / _ \ '_ \| |_| |/ _` | '_ \ / _` / __|
| |_| | |_) | __/ | | | _ | (_| | | | | (_| \__ \
\___ /| .__/ \___|_| |_|_| |_|\__,_|_| |_|\__,_|___/
|_|
OpenHands CLI v0.44.0
Initialized conversation 7936085b-****-****-****-************
Let's start building!
What do you want to build? Type /help for help
>
/help
コマンドをとりあえず実行
/helpの結果
> /help
OpenHands CLI v0.44.0
OpenHands CLI lets you interact with the OpenHands agent from the command line.
Things that you can try:
• Ask questions about the codebase > How does main.py work?
• Edit files or add new features > Add a new function to ...
• Find and fix issues > Fix the type error in ...
Some tips to get the most out of OpenHands:
• Be as specific as possible about the desired outcome or the problem to be solved.
• Provide context, including relevant file paths and line numbers if available.
• Break large tasks into smaller, manageable prompts.
• Include relevant error messages or logs.
• Specify the programming language or framework, if not obvious.
Interactive commands:
/exit - Exit the application
/help - Display available commands
/init - Initialize a new repository
/status - Display conversation details and usage metrics
/new - Create a new conversation
/settings - Display and modify current settings
/resume - Resume the agent when paused
Learn more at: https://docs.all-hands.dev/usage/getting-started
日本語でも会話できるか試してみました。
> あなたは何ができますか?
Agent running... (Press Ctrl-P to pause)
こんにちは!私はOpenHandsエージェントです。コンピューターと対話してさまざまなタスクを実行できる AI アシスタントです。以下のようなことができます:
- **プログラミング**: コードの作成、編集、デバッグ、リファクタリング
- **ファイル操作**: ファイルやディレクトリの作成、編集、管理
- **コマンド実行**: Bashコマンドの実行、スクリプトの実行
- **環境設定**: 依存関係のインストール、開発環境のセットアップ
- **バージョン管理**: Gitを使った変更管理、コミット、プルリクエスト作成
- **テスト**: テストコードの作成と実行
- **デバッグ**: 問題の特定と修正
- **コードレビュー**: コード品質の改善提案
- **ブラウザ操作**: ウェブページの閲覧、フォーム入力、クリック操作
- **API連携**: RESTful APIの呼び出しとデータ処理
- **ウェブアプリケーション**: フロントエンドとバックエンドの開発
- **Python**: データ分析、機械学習、スクリプト作成
- **ファイル処理**: CSV、JSON、XMLなどの各種ファイル形式の処理
- **データベース**: SQLクエリの作成と実行
- **パッケージ管理**: npm、pip、aptなどを使った依存関係管理
- **設定ファイル**: 各種設定ファイルの作成と編集
- **ログ解析**: エラーログの分析と問題解決
- **技術文書**: README、API仕様書、コメントの作成
- **マークダウン**: 構造化された文書の作成
何か具体的にお手伝いできることがあれば、お気軽にお聞かせください!どのようなプロジェクトに取り組んでいらっしゃいますか?
Agent is waiting for your input...
日本語での会話も問題なくできています。
DeprecationWarningが出ている部分は割愛しています。
応答時間はClaude Codeに比較すると少し遅いなと感じました。
ただ、本当にそんなことできるの?と言う部分もあったりと…
公式のブログページでは
- Add a new feature: add a user data validation function to user_data.py
- Fix a bug: do RCA on the bug causing new users to be unable to login
- Add tests: increase test coverage of the mapping service
- Refactor code: refactor the process_user_data function to be more readable
- Document code: document the database schema
- Explain code: explain to me how the location service works
ができるよと言及されています。
実践編
やはり最初はhello worldを出力するプログラムを作ってもらいます。
> 「hello world!」と出力するプログラムを組んでください
「hello world!」と出力するプログラムを作成いたします。いくつかの言語で作成してみますね。
~~省略~~
┌────────────────────────────────────────────────────────────────────────────────────────────────────| Command |─────────────────────────────────────────────────────────────────────────────────────────────────────┐
│$ python3 /app/hello.py │
└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
プログラムを作成しました!それぞれ実行してみましょう:
Proceed with action? (y)es/(n)o/(a)lways >
y / n / aで回答するインターフェースになっています。
Proceed with action? (y)es/(n)o/(a)lways > y
┌────────────────────────────────────────────────────────────────────────────────────────────────────| Command |─────────────────────────────────────────────────────────────────────────────────────────────────────┐
│$ python3 /app/hello.py │
└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────────────────────────────────────────| Command Output |─────────────────────────────────────────────────────────────────────────────────────────────────┐
│hello world! │
│ │
└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
python版は無事に実行できました。
次はjavascript版を作ったので実行するようです。
┌────────────────────────────────────────────────────────────────────────────────────────────────────| Command |─────────────────────────────────────────────────────────────────────────────────────────────────────┐
│$ node /app/hello.js │
└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────────────────────────────────────────| Command Output |─────────────────────────────────────────────────────────────────────────────────────────────────┐
│bash: line 1: node: command not found │
│ │
└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
Agent running... (Press Ctrl-P to pause)
┌────────────────────────────────────────────────────────────────────────────────────────────────────| Command |─────────────────────────────────────────────────────────────────────────────────────────────────────┐
│$ apt update && apt install -y nodejs │
└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
Node.jsがインストールされていないようですので、インストールしてから実行します:
Proceed with action? (y)es/(n)o/(a)lways >
当然Python以外に何も入っていない環境ですのでnodeはありません。
ちゃんとエラー内容を理解した上で次のアクションの実行許可を得ようとしています。
┌────────────────────────────────────────────────────────────────────────────────────────────────────| Command |─────────────────────────────────────────────────────────────────────────────────────────────────────┐
│$ node /app/hello.js │
└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────────────────────────────────────────| Command Output |─────────────────────────────────────────────────────────────────────────────────────────────────┐
│hello world! │
│ │
└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
長いので割愛しましたが、C言語版、Java版のプログラムも作成してくれたようです。
Javaはjavaをインストールしたりファイル名を変更したりと試行錯誤を実施していました。
最後にマークダウン形式で結果が表示されまので興味がありましたらご覧ください。
最終の出力結果
完璧です!「hello world!」と出力するプログラムを複数の言語で作成し、すべて正常に実行できました。
📋 作成したプログラム一覧
1. Python版 (hello.py
)
2. JavaScript版 (hello.js
)
console.log("hello world!");
3. C言語版 (hello.c
)
#include
int main() {
printf("hello world!\n");
return 0;
}
4. Java版 (hello.java
)
class Hello {
public static void main(String[] args) {
System.out.println("hello world!");
}
}
✅ 実行結果
すべてのプログラムが正常に実行され、「hello world!」と出力されました:
-
Python:
python3 hello.py
✓ -
JavaScript:
node hello.js
✓ -
C言語:
gcc hello.c -o hello_c && ./hello_c
✓ -
Java:
javac hello.java && java Hello
✓
どの言語のプログラムも /app
ディレクトリに保存されているので、いつでも実行できます!
まとめ
今回はOpenHands CLIがリリースされたと言うことで簡単にではありますが触ってみました。
触った感想としてはそこまで品質が悪いものではないなという印象です。
今回はAnthropicのAPIキーを設定して利用したのですが、ローカル環境に構築したローカルLLMと接続して利用することもできるようです。
ただし随所にwarningが出てくるのでまだまだ発展途上のツールだなと実感しました。
現時点では応答速度や機能面などではClaude Codeが先を行っていますが、今後どのようなスピードでアップデートが行われるのかとても楽しみなツールだなと感じました。
簡単に試せますのでぜひ皆さんも試してみてください。
Appendix
python版のプログラムをより改良してアップデートしてもらいました。
出力が長いため興味がある方のみご覧ください。
出力されるwarningなど全てそのまま載せています。
OpenHands CLIとの全文
> python版のプログラムのアップデートを進めていきましょう。
/usr/local/lib/python3.12/site-packages/httpx/_models.py:408: DeprecationWarning: Use 'content=<...>' to upload raw bytes/text content.
headers, stream = encode_request(
Agent running... (Press Ctrl-P to pause)
/usr/local/lib/python3.12/site-packages/httpx/_models.py:408: DeprecationWarning: Use 'content=<...>' to upload raw bytes/text content.
headers, stream = encode_request(
Python版のプログラムをアップデートしていきましょう!現在のプログラムを確認してから、どのような機能を追加したいか教えてください。
┌───────────────────────────────────────────────────────────────────────────────────────────────────| File Read |────────────────────────────────────────────────────────────────────────────────────────────────────┐
│Here's the result of running `cat -n` on /app/hello.py: │
│ 1 print("hello world!") │
│ │
└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
現在のPython版は非常にシンプルですね。以下のようなアップデートが考えられます:
## 🚀 **アップデート案**
1. **ユーザー入力対応** - 名前を入力してもらって個人的な挨拶
2. **時間帯別挨拶** - 朝・昼・夜で挨拶を変える
3. **多言語対応** - 複数の言語で挨拶
4. **カラフル出力** - 色付きテキストで表示
5. **ログ機能** - 実行履歴を記録
6. **コマンドライン引数対応** - 引数で動作を変更
7. **GUI版** - tkinterを使った簡単なGUI
8. **Web版** - Flaskを使った簡単なWebアプリ
どのような機能を追加したいですか?それとも、特定の方向性があれば教えてください!
例えば:
- 「ユーザーとの対話機能を追加したい」
- 「時間に応じた挨拶にしたい」
- 「GUI版にしたい」
- 「もっと実用的な機能を追加したい」
など、ご希望をお聞かせください。
Agent is waiting for your input...
> 1から4まで実装しましょう
/usr/local/lib/python3.12/site-packages/httpx/_models.py:408: DeprecationWarning: Use 'content=...>' to upload raw bytes/text content.
headers, stream = encode_request(
Agent running... (Press Ctrl-P to pause)
/usr/local/lib/python3.12/site-packages/httpx/_models.py:408: DeprecationWarning: Use 'content=...>' to upload raw bytes/text content.
headers, stream = encode_request(
素晴らしいですね!1から4までの機能を実装していきましょう。
┌───────────────────────────────────────────────────────────────────────────────────────────────────| File Edit |────────────────────────────────────────────────────────────────────────────────────────────────────┐
│[Existing file /app/hello.py is edited with 1 changes.] │
│[begin of edit 1 / 1] │
│(content before edit) │
│-1|print("hello world!") │
│(content after edit) │
│+1|import datetime │
│+2|import colorama │
│+3|from colorama import Fore, Back, Style │
│+4| │
│+5|# カラー出力の初期化 │
│+6|colorama.init() │
│+7| │
│+8|def get_time_based_greeting(): │
│+9| """時間帯に応じた挨拶を返す""" │
│+10| current_hour = datetime.datetime.now().hour │
│+11| │
│+12| if 5 =' * 50}{Style.RESET_ALL}") │
│+32| print(f"{Fore.CYAN}🎉 {name}さんへの挨拶 🎉{Style.RESET_ALL}") │
│+33| print(f"{Fore.MAGENTA}{'=' * 50}{Style.RESET_ALL}") │
│+34| │
│+35| # 日本語 │
│+36| print(f"{Fore.RED}🇯🇵 日本語: {Back.WHITE}{Fore.BLACK}{japanese}、{name}さん!{Style.RESET_ALL}") │
│+37| │
│+38| # 英語 │
│+39| print(f"{Fore.BLUE}🇺🇸 English: {Back.YELLOW}{Fore.BLACK}{english}, {name}!{Style.RESET_ALL}") │
│+40| │
│+41| # スペイン語 │
│+42| print(f"{Fore.GREEN}🇪🇸 Español: {Back.RED}{Fore.WHITE}{spanish}, {name}!{Style.RESET_ALL}") │
│+43| │
│+44| # フランス語 │
│+45| print(f"{Fore.YELLOW}🇫🇷 Français: {Back.BLUE}{Fore.WHITE}{french}, {name}!{Style.RESET_ALL}") │
│+46| │
└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
┌────────────────────────────────────────────────────────────────────────────────────────────────────| Command |─────────────────────────────────────────────────────────────────────────────────────────────────────┐
│$ pip install colorama │
└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
coloramaライブラリが必要なので、まずインストールしてから実行してみましょう:
Proceed with action? (y)es/(n)o/(a)lways > a
10:56:38 - openhands:WARNING: agent_controller.py:877 - [Agent Controller 5aff23a6-6fff-489c-ad5b-0f769a0e5b91-4b1810415e96c3a0] Pending action active for 60.86s: CmdRunAction (id=122)
10:56:38 - openhands:WARNING: agent_controller.py:877 - [Agent Controller 5aff23a6-6fff-489c-ad5b-0f769a0e5b91-4b1810415e96c3a0] Pending action active for 60.86s: CmdRunAction (id=122)
10:56:38 - openhands:WARNING: agent_controller.py:877 - [Agent Controller 5aff23a6-6fff-489c-ad5b-0f769a0e5b91-4b1810415e96c3a0] Pending action active for 60.86s: CmdRunAction (id=122)
10:56:38 - openhands:WARNING: agent_controller.py:877 - [Agent Controller 5aff23a6-6fff-489c-ad5b-0f769a0e5b91-4b1810415e96c3a0] Pending action active for 60.87s: CmdRunAction (id=122)
10:56:38 - openhands:WARNING: agent_controller.py:877 - [Agent Controller 5aff23a6-6fff-489c-ad5b-0f769a0e5b91-4b1810415e96c3a0] Pending action active for 60.87s: CmdRunAction (id=122)
10:56:38 - openhands:WARNING: agent_controller.py:877 - [Agent Controller 5aff23a6-6fff-489c-ad5b-0f769a0e5b91-4b1810415e96c3a0] Pending action active for 60.87s: CmdRunAction (id=-1)
10:56:38 - openhands:WARNING: agent_controller.py:877 - [Agent Controller 5aff23a6-6fff-489c-ad5b-0f769a0e5b91-4b1810415e96c3a0] Pending action active for 60.87s: CmdRunAction (id=124)
10:56:38 - openhands:WARNING: agent_controller.py:877 - [Agent Controller 5aff23a6-6fff-489c-ad5b-0f769a0e5b91-4b1810415e96c3a0] Pending action active for 60.87s: CmdRunAction (id=124)
10:56:39 - openhands:WARNING: agent_controller.py:877 - [Agent Controller 5aff23a6-6fff-489c-ad5b-0f769a0e5b91-4b1810415e96c3a0] Pending action active for 61.36s: CmdRunAction (id=124)
10:56:39 - openhands:WARNING: agent_controller.py:877 - [Agent Controller 5aff23a6-6fff-489c-ad5b-0f769a0e5b91-4b1810415e96c3a0] Pending action active for 61.36s: CmdRunAction (id=124)
/usr/local/lib/python3.12/site-packages/httpx/_models.py:408: DeprecationWarning: Use 'content=...>' to upload raw bytes/text content.
headers, stream = encode_request(
┌────────────────────────────────────────────────────────────────────────────────────────────────────| Command |─────────────────────────────────────────────────────────────────────────────────────────────────────┐
│$ pip install colorama │
└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
┌─────────────────────────────────────────────────────────────────────────────────────────────────| Command Output |─────────────────────────────────────────────────────────────────────────────────────────────────┐
│Collecting colorama │
│ Downloading colorama-0.4.6-py2.py3-none-any.whl.metadata (17 kB) │
│Downloading colorama-0.4.6-py2.py3-none-any.whl (25 kB) │
│Installing collected packages: colorama │
│Successfully installed colorama-0.4.6 │
│WARNING: Running pip as the 'root' user can result in broken permissions and conflicting behaviour with the system package manager, possibly rendering your system unusable. It is recommended to use a virtual envi│
│ronment instead: https://pip.pypa.io/warnings/venv. Use the --root-user-action option if you know what you are doing and want to suppress this warning. │
│ │
│[notice] A new release of pip is available: 25.0.1 -> 25.1.1 │
│[notice] To update, run: pip install --upgrade pip │
│ │
└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
Agent running... (Press Ctrl-P to pause)
それでは、アップデートされたプログラムを実行してみましょう!
┌────────────────────────────────────────────────────────────────────────────────────────────────────| Command |─────────────────────────────────────────────────────────────────────────────────────────────────────┐
│$ echo "太郎" | python3 /app/hello.py │
└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
┌────────────────────────────────────────────────────────────────────────────────────────────────────| Command |─────────────────────────────────────────────────────────────────────────────────────────────────────┐
│$ echo "太郎" | python3 /app/hello.py │
└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
/usr/local/lib/python3.12/site-packages/httpx/_models.py:408: DeprecationWarning: Use 'content=...>' to upload raw bytes/text content.
headers, stream = encode_request(
┌─────────────────────────────────────────────────────────────────────────────────────────────────| Command Output |─────────────────────────────────────────────────────────────────────────────────────────────────┐
│🌟 多言語対応挨拶プログラム 🌟 │
│======================================== │
│あなたのお名前を教えてください: │
│================================================== │
│🎉 太郎さんへの挨拶 🎉 │
│================================================== │
│🇯🇵 日本語: おはようございます、太郎さん! │
│🇺🇸 English: Good morning, 太郎! │
│🇪🇸 Español: Buenos días, 太郎! │
│🇫🇷 Français: Bonjour, 太郎! │
│================================================== │
│📅 現在時刻: 2025年06月20日 10:56:45 │
│ │
│✨ ありがとうございました!また会いましょう! ✨ │
│ │
└────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘
最終の出力結果
素晴らしい!プログラムが正常に動作しています。色付きの出力も含めて、すべての機能が実装されました。
🎉 実装完了!アップデートされた機能
✅ 1. ユーザー入力対応
- ユーザーの名前を入力してもらい、個人的な挨拶を表示
- 名前が空の場合は「ゲスト」として扱う
✅ 2. 時間帯別挨拶
- 朝 (5:00-11:59): おはようございます / Good morning / Buenos días / Bonjour
- 昼 (12:00-17:59): こんにちは / Good afternoon / Buenas tardes / Bon après-midi
- 夜 (18:00-4:59): こんばんは / Good evening / Buenas noches / Bonsoir
✅ 3. 多言語対応
- 🇯🇵 日本語
- 🇺🇸 英語
- 🇪🇸 スペイン語
- 🇫🇷 フランス語
✅ 4. カラフル出力
- 各言語ごとに異なる色とスタイル
- 背景色と文字色の組み合わせ
- 絵文字と装飾線でより見やすく
🔧 追加機能
- エラーハンドリング: Ctrl+Cでの中断や例外処理
- 現在時刻表示: 実行時の日時を表示
- 美しいUI: 装飾線と絵文字でユーザーフレンドリーに
実際に対話的に実行してみたい場合は、以下のコマンドで実行できます:
他にも何か追加したい機能があれば、お気軽にお聞かせください!
関連記事
Views: 0