diff --git a/docs/docs.json b/docs/docs.json index 161d6d5ff..6247ada68 100644 --- a/docs/docs.json +++ b/docs/docs.json @@ -440,6 +440,7 @@ "en/enterprise/guides/build-crew", "en/enterprise/guides/prepare-for-deployment", "en/enterprise/guides/deploy-to-amp", + "en/enterprise/guides/private-package-registry", "en/enterprise/guides/kickoff-crew", "en/enterprise/guides/update-crew", "en/enterprise/guides/enable-crew-studio", @@ -878,6 +879,7 @@ "pt-BR/enterprise/guides/build-crew", "pt-BR/enterprise/guides/prepare-for-deployment", "pt-BR/enterprise/guides/deploy-to-amp", + "pt-BR/enterprise/guides/private-package-registry", "pt-BR/enterprise/guides/kickoff-crew", "pt-BR/enterprise/guides/update-crew", "pt-BR/enterprise/guides/enable-crew-studio", @@ -1343,6 +1345,7 @@ "ko/enterprise/guides/build-crew", "ko/enterprise/guides/prepare-for-deployment", "ko/enterprise/guides/deploy-to-amp", + "ko/enterprise/guides/private-package-registry", "ko/enterprise/guides/kickoff-crew", "ko/enterprise/guides/update-crew", "ko/enterprise/guides/enable-crew-studio", diff --git a/docs/en/enterprise/guides/deploy-to-amp.mdx b/docs/en/enterprise/guides/deploy-to-amp.mdx index 31ff8ca20..c0309c0b6 100644 --- a/docs/en/enterprise/guides/deploy-to-amp.mdx +++ b/docs/en/enterprise/guides/deploy-to-amp.mdx @@ -177,6 +177,11 @@ You need to push your crew to a GitHub repository. If you haven't created a crew ![Set Environment Variables](/images/enterprise/set-env-variables.png) + + Using private Python packages? You'll need to add your registry credentials here too. + See [Private Package Registries](/en/enterprise/guides/private-package-registry) for the required variables. + + diff --git a/docs/en/enterprise/guides/prepare-for-deployment.mdx b/docs/en/enterprise/guides/prepare-for-deployment.mdx index fe09e5319..3e472e4e6 100644 --- a/docs/en/enterprise/guides/prepare-for-deployment.mdx +++ b/docs/en/enterprise/guides/prepare-for-deployment.mdx @@ -256,6 +256,12 @@ Before deployment, ensure you have: 1. **LLM API keys** ready (OpenAI, Anthropic, Google, etc.) 2. **Tool API keys** if using external tools (Serper, etc.) + + If your project depends on packages from a **private PyPI registry**, you'll also need to configure + registry authentication credentials as environment variables. See the + [Private Package Registries](/en/enterprise/guides/private-package-registry) guide for details. + + Test your project locally with the same environment variables before deploying to catch configuration issues early. diff --git a/docs/en/enterprise/guides/private-package-registry.mdx b/docs/en/enterprise/guides/private-package-registry.mdx new file mode 100644 index 000000000..feb521436 --- /dev/null +++ b/docs/en/enterprise/guides/private-package-registry.mdx @@ -0,0 +1,263 @@ +--- +title: "Private Package Registries" +description: "Install private Python packages from authenticated PyPI registries in CrewAI AMP" +icon: "lock" +mode: "wide" +--- + + + This guide covers how to configure your CrewAI project to install Python packages + from private PyPI registries (Azure DevOps Artifacts, GitHub Packages, GitLab, AWS CodeArtifact, etc.) + when deploying to CrewAI AMP. + + +## When You Need This + +If your project depends on internal or proprietary Python packages hosted on a private registry +rather than the public PyPI, you'll need to: + +1. Tell UV **where** to find the package (an index URL) +2. Tell UV **which** packages come from that index (a source mapping) +3. Provide **credentials** so UV can authenticate during install + +CrewAI AMP uses [UV](https://docs.astral.sh/uv/) for dependency resolution and installation. +UV supports authenticated private registries through `pyproject.toml` configuration combined +with environment variables for credentials. + +## Step 1: Configure pyproject.toml + +Three pieces work together in your `pyproject.toml`: + +### 1a. Declare the dependency + +Add the private package to your `[project.dependencies]` like any other dependency: + +```toml +[project] +dependencies = [ + "crewai[tools]>=0.100.1,<1.0.0", + "my-private-package>=1.2.0", +] +``` + +### 1b. Define the index + +Register your private registry as a named index under `[[tool.uv.index]]`: + +```toml +[[tool.uv.index]] +name = "my-private-registry" +url = "https://pkgs.dev.azure.com/my-org/_packaging/my-feed/pypi/simple/" +explicit = true +``` + + + The `name` field is important — UV uses it to construct the environment variable names + for authentication (see [Step 2](#step-2-set-authentication-credentials) below). + + Setting `explicit = true` means UV won't search this index for every package — only the + ones you explicitly map to it in `[tool.uv.sources]`. This avoids unnecessary queries + against your private registry and protects against dependency confusion attacks. + + +### 1c. Map the package to the index + +Tell UV which packages should be resolved from your private index using `[tool.uv.sources]`: + +```toml +[tool.uv.sources] +my-private-package = { index = "my-private-registry" } +``` + +### Complete example + +```toml +[project] +name = "my-crew-project" +version = "0.1.0" +requires-python = ">=3.10,<=3.13" +dependencies = [ + "crewai[tools]>=0.100.1,<1.0.0", + "my-private-package>=1.2.0", +] + +[tool.crewai] +type = "crew" + +[[tool.uv.index]] +name = "my-private-registry" +url = "https://pkgs.dev.azure.com/my-org/_packaging/my-feed/pypi/simple/" +explicit = true + +[tool.uv.sources] +my-private-package = { index = "my-private-registry" } +``` + +After updating `pyproject.toml`, regenerate your lock file: + +```bash +uv lock +``` + + + Always commit the updated `uv.lock` along with your `pyproject.toml` changes. + The lock file is required for deployment — see [Prepare for Deployment](/en/enterprise/guides/prepare-for-deployment). + + +## Step 2: Set Authentication Credentials + +UV authenticates against private indexes using environment variables that follow a naming convention +based on the index name you defined in `pyproject.toml`: + +``` +UV_INDEX_{UPPER_NAME}_USERNAME +UV_INDEX_{UPPER_NAME}_PASSWORD +``` + +Where `{UPPER_NAME}` is your index name converted to **uppercase** with **hyphens replaced by underscores**. + +For example, an index named `my-private-registry` uses: + +| Variable | Value | +|----------|-------| +| `UV_INDEX_MY_PRIVATE_REGISTRY_USERNAME` | Your registry username or token name | +| `UV_INDEX_MY_PRIVATE_REGISTRY_PASSWORD` | Your registry password or token/PAT | + + + These environment variables **must** be added via the CrewAI AMP **Environment Variables** settings — + either globally or at the deployment level. They cannot be set in `.env` files or hardcoded in your project. + + See [Setting Environment Variables in AMP](#setting-environment-variables-in-amp) below. + + +## Registry Provider Reference + +The table below shows the index URL format and credential values for common registry providers. +Replace placeholder values with your actual organization and feed details. + +| Provider | Index URL | Username | Password | +|----------|-----------|----------|----------| +| **Azure DevOps Artifacts** | `https://pkgs.dev.azure.com/{org}/_packaging/{feed}/pypi/simple/` | Any non-empty string (e.g. `token`) | Personal Access Token (PAT) with Packaging Read scope | +| **GitHub Packages** | `https://pypi.pkg.github.com/{owner}/simple/` | GitHub username | Personal Access Token (classic) with `read:packages` scope | +| **GitLab Package Registry** | `https://gitlab.com/api/v4/projects/{project_id}/packages/pypi/simple/` | `__token__` | Project or Personal Access Token with `read_api` scope | +| **AWS CodeArtifact** | Use the URL from `aws codeartifact get-repository-endpoint` | `aws` | Token from `aws codeartifact get-authorization-token` | +| **Google Artifact Registry** | `https://{region}-python.pkg.dev/{project}/{repo}/simple/` | `_json_key_base64` | Base64-encoded service account key | +| **JFrog Artifactory** | `https://{instance}.jfrog.io/artifactory/api/pypi/{repo}/simple/` | Username or email | API key or identity token | +| **Self-hosted (devpi, Nexus, etc.)** | Your registry's simple API URL | Registry username | Registry password | + + + For **AWS CodeArtifact**, the authorization token expires periodically. + You'll need to refresh the `UV_INDEX_*_PASSWORD` value when it expires. + Consider automating this in your CI/CD pipeline. + + +## Setting Environment Variables in AMP + +Private registry credentials must be configured as environment variables in CrewAI AMP. +You have two options: + + + + 1. Log in to [CrewAI AMP](https://app.crewai.com) + 2. Navigate to your automation + 3. Open the **Environment Variables** tab + 4. Add each variable (`UV_INDEX_*_USERNAME` and `UV_INDEX_*_PASSWORD`) with its value + + See the [Deploy to AMP — Set Environment Variables](/en/enterprise/guides/deploy-to-amp#set-environment-variables) step for details. + + + Add the variables to your local `.env` file before running `crewai deploy create`. + The CLI will securely transfer them to the platform: + + ```bash + # .env + OPENAI_API_KEY=sk-... + UV_INDEX_MY_PRIVATE_REGISTRY_USERNAME=token + UV_INDEX_MY_PRIVATE_REGISTRY_PASSWORD=your-pat-here + ``` + + ```bash + crewai deploy create + ``` + + + + + **Never** commit credentials to your repository. Use AMP environment variables for all secrets. + The `.env` file should be listed in `.gitignore`. + + +To update credentials on an existing deployment, see [Update Your Crew — Environment Variables](/en/enterprise/guides/update-crew). + +## How It All Fits Together + +When CrewAI AMP builds your automation, the resolution flow works like this: + + + + AMP pulls your repository and reads `pyproject.toml` and `uv.lock`. + + + UV reads `[tool.uv.sources]` to determine which index each package should come from. + + + For each private index, UV looks up `UV_INDEX_{NAME}_USERNAME` and `UV_INDEX_{NAME}_PASSWORD` + from the environment variables you configured in AMP. + + + UV downloads and installs all packages — both public (from PyPI) and private (from your registry). + + + Your crew or flow starts with all dependencies available. + + + +## Troubleshooting + +### Authentication Errors During Build + +**Symptom**: Build fails with `401 Unauthorized` or `403 Forbidden` when resolving a private package. + +**Check**: +- The `UV_INDEX_*` environment variable names match your index name exactly (uppercased, hyphens → underscores) +- Credentials are set in AMP environment variables, not just in a local `.env` +- Your token/PAT has the required read permissions for the package feed +- The token hasn't expired (especially relevant for AWS CodeArtifact) + +### Package Not Found + +**Symptom**: `No matching distribution found for my-private-package`. + +**Check**: +- The index URL in `pyproject.toml` ends with `/simple/` +- The `[tool.uv.sources]` entry maps the correct package name to the correct index name +- The package is actually published to your private registry +- Run `uv lock` locally with the same credentials to verify resolution works + +### Lock File Conflicts + +**Symptom**: `uv lock` fails or produces unexpected results after adding a private index. + +**Solution**: Set the credentials locally and regenerate: + +```bash +export UV_INDEX_MY_PRIVATE_REGISTRY_USERNAME=token +export UV_INDEX_MY_PRIVATE_REGISTRY_PASSWORD=your-pat +uv lock +``` + +Then commit the updated `uv.lock`. + +## Related Guides + + + + Verify project structure and dependencies before deploying. + + + Deploy your crew or flow and configure environment variables. + + + Update environment variables and push changes to a running deployment. + + diff --git a/docs/ko/enterprise/guides/deploy-to-amp.mdx b/docs/ko/enterprise/guides/deploy-to-amp.mdx index 5262701ee..66954c840 100644 --- a/docs/ko/enterprise/guides/deploy-to-amp.mdx +++ b/docs/ko/enterprise/guides/deploy-to-amp.mdx @@ -176,6 +176,11 @@ Crew를 GitHub 저장소에 푸시해야 합니다. 아직 Crew를 만들지 않 ![Set Environment Variables](/images/enterprise/set-env-variables.png) + + 프라이빗 Python 패키지를 사용하시나요? 여기에 레지스트리 자격 증명도 추가해야 합니다. + 필요한 변수는 [프라이빗 패키지 레지스트리](/ko/enterprise/guides/private-package-registry)를 참조하세요. + + diff --git a/docs/ko/enterprise/guides/prepare-for-deployment.mdx b/docs/ko/enterprise/guides/prepare-for-deployment.mdx index 9778dde4d..fa4d40109 100644 --- a/docs/ko/enterprise/guides/prepare-for-deployment.mdx +++ b/docs/ko/enterprise/guides/prepare-for-deployment.mdx @@ -256,6 +256,12 @@ Crews와 Flows 모두 `src/project_name/main.py`에 진입점이 있습니다: 1. **LLM API 키** (OpenAI, Anthropic, Google 등) 2. **도구 API 키** - 외부 도구를 사용하는 경우 (Serper 등) + + 프로젝트가 **프라이빗 PyPI 레지스트리**의 패키지에 의존하는 경우, 레지스트리 인증 자격 증명도 + 환경 변수로 구성해야 합니다. 자세한 내용은 + [프라이빗 패키지 레지스트리](/ko/enterprise/guides/private-package-registry) 가이드를 참조하세요. + + 구성 문제를 조기에 발견하기 위해 배포 전에 동일한 환경 변수로 로컬에서 프로젝트를 테스트하세요. diff --git a/docs/ko/enterprise/guides/private-package-registry.mdx b/docs/ko/enterprise/guides/private-package-registry.mdx new file mode 100644 index 000000000..41b07731f --- /dev/null +++ b/docs/ko/enterprise/guides/private-package-registry.mdx @@ -0,0 +1,261 @@ +--- +title: "프라이빗 패키지 레지스트리" +description: "CrewAI AMP에서 인증된 PyPI 레지스트리의 프라이빗 Python 패키지 설치하기" +icon: "lock" +mode: "wide" +--- + + + 이 가이드는 CrewAI AMP에 배포할 때 프라이빗 PyPI 레지스트리(Azure DevOps Artifacts, GitHub Packages, + GitLab, AWS CodeArtifact 등)에서 Python 패키지를 설치하도록 CrewAI 프로젝트를 구성하는 방법을 다룹니다. + + +## 이 가이드가 필요한 경우 + +프로젝트가 공개 PyPI가 아닌 프라이빗 레지스트리에 호스팅된 내부 또는 독점 Python 패키지에 +의존하는 경우, 다음을 수행해야 합니다: + +1. UV에 패키지를 **어디서** 찾을지 알려줍니다 (index URL) +2. UV에 **어떤** 패키지가 해당 index에서 오는지 알려줍니다 (source 매핑) +3. UV가 설치 중에 인증할 수 있도록 **자격 증명**을 제공합니다 + +CrewAI AMP는 의존성 해결 및 설치에 [UV](https://docs.astral.sh/uv/)를 사용합니다. +UV는 `pyproject.toml` 구성과 자격 증명용 환경 변수를 결합하여 인증된 프라이빗 레지스트리를 지원합니다. + +## 1단계: pyproject.toml 구성 + +`pyproject.toml`에서 세 가지 요소가 함께 작동합니다: + +### 1a. 의존성 선언 + +프라이빗 패키지를 다른 의존성과 마찬가지로 `[project.dependencies]`에 추가합니다: + +```toml +[project] +dependencies = [ + "crewai[tools]>=0.100.1,<1.0.0", + "my-private-package>=1.2.0", +] +``` + +### 1b. index 정의 + +프라이빗 레지스트리를 `[[tool.uv.index]]` 아래에 명명된 index로 등록합니다: + +```toml +[[tool.uv.index]] +name = "my-private-registry" +url = "https://pkgs.dev.azure.com/my-org/_packaging/my-feed/pypi/simple/" +explicit = true +``` + + + `name` 필드는 중요합니다 — UV는 이를 사용하여 인증을 위한 환경 변수 이름을 + 구성합니다 (아래 [2단계](#2단계-인증-자격-증명-설정)를 참조하세요). + + `explicit = true`를 설정하면 UV가 모든 패키지에 대해 이 index를 검색하지 않습니다 — + `[tool.uv.sources]`에서 명시적으로 매핑한 패키지만 검색합니다. 이렇게 하면 프라이빗 + 레지스트리에 대한 불필요한 쿼리를 방지하고 의존성 혼동 공격을 차단할 수 있습니다. + + +### 1c. 패키지를 index에 매핑 + +`[tool.uv.sources]`를 사용하여 프라이빗 index에서 해결해야 할 패키지를 UV에 알려줍니다: + +```toml +[tool.uv.sources] +my-private-package = { index = "my-private-registry" } +``` + +### 전체 예시 + +```toml +[project] +name = "my-crew-project" +version = "0.1.0" +requires-python = ">=3.10,<=3.13" +dependencies = [ + "crewai[tools]>=0.100.1,<1.0.0", + "my-private-package>=1.2.0", +] + +[tool.crewai] +type = "crew" + +[[tool.uv.index]] +name = "my-private-registry" +url = "https://pkgs.dev.azure.com/my-org/_packaging/my-feed/pypi/simple/" +explicit = true + +[tool.uv.sources] +my-private-package = { index = "my-private-registry" } +``` + +`pyproject.toml`을 업데이트한 후 lock 파일을 다시 생성합니다: + +```bash +uv lock +``` + + + 업데이트된 `uv.lock`을 항상 `pyproject.toml` 변경 사항과 함께 커밋하세요. + lock 파일은 배포에 필수입니다 — [배포 준비하기](/ko/enterprise/guides/prepare-for-deployment)를 참조하세요. + + +## 2단계: 인증 자격 증명 설정 + +UV는 `pyproject.toml`에서 정의한 index 이름을 기반으로 한 명명 규칙을 따르는 +환경 변수를 사용하여 프라이빗 index에 인증합니다: + +``` +UV_INDEX_{UPPER_NAME}_USERNAME +UV_INDEX_{UPPER_NAME}_PASSWORD +``` + +여기서 `{UPPER_NAME}`은 index 이름을 **대문자**로 변환하고 **하이픈을 언더스코어로 대체**한 것입니다. + +예를 들어, `my-private-registry`라는 이름의 index는 다음을 사용합니다: + +| 변수 | 값 | +|------|-----| +| `UV_INDEX_MY_PRIVATE_REGISTRY_USERNAME` | 레지스트리 사용자 이름 또는 토큰 이름 | +| `UV_INDEX_MY_PRIVATE_REGISTRY_PASSWORD` | 레지스트리 비밀번호 또는 토큰/PAT | + + + 이 환경 변수는 CrewAI AMP **환경 변수** 설정을 통해 **반드시** 추가해야 합니다 — + 전역적으로 또는 배포 수준에서. `.env` 파일에 설정하거나 프로젝트에 하드코딩할 수 없습니다. + + 아래 [AMP에서 환경 변수 설정](#amp에서-환경-변수-설정)을 참조하세요. + + +## 레지스트리 제공업체 참조 + +아래 표는 일반적인 레지스트리 제공업체의 index URL 형식과 자격 증명 값을 보여줍니다. +자리 표시자 값을 실제 조직 및 피드 세부 정보로 대체하세요. + +| 제공업체 | Index URL | 사용자 이름 | 비밀번호 | +|---------|-----------|-----------|---------| +| **Azure DevOps Artifacts** | `https://pkgs.dev.azure.com/{org}/_packaging/{feed}/pypi/simple/` | 비어 있지 않은 임의의 문자열 (예: `token`) | Packaging Read 범위의 Personal Access Token (PAT) | +| **GitHub Packages** | `https://pypi.pkg.github.com/{owner}/simple/` | GitHub 사용자 이름 | `read:packages` 범위의 Personal Access Token (classic) | +| **GitLab Package Registry** | `https://gitlab.com/api/v4/projects/{project_id}/packages/pypi/simple/` | `__token__` | `read_api` 범위의 Project 또는 Personal Access Token | +| **AWS CodeArtifact** | `aws codeartifact get-repository-endpoint`의 URL 사용 | `aws` | `aws codeartifact get-authorization-token`의 토큰 | +| **Google Artifact Registry** | `https://{region}-python.pkg.dev/{project}/{repo}/simple/` | `_json_key_base64` | Base64로 인코딩된 서비스 계정 키 | +| **JFrog Artifactory** | `https://{instance}.jfrog.io/artifactory/api/pypi/{repo}/simple/` | 사용자 이름 또는 이메일 | API 키 또는 ID 토큰 | +| **자체 호스팅 (devpi, Nexus 등)** | 레지스트리의 simple API URL | 레지스트리 사용자 이름 | 레지스트리 비밀번호 | + + + **AWS CodeArtifact**의 경우 인증 토큰이 주기적으로 만료됩니다. + 만료되면 `UV_INDEX_*_PASSWORD` 값을 갱신해야 합니다. + CI/CD 파이프라인에서 이를 자동화하는 것을 고려하세요. + + +## AMP에서 환경 변수 설정 + +프라이빗 레지스트리 자격 증명은 CrewAI AMP에서 환경 변수로 구성해야 합니다. +두 가지 옵션이 있습니다: + + + + 1. [CrewAI AMP](https://app.crewai.com)에 로그인합니다 + 2. 자동화로 이동합니다 + 3. **Environment Variables** 탭을 엽니다 + 4. 각 변수 (`UV_INDEX_*_USERNAME` 및 `UV_INDEX_*_PASSWORD`)에 값을 추가합니다 + + 자세한 내용은 [AMP에 배포하기 — 환경 변수 설정하기](/ko/enterprise/guides/deploy-to-amp#환경-변수-설정하기) 단계를 참조하세요. + + + `crewai deploy create`를 실행하기 전에 로컬 `.env` 파일에 변수를 추가합니다. + CLI가 이를 안전하게 플랫폼으로 전송합니다: + + ```bash + # .env + OPENAI_API_KEY=sk-... + UV_INDEX_MY_PRIVATE_REGISTRY_USERNAME=token + UV_INDEX_MY_PRIVATE_REGISTRY_PASSWORD=your-pat-here + ``` + + ```bash + crewai deploy create + ``` + + + + + 자격 증명을 저장소에 **절대** 커밋하지 마세요. 모든 비밀 정보에는 AMP 환경 변수를 사용하세요. + `.env` 파일은 `.gitignore`에 포함되어야 합니다. + + +기존 배포의 자격 증명을 업데이트하려면 [Crew 업데이트하기 — 환경 변수](/ko/enterprise/guides/update-crew)를 참조하세요. + +## 전체 동작 흐름 + +CrewAI AMP가 자동화를 빌드할 때, 해결 흐름은 다음과 같이 작동합니다: + + + + AMP가 저장소를 가져오고 `pyproject.toml`과 `uv.lock`을 읽습니다. + + + UV가 `[tool.uv.sources]`를 읽어 각 패키지가 어떤 index에서 와야 하는지 결정합니다. + + + 각 프라이빗 index에 대해 UV가 AMP에서 구성한 환경 변수에서 + `UV_INDEX_{NAME}_USERNAME`과 `UV_INDEX_{NAME}_PASSWORD`를 조회합니다. + + + UV가 공개(PyPI) 및 프라이빗(레지스트리) 패키지를 모두 다운로드하고 설치합니다. + + + 모든 의존성이 사용 가능한 상태에서 crew 또는 flow가 시작됩니다. + + + +## 문제 해결 + +### 빌드 중 인증 오류 + +**증상**: 프라이빗 패키지를 해결할 때 `401 Unauthorized` 또는 `403 Forbidden`으로 빌드가 실패합니다. + +**확인사항**: +- `UV_INDEX_*` 환경 변수 이름이 index 이름과 정확히 일치하는지 확인합니다 (대문자, 하이픈 -> 언더스코어) +- 자격 증명이 로컬 `.env`뿐만 아니라 AMP 환경 변수에 설정되어 있는지 확인합니다 +- 토큰/PAT에 패키지 피드에 필요한 읽기 권한이 있는지 확인합니다 +- 토큰이 만료되지 않았는지 확인합니다 (특히 AWS CodeArtifact의 경우) + +### 패키지를 찾을 수 없음 + +**증상**: `No matching distribution found for my-private-package`. + +**확인사항**: +- `pyproject.toml`의 index URL이 `/simple/`로 끝나는지 확인합니다 +- `[tool.uv.sources]` 항목이 올바른 패키지 이름을 올바른 index 이름에 매핑하는지 확인합니다 +- 패키지가 실제로 프라이빗 레지스트리에 게시되어 있는지 확인합니다 +- 동일한 자격 증명으로 로컬에서 `uv lock`을 실행하여 해결이 작동하는지 확인합니다 + +### Lock 파일 충돌 + +**증상**: 프라이빗 index를 추가한 후 `uv lock`이 실패하거나 예상치 못한 결과를 생성합니다. + +**해결책**: 로컬에서 자격 증명을 설정하고 다시 생성합니다: + +```bash +export UV_INDEX_MY_PRIVATE_REGISTRY_USERNAME=token +export UV_INDEX_MY_PRIVATE_REGISTRY_PASSWORD=your-pat +uv lock +``` + +그런 다음 업데이트된 `uv.lock`을 커밋합니다. + +## 관련 가이드 + + + + 배포 전에 프로젝트 구조와 의존성을 확인합니다. + + + crew 또는 flow를 배포하고 환경 변수를 구성합니다. + + + 환경 변수를 업데이트하고 실행 중인 배포에 변경 사항을 푸시합니다. + + diff --git a/docs/pt-BR/enterprise/guides/deploy-to-amp.mdx b/docs/pt-BR/enterprise/guides/deploy-to-amp.mdx index c6dc35018..7d469b993 100644 --- a/docs/pt-BR/enterprise/guides/deploy-to-amp.mdx +++ b/docs/pt-BR/enterprise/guides/deploy-to-amp.mdx @@ -176,6 +176,11 @@ Você precisa enviar seu crew para um repositório do GitHub. Caso ainda não te ![Definir Variáveis de Ambiente](/images/enterprise/set-env-variables.png) + + Usando pacotes Python privados? Você também precisará adicionar suas credenciais de registro aqui. + Consulte [Registros de Pacotes Privados](/pt-BR/enterprise/guides/private-package-registry) para as variáveis necessárias. + + diff --git a/docs/pt-BR/enterprise/guides/prepare-for-deployment.mdx b/docs/pt-BR/enterprise/guides/prepare-for-deployment.mdx index bf81b8f7a..f22679759 100644 --- a/docs/pt-BR/enterprise/guides/prepare-for-deployment.mdx +++ b/docs/pt-BR/enterprise/guides/prepare-for-deployment.mdx @@ -256,6 +256,12 @@ Antes da implantação, certifique-se de ter: 1. **Chaves de API de LLM** prontas (OpenAI, Anthropic, Google, etc.) 2. **Chaves de API de ferramentas** se estiver usando ferramentas externas (Serper, etc.) + + Se seu projeto depende de pacotes de um **registro PyPI privado**, você também precisará configurar + credenciais de autenticação do registro como variáveis de ambiente. Consulte o guia + [Registros de Pacotes Privados](/pt-BR/enterprise/guides/private-package-registry) para mais detalhes. + + Teste seu projeto localmente com as mesmas variáveis de ambiente antes de implantar para detectar problemas de configuração antecipadamente. diff --git a/docs/pt-BR/enterprise/guides/private-package-registry.mdx b/docs/pt-BR/enterprise/guides/private-package-registry.mdx new file mode 100644 index 000000000..3950ead8d --- /dev/null +++ b/docs/pt-BR/enterprise/guides/private-package-registry.mdx @@ -0,0 +1,263 @@ +--- +title: "Registros de Pacotes Privados" +description: "Instale pacotes Python privados de registros PyPI autenticados no CrewAI AMP" +icon: "lock" +mode: "wide" +--- + + + Este guia aborda como configurar seu projeto CrewAI para instalar pacotes Python + de registros PyPI privados (Azure DevOps Artifacts, GitHub Packages, GitLab, AWS CodeArtifact, etc.) + ao implantar no CrewAI AMP. + + +## Quando Você Precisa Disso + +Se seu projeto depende de pacotes Python internos ou proprietários hospedados em um registro privado +em vez do PyPI público, você precisará: + +1. Informar ao UV **onde** encontrar o pacote (uma URL de index) +2. Informar ao UV **quais** pacotes vêm desse index (um mapeamento de source) +3. Fornecer **credenciais** para que o UV possa autenticar durante a instalação + +O CrewAI AMP usa [UV](https://docs.astral.sh/uv/) para resolução e instalação de dependências. +O UV suporta registros privados autenticados por meio da configuração do `pyproject.toml` combinada +com variáveis de ambiente para credenciais. + +## Passo 1: Configurar o pyproject.toml + +Três elementos trabalham juntos no seu `pyproject.toml`: + +### 1a. Declarar a dependência + +Adicione o pacote privado ao seu `[project.dependencies]` como qualquer outra dependência: + +```toml +[project] +dependencies = [ + "crewai[tools]>=0.100.1,<1.0.0", + "my-private-package>=1.2.0", +] +``` + +### 1b. Definir o index + +Registre seu registro privado como um index nomeado em `[[tool.uv.index]]`: + +```toml +[[tool.uv.index]] +name = "my-private-registry" +url = "https://pkgs.dev.azure.com/my-org/_packaging/my-feed/pypi/simple/" +explicit = true +``` + + + O campo `name` é importante — o UV o utiliza para construir os nomes das variáveis de ambiente + para autenticação (veja o [Passo 2](#passo-2-configurar-credenciais-de-autenticação) abaixo). + + Definir `explicit = true` significa que o UV não consultará esse index para todos os pacotes — apenas + os que você mapear explicitamente em `[tool.uv.sources]`. Isso evita consultas desnecessárias + ao seu registro privado e protege contra ataques de confusão de dependências. + + +### 1c. Mapear o pacote para o index + +Informe ao UV quais pacotes devem ser resolvidos a partir do seu index privado usando `[tool.uv.sources]`: + +```toml +[tool.uv.sources] +my-private-package = { index = "my-private-registry" } +``` + +### Exemplo completo + +```toml +[project] +name = "my-crew-project" +version = "0.1.0" +requires-python = ">=3.10,<=3.13" +dependencies = [ + "crewai[tools]>=0.100.1,<1.0.0", + "my-private-package>=1.2.0", +] + +[tool.crewai] +type = "crew" + +[[tool.uv.index]] +name = "my-private-registry" +url = "https://pkgs.dev.azure.com/my-org/_packaging/my-feed/pypi/simple/" +explicit = true + +[tool.uv.sources] +my-private-package = { index = "my-private-registry" } +``` + +Após atualizar o `pyproject.toml`, regenere seu arquivo lock: + +```bash +uv lock +``` + + + Sempre faça commit do `uv.lock` atualizado junto com as alterações no `pyproject.toml`. + O arquivo lock é obrigatório para implantação — veja [Preparar para Implantação](/pt-BR/enterprise/guides/prepare-for-deployment). + + +## Passo 2: Configurar Credenciais de Autenticação + +O UV autentica em indexes privados usando variáveis de ambiente que seguem uma convenção de nomenclatura +baseada no nome do index que você definiu no `pyproject.toml`: + +``` +UV_INDEX_{UPPER_NAME}_USERNAME +UV_INDEX_{UPPER_NAME}_PASSWORD +``` + +Onde `{UPPER_NAME}` é o nome do seu index convertido para **maiúsculas** com **hifens substituídos por underscores**. + +Por exemplo, um index chamado `my-private-registry` usa: + +| Variável | Valor | +|----------|-------| +| `UV_INDEX_MY_PRIVATE_REGISTRY_USERNAME` | Seu nome de usuário ou nome do token do registro | +| `UV_INDEX_MY_PRIVATE_REGISTRY_PASSWORD` | Sua senha ou token/PAT do registro | + + + Essas variáveis de ambiente **devem** ser adicionadas pelas configurações de **Variáveis de Ambiente** do CrewAI AMP — + globalmente ou no nível da implantação. Elas não podem ser definidas em arquivos `.env` ou codificadas no seu projeto. + + Veja [Configurar Variáveis de Ambiente no AMP](#configurar-variáveis-de-ambiente-no-amp) abaixo. + + +## Referência de Provedores de Registro + +A tabela abaixo mostra o formato da URL de index e os valores de credenciais para provedores de registro comuns. +Substitua os valores de exemplo pelos detalhes reais da sua organização e feed. + +| Provedor | URL do Index | Usuário | Senha | +|----------|-------------|---------|-------| +| **Azure DevOps Artifacts** | `https://pkgs.dev.azure.com/{org}/_packaging/{feed}/pypi/simple/` | Qualquer string não vazia (ex: `token`) | Personal Access Token (PAT) com escopo Packaging Read | +| **GitHub Packages** | `https://pypi.pkg.github.com/{owner}/simple/` | Nome de usuário do GitHub | Personal Access Token (classic) com escopo `read:packages` | +| **GitLab Package Registry** | `https://gitlab.com/api/v4/projects/{project_id}/packages/pypi/simple/` | `__token__` | Project ou Personal Access Token com escopo `read_api` | +| **AWS CodeArtifact** | Use a URL de `aws codeartifact get-repository-endpoint` | `aws` | Token de `aws codeartifact get-authorization-token` | +| **Google Artifact Registry** | `https://{region}-python.pkg.dev/{project}/{repo}/simple/` | `_json_key_base64` | Chave de conta de serviço codificada em Base64 | +| **JFrog Artifactory** | `https://{instance}.jfrog.io/artifactory/api/pypi/{repo}/simple/` | Nome de usuário ou email | Chave API ou token de identidade | +| **Auto-hospedado (devpi, Nexus, etc.)** | URL da API simple do seu registro | Nome de usuário do registro | Senha do registro | + + + Para **AWS CodeArtifact**, o token de autorização expira periodicamente. + Você precisará atualizar o valor de `UV_INDEX_*_PASSWORD` quando ele expirar. + Considere automatizar isso no seu pipeline de CI/CD. + + +## Configurar Variáveis de Ambiente no AMP + +As credenciais do registro privado devem ser configuradas como variáveis de ambiente no CrewAI AMP. +Você tem duas opções: + + + + 1. Faça login no [CrewAI AMP](https://app.crewai.com) + 2. Navegue até sua automação + 3. Abra a aba **Environment Variables** + 4. Adicione cada variável (`UV_INDEX_*_USERNAME` e `UV_INDEX_*_PASSWORD`) com seu valor + + Veja o passo [Deploy para AMP — Definir Variáveis de Ambiente](/pt-BR/enterprise/guides/deploy-to-amp#definir-as-variáveis-de-ambiente) para detalhes. + + + Adicione as variáveis ao seu arquivo `.env` local antes de executar `crewai deploy create`. + A CLI as transferirá com segurança para a plataforma: + + ```bash + # .env + OPENAI_API_KEY=sk-... + UV_INDEX_MY_PRIVATE_REGISTRY_USERNAME=token + UV_INDEX_MY_PRIVATE_REGISTRY_PASSWORD=your-pat-here + ``` + + ```bash + crewai deploy create + ``` + + + + + **Nunca** faça commit de credenciais no seu repositório. Use variáveis de ambiente do AMP para todos os segredos. + O arquivo `.env` deve estar listado no `.gitignore`. + + +Para atualizar credenciais em uma implantação existente, veja [Atualizar Seu Crew — Variáveis de Ambiente](/pt-BR/enterprise/guides/update-crew). + +## Como Tudo se Conecta + +Quando o CrewAI AMP faz o build da sua automação, o fluxo de resolução funciona assim: + + + + O AMP busca seu repositório e lê o `pyproject.toml` e o `uv.lock`. + + + O UV lê `[tool.uv.sources]` para determinar de qual index cada pacote deve vir. + + + Para cada index privado, o UV busca `UV_INDEX_{NAME}_USERNAME` e `UV_INDEX_{NAME}_PASSWORD` + nas variáveis de ambiente que você configurou no AMP. + + + O UV baixa e instala todos os pacotes — tanto públicos (do PyPI) quanto privados (do seu registro). + + + Seu crew ou flow inicia com todas as dependências disponíveis. + + + +## Solução de Problemas + +### Erros de Autenticação Durante o Build + +**Sintoma**: Build falha com `401 Unauthorized` ou `403 Forbidden` ao resolver um pacote privado. + +**Verifique**: +- Os nomes das variáveis de ambiente `UV_INDEX_*` correspondem exatamente ao nome do seu index (maiúsculas, hifens -> underscores) +- As credenciais estão definidas nas variáveis de ambiente do AMP, não apenas em um `.env` local +- Seu token/PAT tem as permissões de leitura necessárias para o feed de pacotes +- O token não expirou (especialmente relevante para AWS CodeArtifact) + +### Pacote Não Encontrado + +**Sintoma**: `No matching distribution found for my-private-package`. + +**Verifique**: +- A URL do index no `pyproject.toml` termina com `/simple/` +- A entrada `[tool.uv.sources]` mapeia o nome correto do pacote para o nome correto do index +- O pacote está realmente publicado no seu registro privado +- Execute `uv lock` localmente com as mesmas credenciais para verificar se a resolução funciona + +### Conflitos no Arquivo Lock + +**Sintoma**: `uv lock` falha ou produz resultados inesperados após adicionar um index privado. + +**Solução**: Defina as credenciais localmente e regenere: + +```bash +export UV_INDEX_MY_PRIVATE_REGISTRY_USERNAME=token +export UV_INDEX_MY_PRIVATE_REGISTRY_PASSWORD=your-pat +uv lock +``` + +Em seguida, faça commit do `uv.lock` atualizado. + +## Guias Relacionados + + + + Verifique a estrutura do projeto e as dependências antes de implantar. + + + Implante seu crew ou flow e configure variáveis de ambiente. + + + Atualize variáveis de ambiente e envie alterações para uma implantação em execução. + +