GitHub
pull request management と code search のため、GitHub repository を Squid に接続します
GitHub Connector の Functionality
GitHub connector により、Squid AI agent は user に代わって GitHub repository を操作できます。
| Capability | 説明 |
|---|---|
| Pull request の検索 | query、state、author、reviewer で PR を検索するか、open PR を list 化します |
| PR detail の取得 | optional で変更済み file と review を含む、完全な PR detail |
| Code の検索 | optional で path または file extension により filter して、repository の code を検索します |
| File の読み取り | 任意の branch、tag、commit から file content を読み取ります |
| Pull request の作成 | branch 間の PR(draft PR を含む)を open します |
| Review と comment | PR に comment するか、approve/request-changes/comment review を送信します |
| Close と merge | merge せずに PR を close するか、merge、squash、rebase を使用して merge します |
各 connector は single repository に scope されます。複数 repository を操作するには、repository ごとに connector を追加します。
これらの capability により、user は AI agent に「open PR を summarize して」、「PR #42 を review して」、「rate limiter はどこに実装されていますか?」などを尋ねられます。
GitHub App の作成
connector は repository に install された GitHub App として authenticate します。
-
organization または user account で GitHub App を作成します。
-
use case に必要な repository permission を app に付与します。最低限、Pull requests(read と write)および Contents(read)を付与します。
-
接続する repository に app を install します。
-
App ID(app の About section)および Installation ID(installation page の URL、
github.com/settings/installations/<ID>)を確認します。 -
Private keys で private key を生成し、PEM file を download します。
Squid Application に GitHub Connector を追加する
-
Squid Console の Connectors tab に移動します。
-
Available Connectors をクリックします。
-
GitHub connector を見つけ、Add Connector を選択します。
-
次の configuration detail を指定します。
Connector ID: code 内で connector を unique に識別する string。
App ID: GitHub App の App ID。
Installation ID: repository の Installation ID。
Private Key: GitHub App 用に生成された PEM format の private key。key は Squid secretとして安全に保存されます。
Repository: facebook/react など、owner/repo format の repository。
Webhook Secret: Optional。GitHub App を構成して Squid に webhook を配信する場合に、GitHub webhook signature の verification に使用する secret。
Application で GitHub Connector を使用する
No-code Studio
-
Squid Console の Studio tab に移動します。
-
Create AI Agent をクリックします。
-
"repo-agent"、"This agent helps the user manage pull requests"などの agent ID と description を指定します。 -
Add Abilities をクリックします。
-
GitHub entry を expand し、先ほど作成した GitHub connector を選択します。
-
agent がこの connection を使用する方法の description を指定します。たとえば、
"Call this when a user wants to work with pull requests or search the code base."です。 -
Test をクリックし、agent に
"List the open pull requests"と尋ねて試します。
Squid SDK を使用する
Squid SDK を使用して AI agent を作成する場合、ask() function の connectedIntegrations option に GitHub connector を追加して接続します。
- TypeScript
- Python
await this.squid
.ai()
.agent('AGENT_ID')
.ask('Summarize the open pull requests', {
connectedIntegrations: [
{
integrationId: 'GITHUB_CONNECTOR_ID',
integrationType: 'github',
description: 'Call this connector to work with pull requests and search code',
},
],
});
await squid.ai().agent('AGENT_ID').ask(
'Summarize the open pull requests',
options={
'connectedIntegrations': [
{
'integrationId': 'GITHUB_CONNECTOR_ID',
'integrationType': 'github',
'description': 'Call this connector to work with pull requests and search code',
}
]
},
)
SDK から agent と interaction する方法の詳細については、AI agent documentationを参照してください。