> ## Documentation Index
> Fetch the complete documentation index at: https://docs.agno.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Add Python Libraries

Agno templates are setup to manage dependencies using a [pyproject.toml](https://packaging.python.org/en/latest/specifications/declaring-project-metadata/#declaring-project-metadata) file, **which is used to generate the `requirements.txt` file using [uv](https://github.com/astral-sh/uv) or [pip-tools](https://pip-tools.readthedocs.io/en/latest/).**

Adding or Updating a python library is a 2 step process:

1. Add library to the `pyproject.toml` file
2. Auto-Generate the `requirements.txt` file

<Warning>
  We highly recommend auto-generating the `requirements.txt` file using this process.
</Warning>

## Update pyproject.toml

* Open the `pyproject.toml` file
* Add new libraries to the dependencies section.

## Generate requirements

After updating the `dependencies` in the `pyproject.toml` file, auto-generate the `requirements.txt` file using a helper script or running `pip-compile` directly.

<CodeGroup>
  ```bash terminal theme={null}
  ./scripts/generate_requirements.sh
  ```

  ```bash pip compile theme={null}
  pip-compile \
      --no-annotate \
      --pip-args "--no-cache-dir" \
      -o requirements.txt pyproject.toml
  ```
</CodeGroup>

If you'd like to upgrade all python libraries to their latest version, run:

<CodeGroup>
  ```bash terminal theme={null}
  ./scripts/generate_requirements.sh upgrade
  ```

  ```bash pip compile theme={null}
  pip-compile \
      --upgrade \
      --no-annotate \
      --pip-args "--no-cache-dir" \
      -o requirements.txt pyproject.toml
  ```
</CodeGroup>

## Rebuild Images

After updating the `requirements.txt` file, rebuild your images.

### Rebuild dev images

<CodeGroup>
  ```bash terminal theme={null}
  ag infra up --env dev --infra docker --type image
  ```

  ```bash short options theme={null}
  ag infra up -e dev -i docker -t image
  ```
</CodeGroup>

### Rebuild production images

<Note>
  Remember to [authenticate with ECR](/deploy/templates/aws/configure/production-app#create-an-ecr-repository) if needed.
</Note>

<CodeGroup>
  ```bash terminal theme={null}
  ag infra up --env prd --infra docker --type image
  ```

  ```bash short options theme={null}
  ag infra up -e prd -i docker -t image
  ```
</CodeGroup>

## Recreate Resources

After rebuilding images, recreate the resources.

### Recreate dev containers

<CodeGroup>
  ```bash terminal theme={null}
  ag infra restart --env dev --infra docker --type container
  ```

  ```bash short options theme={null}
  ag infra restart -e dev -i docker -t container
  ```
</CodeGroup>

### Update ECS services

<CodeGroup>
  ```bash Full Options theme={null}
  ag infra patch --env prd --infra aws --name service
  ```

  ```bash Shorthand theme={null}
  ag infra patch prd:aws::service
  ```
</CodeGroup>
