Resources are the infrastructure components for your application. Similar to Apps, we define them as python classes and create using phi start or phi ws up.


  • Local Resources: Docker containers and images
  • Cloud Resources: RDS database, S3 bucket, ECS services, task definitions, security groups
  • Kubernetes Resources: Services, deployments
from phi.docker.resource.container import DockerContainer

whoami = DockerContainer(
    ports={'80': 8080},

Each Resource is a pydantic object providing input and type validation.


Resources provide the “Infrastructure Layer” for our AI products. The software we write needs to be served by an Application, which in turn needs to run on an Infrastructure Resoure.

Defining Applications as Code and Infrastructure as Code allows us completely write our application as python code - providing numerous benefits like re-usability, version control, unit testing, formatting.

Phidata currently provides: