GitAgent 入門 — フレームワーク乱立時代の「AIエージェントのDocker」
LangChain、AutoGen、Claude Code、CrewAI、OpenAI Agents SDK...
2026年のAIエージェント界隈は、フレームワークが乱立しています。「とりあえずLangChainで作ったけど、Claude Codeの方が便利そうだからそっちに移したい」となったとき、大抵はコードを大幅に書き直すことになります。
これ、コンテナ技術が普及する前のサーバー環境の話に似ていると思いませんか。「開発はMacで動くけど本番のLinuxでは動かない」問題。それをDockerが「コンテナという抽象レイヤー」で解決したように、AIエージェントにも同じ発想が必要だという話が出てきました。
2026年3月に登場したGitAgentは、そのポジションを狙っているツールです。
GitAgentとは何か
GitAgentは「AIエージェントのフレームワーク乱立問題を解決する」をコンセプトにしたオープンソースのツールです。
コア機能は一言で言うと「エージェントの定義を一度書けば、複数のフレームワームで動かせる」こと。
# GitAgentのインストール
pip install gitagent
# エージェントの定義ファイルを作成
gitagent init my-agent
# 任意のフレームワームにエクスポート
gitagent export --target claude-code
gitagent export --target langchain
gitagent export --target autogen
gitagent export --target crewai
なぜフレームワーク間の移植が難しいのか
まず現状の問題を整理します。
LangChainでエージェントを書くと、こんな構造になります。
# LangChainスタイル
from langchain.agents import AgentExecutor, create_openai_functions_agent
from langchain_core.prompts import ChatPromptTemplate
tools = [search_tool, calculator_tool]
prompt = ChatPromptTemplate.from_messages([...])
agent = create_openai_functions_agent(llm, tools, prompt)
executor = AgentExecutor(agent=agent, tools=tools)
同じエージェントをClaude Code Channelsで動かそうとすると、全く別の書き方が必要になります。AutoGenもCrewAIも同様です。
ロジック自体は同じなのに、フレームワームごとに書き直しが発生する。これがエンジニアを縛っています。
GitAgentのアーキテクチャ
GitAgentはエージェントの定義をフレームワーム非依存の中間表現として保持します。
# agent.gitagent.yaml(フレームワーム非依存の定義)
name: research-agent
version: "1.0"
description: "ウェブ検索と要約ができるリサーチエージェント"
model:
provider: anthropic
model: claude-sonnet-4-6
temperature: 0.7
system_prompt: |
あなたは優秀なリサーチアシスタントです。
ユーザーの質問に対して、検索して正確な情報を提供します。
tools:
- name: web_search
type: builtin
config:
max_results: 5
- name: summarize
type: custom
path: ./tools/summarize.py
function: summarize_text
memory:
type: conversation
max_messages: 20
output:
format: structured
schema:
answer: string
sources: list
confidence: float
この定義ファイルから、各フレームワーム向けのコードを自動生成します。
# Dockerfileに似た「一度定義して、どこでも動かす」発想
# エクスポート例:LangChainへ
gitagent export --target langchain --output ./langchain-agent/
# エクスポート例:AutoGenへ
gitagent export --target autogen --output ./autogen-agent/
# エクスポート例:Claude Codeへ
gitagent export --target claude-code --output ./claude-agent/
カスタムツールの定義
GitAgentの強みの一つが、カスタムツールの書き方もフレームワーム非依存にできる点です。
# tools/summarize.py(GitAgent標準形式)
from gitagent.tools import tool, ToolInput, ToolOutput
@tool(
name="summarize",
description="長いテキストを指定した長さに要約する",
inputs={"text": "str", "max_length": "int"},
outputs={"summary": "str"}
)
def summarize_text(input: ToolInput) -> ToolOutput:
text = input.get("text")
max_length = input.get("max_length", 200)
# 要約ロジック(実際はLLMを呼ぶなど)
summary = text[:max_length] + "..." if len(text) > max_length else text
return ToolOutput({"summary": summary})
このツール定義がそのままLangChainのToolとしても、Claude CodeのMCPツールとしても変換されます。
GitHubとの連携
名前に「Git」が入っているのは偶然ではありません。GitAgentはGitとの統合を重視しています。
# エージェント定義をGitHubリポジトリで管理
git add agent.gitagent.yaml tools/
git commit -m "Add summarize tool"
git push origin main
# 別の開発者がクローンして別フレームワームで動かす
git clone https://github.com/your-org/research-agent
cd research-agent
gitagent export --target crewai
エージェントの定義をコードとして管理し、チームで共有・バージョン管理する。これはDockerのDockerfileと同じ発想です。
実際の移植フロー
既存のLangChainエージェントをGitAgentに移行する手順のイメージです。
# Step 1: 既存のLangChainプロジェクトからGitAgent定義を生成
gitagent import --from langchain ./existing-agent/ --output agent.gitagent.yaml
# Step 2: 定義を確認・編集
cat agent.gitagent.yaml
# Step 3: Claude Code向けにエクスポート
gitagent export --target claude-code --output ./claude-agent/
# Step 4: 動作確認
cd claude-agent
claude-code run agent.py "リサーチしたいことを入力"
完全な自動変換には限界がありますが、ボイラープレートの大部分を自動生成できる点は価値があります。
現時点での制限と注意点
GitAgentはまだ2026年3月にリリースされたばかりで、発展途上の部分があります。
対応フレームワームの範囲
現在サポートされているのはLangChain、AutoGen、CrewAI、Claude Code、OpenAI Agents SDKです。Dapr AgentsやPydantic AIなど新しいフレームワームはまだ対応していません。
高度な機能の変換精度
シンプルなReActパターンのエージェントは問題ないですが、フレームワームに特化した高度な機能(LangChainのLCELパイプラインの複雑な構成など)は変換が不完全なことがあります。
本番運用の実績
まだリリースから日が浅いため、大規模な本番環境での実績は少ないです。
まとめ
GitAgentが提示している問題意識は正しいと思っています。
AIエージェントのフレームワームは今後もさらに増えます。「このフレームワームに投資したら乗り換えが大変」という理由で技術選択が歪むのは、開発者としてもったいない状況です。
Dockerがインフラの「どこでも動く」を実現したように、GitAgentが目指す「どのフレームワームでも動く」は、エージェント開発の自由度を大きく上げる可能性があります。
まだ発展途上ですが、定義ファイルのフォーマットを見るだけでも、エージェント設計の整理になるかもしれません。