AgentConnect
Agents

Authorize a repository for an agent

Grant the agent access to one code-host repository. With provider: github (the default) the repository is named owner/repo and must be covered by one of the organization’s GitHub App installations; App-backed workspaces may add repositories beyond their implicit workspace grant, scratch workspaces may add any covered repository, and a manual GitHub workspace may explicitly authorize only its own repository for control-plane review/check effects. With the per-user gate configured, the caller must hold the matching GitHub permission (read/comment tiers need read, write needs write). With provider: gitlab the project is named by its numeric id and must already be a managed GitLab project in this organization; authorizing it provisions the agent’s own GitLab bot account and project membership before the grant lands. With provider: gitea the repository is named by its numeric id and must already be a managed Gitea repository in this organization; the organization’s bot token serves every tier, so the tier is a clamp on what the agent may do, never a provider role. materialize chooses how sessions stand in the repository: always (the default) clones it as a secondary workspace root on every session, on-demand grants credentials only and the agent clones during the turn, and decision makes it a candidate the per-session repository selector may check out. decision needs the agent’s repositorySelector (409 REPOSITORY_SELECTOR_MISSING otherwise) and daemons serving the agent that advertise repo-selector-v1 (409 DAEMON_FEATURE_MISSING otherwise).

POST
/v1/orgs/{orgId}/agents/{agentId}/repos

Authorization

bearerAuth
AuthorizationBearer <token>

In: header

Path Parameters

orgId*string
agentId*string

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/v1/orgs/string/agents/string/repos" \  -H "Content-Type: application/json" \  -d '{    "provider": "gitlab",    "projectId": "string"  }'
{  "id": "string",  "provider": "github",  "repoId": "string",  "repoFullName": "string",  "access": "read",  "materialize": "always",  "createdBy": "string",  "createdAt": "string"}