Skip to content

Commit 20e9ef5

Browse files
committed
add docs manually
1 parent 4f2c9de commit 20e9ef5

File tree

10 files changed

+218
-99
lines changed

10 files changed

+218
-99
lines changed

README.md

Lines changed: 3 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -6,75 +6,8 @@
66

77
# template-langgraph
88

9-
This is a template repository for Python
9+
A comprehensive LangGraph template for building AI Agents with Python.
1010

11-
## Prerequisites
11+
## Documentation
1212

13-
- [Python 3.10+](https://www.python.org/downloads/)
14-
- [uv](https://docs.astral.sh/uv/getting-started/installation/)
15-
- [GNU Make](https://www.gnu.org/software/make/)
16-
17-
## Development instructions
18-
19-
### Local development
20-
21-
Use Makefile to run the project locally.
22-
23-
```shell
24-
# help
25-
make
26-
27-
# install dependencies for development
28-
make install-deps-dev
29-
30-
# run tests
31-
make test
32-
33-
# run CI tests
34-
make ci-test
35-
```
36-
37-
### Docker development
38-
39-
```shell
40-
# build docker image
41-
make docker-build
42-
43-
# run docker container
44-
make docker-run
45-
46-
# run CI tests in docker container
47-
make ci-test-docker
48-
```
49-
50-
## Deployment instructions
51-
52-
### Docker Hub
53-
54-
To publish the docker image to Docker Hub, you need to [create access token](https://app.docker.com/settings/personal-access-tokens/create) and set the following secrets in the repository settings.
55-
56-
```shell
57-
gh secret set DOCKERHUB_USERNAME --body $DOCKERHUB_USERNAME
58-
gh secret set DOCKERHUB_TOKEN --body $DOCKERHUB_TOKEN
59-
```
60-
61-
### Azure Static Web Apps
62-
63-
```shell
64-
RESOURCE_GROUP_NAME=your-resource-group-name
65-
SWA_NAME=your-static-web-app-name
66-
67-
# Create a static app
68-
az staticwebapp create --name $SWA_NAME --resource-group $RESOURCE_GROUP_NAME
69-
70-
# Retrieve the API key
71-
AZURE_STATIC_WEB_APPS_API_TOKEN=$(az staticwebapp secrets list --name $SWA_NAME --query "properties.apiKey" -o tsv)
72-
73-
# Set the API key as a GitHub secret
74-
gh secret set AZURE_STATIC_WEB_APPS_API_TOKEN --body $AZURE_STATIC_WEB_APPS_API_TOKEN
75-
```
76-
77-
Refer to the following links for more information:
78-
79-
- [Deploying to Azure Static Web App](https://docs.github.com/en/actions/use-cases-and-examples/deploying/deploying-to-azure-static-web-app)
80-
- [Create a static web app: `az staticwebapp create`](https://learn.microsoft.com/en-us/cli/azure/staticwebapp?view=azure-cli-latest#az-staticwebapp-create)
13+
See the [documentation](https://ks6088ts-labs.github.io/template-langgraph/) for more information.

docs/deployment.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
## Deployment instructions
2+
3+
### Docker Hub
4+
5+
To publish the docker image to Docker Hub, you need to [create access token](https://app.docker.com/settings/personal-access-tokens/create) and set the following secrets in the repository settings.
6+
7+
```shell
8+
gh secret set DOCKERHUB_USERNAME --body $DOCKERHUB_USERNAME
9+
gh secret set DOCKERHUB_TOKEN --body $DOCKERHUB_TOKEN
10+
```
11+
12+
### Azure Static Web Apps
13+
14+
```shell
15+
RESOURCE_GROUP_NAME=your-resource-group-name
16+
SWA_NAME=your-static-web-app-name
17+
18+
# Create a static app
19+
az staticwebapp create --name $SWA_NAME --resource-group $RESOURCE_GROUP_NAME
20+
21+
# Retrieve the API key
22+
AZURE_STATIC_WEB_APPS_API_TOKEN=$(az staticwebapp secrets list --name $SWA_NAME --query "properties.apiKey" -o tsv)
23+
24+
# Set the API key as a GitHub secret
25+
gh secret set AZURE_STATIC_WEB_APPS_API_TOKEN --body $AZURE_STATIC_WEB_APPS_API_TOKEN
26+
```
27+
28+
Refer to the following links for more information:
29+
30+
- [Deploying to Azure Static Web App](https://docs.github.com/en/actions/use-cases-and-examples/deploying/deploying-to-azure-static-web-app)
31+
- [Create a static web app: `az staticwebapp create`](https://learn.microsoft.com/en-us/cli/azure/staticwebapp?view=azure-cli-latest#az-staticwebapp-create)

docs/development.md

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
## Development instructions
2+
3+
### Local development
4+
5+
Use Makefile to run the project locally.
6+
7+
```shell
8+
# help
9+
make
10+
11+
# install dependencies for development
12+
make install-deps-dev
13+
14+
# run tests
15+
make test
16+
17+
# run CI tests
18+
make ci-test
19+
```
20+
21+
### Testing
22+
23+
```shell
24+
# Run all tests for AI agents
25+
bash scripts/test_all.sh
26+
```
27+
28+
### Docker development
29+
30+
```shell
31+
# build docker image
32+
make docker-build
33+
34+
# run docker container
35+
make docker-run
36+
37+
# run CI tests in docker container
38+
make ci-test-docker
39+
```

docs/faq.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
## FAQ
2+
3+
### Docker Compose で Elasticsearch を起動できない
4+
5+
**現象:**
6+
7+
WSL2 上で `docker compose up elasticsearch` を実行した際に、以下のエラーが発生する
8+
9+
`java.lang.IllegalStateException: failed to obtain node locks, tried [/usr/share/elasticsearch/data]; maybe these locations are not writable or multiple nodes were started on the same data path?`
10+
11+
**原因:**
12+
13+
Elasticsearch がデータディレクトリ(/usr/share/elasticsearch/data)にロックファイルを作成できないことを示しています。
14+
15+
**対処方法:**
16+
17+
ディレクトリの権限を修正するために、以下のコマンドを実行してください。
18+
19+
```shell
20+
sudo chown -R 1000:1000 ./assets/es_data
21+
```

docs/images/jupyterlab.png

253 KB
Loading

docs/images/langgraph-studio.png

324 KB
Loading

docs/index.md

Lines changed: 74 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,94 @@
11
# template-langgraph
22

3-
## Overview
3+
## Prerequisites
4+
5+
- [Python 3.10+](https://www.python.org/downloads/)
6+
- [uv](https://docs.astral.sh/uv/getting-started/installation/)
7+
- [GNU Make](https://www.gnu.org/software/make/)
8+
9+
## Getting Started
10+
11+
### Set up local environment
412

513
```shell
6-
# Set up environment
14+
# Clone the repository
15+
git clone https://github.com/ks6088ts-labs/template-langgraph.git
16+
cd template-langgraph
17+
18+
# Start services using Docker Compose (Requires Docker)
719
docker compose up -d
20+
21+
# Create a .env file based on the template
22+
cp .env.template .env
23+
24+
# Install required Python packages (Requires uv)
25+
uv sync --all-extras
826
```
927

10-
## Testing
28+
### Set up infrastructure
1129

12-
see [test_all.sh](../scripts/test_all.sh) for all operations
30+
Here are some commands you can use:
31+
32+
**Create Qdrant collection:**
33+
34+
> [!NOTE]
35+
> Qdrant service is expected to be running
1336
1437
```shell
15-
# Test all scripts
16-
bash scripts/test_all.sh
38+
uv run python scripts/qdrant_operator.py add-documents \
39+
--collection-name qa_kabuto \
40+
--verbose
1741
```
1842

19-
## References
43+
**Create Elasticsearch index:**
2044

21-
### LangGraph
45+
> [!NOTE]
46+
> Elasticsearch service is expected to be running
2247
23-
- [Build a custom workflow](https://langchain-ai.github.io/langgraph/concepts/why-langgraph/)
24-
- [LangGraphの(LLMなし)Human-in-the-loopを試してみた](https://qiita.com/te_yama/items/db38201af60dec76384d)
25-
- [🤖 LangGraph Multi-Agent Supervisor](https://github.com/langchain-ai/langgraph-supervisor-py)
26-
- [Software Design誌「実践LLMアプリケーション開発」第24回サンプルコード](https://github.com/mahm/softwaredesign-llm-application/tree/main/24)
48+
```shell
49+
uv run python scripts/elasticsearch_operator.py create-index \
50+
--index-name docs_kabuto \
51+
--verbose
52+
```
2753

28-
### Sample Codes
54+
### Run the application
2955

30-
- [「現場で活用するためのAIエージェント実践入門」リポジトリ](https://github.com/masamasa59/genai-agent-advanced-book)
56+
#### LangGraph Studio
3157

32-
### Models
58+
From the command line, you can run the LangGraph Studio to interact with the application.
3359

34-
- [AzureOpenAIEmbeddings](https://python.langchain.com/docs/integrations/text_embedding/azureopenai/)
60+
```shell
61+
uv run langgraph dev
62+
```
3563

36-
### Tools
64+
![langgraph-studio.png](./images/langgraph-studio.png)
3765

38-
- [CSVLoader](https://python.langchain.com/docs/how_to/document_loader_csv/)
39-
- [Qdrant](https://github.com/qdrant/qdrant)
66+
#### Jupyter Lab
67+
68+
From Jupyter Lab, you can run the notebooks in the `notebooks` directory to run various applications.
69+
70+
```shell
71+
# Run Jupyter Lab
72+
uv run jupyter lab
73+
74+
# Go to http://localhost:8888 in your browser and run notebooks/*.ipynb.
75+
```
76+
77+
![jupyterlab.png](./images/jupyterlab.png)
78+
79+
#### Terminal
80+
81+
From the command line, you can run scripts in the `scripts` directory to run various applications.
82+
83+
```shell
84+
uv run python scripts/agent_operator.py run \
85+
--name "chat_with_tools_agent" \
86+
--question "KABUTOの起動時に、画面全体が紫色に点滅し、システムがフリーズします。KABUTO のマニュアルから、関連する情報を取得したり過去のシステムのトラブル シュート事例が蓄積されたデータベースから、関連する情報を取得して質問に答えてください" \
87+
--verbose
88+
2025-08-05 11:27:40,949 [ INFO] -------------------- (agent_operator.py:104)
89+
2025-08-05 11:27:40,949 [ INFO] Event: {'chat_with_tools': {'messages': [AIMessage(content='', additional_kwargs={'tool_calls': [{'index': 0, 'id': 'call_LTenxsczZMuCdIAK8IBT9e7r', 'function': {'arguments': '{"keywords": "KABUTO 起動 紫色 点滅 フリーズ"}', 'name': 'search_elasticsearch'}, 'type': 'function'}, {'index': 1, 'id': 'call_POOYozcQOSjnXEaVkbxQpTz7', 'function': {'arguments': '{"keywords": "KABUTO 起動 紫色 点滅 フリーズ"}', 'name': 'search_qdrant'}, 'type': 'function'}]}, response_metadata={'finish_reason': 'tool_calls', 'model_name': 'gpt-4o-2024-11-20', 'system_fingerprint': 'fp_ee1d74bde0'}, id='run--60587ca8-d54e-4c66-8d9c-c5a99ae479a9-0', tool_calls=[{'name': 'search_elasticsearch', 'args': {'keywords': 'KABUTO 起動 紫色 点滅 フリーズ'}, 'id': 'call_LTenxsczZMuCdIAK8IBT9e7r', 'type': 'tool_call'}, {'name': 'search_qdrant', 'args': {'keywords': 'KABUTO 起動 紫色 点滅 フリーズ'}, 'id': 'call_POOYozcQOSjnXEaVkbxQpTz7', 'type': 'tool_call'}])]}} (agent_operator.py:105)
90+
2025-08-05 11:27:41,458 [ INFO] -------------------- (agent_operator.py:104)
91+
2025-08-05 11:27:41,458 [ INFO] Event: {'tools': {'messages': [ToolMessage(content='"[ElasticsearchOutput(file_name=\'docs_kabuto.pdf\', content=\'「⻤灯」の実⾏中は、冷却システムが⼀時的に停⽌し、無⾳となる。これは内部エネルギーの流れを最適化するため\\\\nの仕様であり、異常ではない。ただし、この無⾳状態が 15 分以上継続する場合は、過熱の可能性があるため、アプリ\\\\nケーションの強制終了およびシステムの再起動が推奨される。\\\\n第 3 章 ソフトウェア・オペレーション\\\\n3.1 起動プロトコル\\\\nKABUTO の起動シーケンスは、「シノビ・プロトコル」に基づき実⾏される。このプロトコルの初期化フェーズで、\\\\n内部クロックと接続された外部周辺機器のクロックとの同期に失敗した場合、画⾯全体が紫⾊に点滅し、システムが\'), ElasticsearchOutput(file_name=\'docs_kabuto.pdf\', content=\'2.1 電源・起動システム\\\\nKABUTO の電源ランプは、通常の動作状態を以下のパターンで表⽰する。待機状態では⾚⾊点滅、稼働状態では⻘⾊\\\\n点滅が繰り返される。このパターンにない緑⾊の点滅は、システムが「禅モード」に移⾏していることを⽰す。禅モ\\\\nードでは、パフォーマンスが最⼩限に抑えられ、バックグラウンドでのシステム⾃⼰修復が実⾏される。このモード\\\\nからの強制離脱は、 KABUTO 本体に設置された「⿓⽟」ボタンを 5 秒以上⻑押しすることで可能となる。また、電源\\\\nOFF 後も微細な電流が流れ続ける「夢の海」と呼ばれる待機モードが存在し、これにより次回の起動⾼速化が図られ\'), ElasticsearchOutput(file_name=\'docs_kabuto.pdf\', content=\'フリーズする。この問題は、 KABUTO 本体の再起動前に、すべての周辺機器を 5 秒以上電源から抜くことで、外部ク\\\\nロックのキャッシュがクリアされ、同期が正常に⾏われる可能性が⾼まる。\\\\n3.2 セキュリティ・認証システム\\\\nログイン認証は、パスワード⼊⼒に加え、セキュリティモジュール「百⻤夜⾏」によるログイン試⾏者の「精神波\\\\n形」解析を伴う。パスワードが正しく⼊⼒された場合でも、精神波形が登録されたユーザーと⼀致しないと判断され\')]"', name='search_elasticsearch', id='33ac53bd-22d8-4fe1-9094-bd4869c4771a', tool_call_id='call_LTenxsczZMuCdIAK8IBT9e7r'), ToolMessage(content='"[QdrantOutput(file_name=\'./data/qa_kabuto.csv\', content=\'q: KABUTOの起動時に、画面全体が紫色に点滅し、システムがフリーズします。 a: この現象は、「シノビ・プロトコル」が初期化フェーズで、内部クロックと外部クロックの同期に失敗している場合に発生します。KABUTO本体を再起動する前に、必ず接続されているすべての周辺機器を5秒以上、電源から抜いてください。これにより、外部クロックのキャッシュがクリアされ、同期が正常に行われる可能性が高まります。\'), QdrantOutput(file_name=\'./data/qa_kabuto.csv\', content=\'q: KABUTOの電源ランプが、赤と青の交互点滅ではなく、緑色で点滅しています。 a: 通常、電源ランプは赤(待機中)と青(稼働中)の点滅を繰り返します。緑色の点滅は、KABUTOが「禅モード」に入っており、パフォーマンスを最小限に抑え、バックグラウンドでシステム自己修復を行っている状態を示します。この状態では、ユーザー操作はほとんど受け付けられません。このモードから強制的に脱出するには、KABUTO本体の「龍玉」ボタンを5秒以上長押ししてください。\'), QdrantOutput(file_name=\'./data/qa_kabuto.csv\', content=\'q: KABUTOの画面の隅に、時々「狐火」のような光の点が、不規則に現れては消えます。 a: 「狐火」は、KABUTOの演算コア「稲荷」が、膨大な量のタスクを処理しきれずに、一部の計算結果が視覚的なノイズとして現れている現象です。これは、システム負荷が高いことを示しています。この現象が頻繁に発生する場合は、バックグラウンドで動作している不要なアプリケーションを終了させるか、KABUTOを再起動してください。\')]"', name='search_qdrant', id='97878816-f478-4bd5-a78e-0b668311bf05', tool_call_id='call_POOYozcQOSjnXEaVkbxQpTz7')]}} (agent_operator.py:105)
92+
2025-08-05 11:27:45,507 [ INFO] -------------------- (agent_operator.py:104)
93+
2025-08-05 11:27:45,508 [ INFO] Event: {'chat_with_tools': {'messages': [AIMessage(content='KABUTOの起動時に画面全体が紫色に点滅し、システムがフリーズする問題について、以下の情報が得られました。\n\n### 原因\nこの現象は、「シノビ・プロトコル」が初期化フェーズで、内部クロックと外部クロックの同期に失敗している場合に発生します。\n\n### 解決方法\n1. **周辺機器の電源を切る**:\n - KABUTO本体を再起動する前に、接続されているすべての周辺機器を5秒以上電源から抜いてください。\n - これにより、外部クロックのキャッシュがクリアされ、同期が正常に行われる可能性が高まります。\n\n2. **強制再起動**:\n - 必要に応じて、KABUTO本体の「龍玉」ボタンを5秒以上長押しして強制再起動を試みてください。\n\n### 注意点\n- この問題が頻繁に発生する場合は、システムの内部エネルギー流れや冷却システムの状態を確認する必要があります。\n- 再起動後も問題が解決しない場合は、専門の技術者に相談することをお勧めします。\n\nこれらの手順を試してみてください。問題が解決しない場合は、さらに詳細な情報を提供していただければ追加のサポートを行います。', additional_kwargs={}, response_metadata={'finish_reason': 'stop', 'model_name': 'gpt-4o-2024-11-20', 'system_fingerprint': 'fp_ee1d74bde0'}, id='run--c3c0ecb8-b85f-4072-8420-eeb94f2b62a1-0')]}} (agent_operator.py:105)
94+
```

docs/references.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
## References
2+
3+
### LangGraph
4+
5+
- [Build a custom workflow](https://langchain-ai.github.io/langgraph/concepts/why-langgraph/)
6+
- [LangGraph の(LLM なし)Human-in-the-loop を試してみた](https://qiita.com/te_yama/items/db38201af60dec76384d)
7+
- [🤖 LangGraph Multi-Agent Supervisor](https://github.com/langchain-ai/langgraph-supervisor-py)
8+
- [Software Design 誌「実践 LLM アプリケーション開発」第 24 回サンプルコード](https://github.com/mahm/softwaredesign-llm-application/tree/main/24)
9+
10+
### Sample Codes
11+
12+
- [「現場で活用するための AI エージェント実践入門」リポジトリ](https://github.com/masamasa59/genai-agent-advanced-book)
13+
14+
### Models
15+
16+
- [AzureOpenAIEmbeddings](https://python.langchain.com/docs/integrations/text_embedding/azureopenai/)
17+
18+
### Tools
19+
20+
- [CSVLoader](https://python.langchain.com/docs/how_to/document_loader_csv/)
21+
- [Qdrant](https://github.com/qdrant/qdrant)

mkdocs.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ repo_url: https://github.com/ks6088ts-labs/template-langgraph
55
repo_name: ks6088ts-labs/template-langgraph
66
nav:
77
- Home: index.md
8+
- Development: development.md
9+
- Deployment: deployment.md
10+
- FAQ: faq.md
11+
- References: references.md
812
theme:
913
name: material
1014
# https://squidfunk.github.io/mkdocs-material/setup/changing-the-colors/#automatic-light-dark-mode

0 commit comments

Comments
 (0)