Skip to main content

Agentic infrastructure provisioning from code analysis

Project description

Infera

Agentic infrastructure provisioning from code analysis. Infera analyzes your codebase, infers the optimal cloud architecture, and provisions resources automatically.

Features

  • Intelligent Analysis: Detects frameworks (React, Vue, FastAPI, Django, etc.) and dependencies
  • Best Practice Templates: Uses proven architecture patterns for different project types
  • Cost Estimation: Shows per-resource and total monthly cost estimates
  • Hybrid Execution: Uses cloud SDKs for simple resources, Terraform for complex setups
  • Rollback on Failure: Atomic provisioning with automatic cleanup

See It In Action

$ cd my-fastapi-project
$ infera init

๐Ÿ” Analyzing codebase...
   โ”œโ”€โ”€ Detected: Python 3.11 (pyproject.toml)
   โ”œโ”€โ”€ Detected: FastAPI framework (confidence: 94%)
   โ”œโ”€โ”€ Detected: PostgreSQL database (asyncpg in dependencies)
   โ”œโ”€โ”€ Detected: Dockerfile present
   โ””โ”€โ”€ Detected: Redis for caching (redis-py)

๐Ÿ“‹ Selected template: gcp/cloud_run_fullstack.md
   Based on: API framework + database + containerized

๐Ÿ“ฆ Proposed Infrastructure:
   โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
   โ”‚  Cloud Run Service     my-fastapi-app      us-central1 โ”‚
   โ”‚  Artifact Registry     my-fastapi-repo     us-central1 โ”‚
   โ”‚  Cloud SQL (Postgres)  my-fastapi-db       us-central1 โ”‚
   โ”‚  Redis (Memorystore)   my-fastapi-cache    us-central1 โ”‚
   โ”‚  Secret Manager        DATABASE_URL, REDIS_URL         โ”‚
   โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

๐Ÿ’ฐ Estimated Monthly Cost: $45-85
   โ”œโ”€โ”€ Cloud Run:      $5-20  (scales to zero)
   โ”œโ”€โ”€ Cloud SQL:      $25-40 (db-f1-micro)
   โ”œโ”€โ”€ Memorystore:    $15-25 (basic tier)
   โ””โ”€โ”€ Networking:     ~$1

โœ… Configuration saved to .infera/config.yaml

$ infera apply

๐Ÿš€ Provisioning infrastructure...
   โœ“ Enabled Cloud Run API
   โœ“ Enabled Artifact Registry API
   โœ“ Created Artifact Registry: my-fastapi-repo
   โœ“ Built and pushed container image
   โœ“ Created Cloud SQL instance: my-fastapi-db
   โœ“ Created Memorystore instance: my-fastapi-cache
   โœ“ Stored secrets in Secret Manager
   โœ“ Deployed Cloud Run service: my-fastapi-app

๐ŸŽ‰ Deployment complete!

   Service URL: https://my-fastapi-app-abc123-uc.a.run.app

   Next steps:
   โ€ข Set up custom domain: infera domain add api.myapp.com
   โ€ข View logs: gcloud run logs read my-fastapi-app
   โ€ข Monitor costs: infera status --costs

Quick Setup

1. Install via pipx (recommended)

pipx install infera

Or with pip:

pip install infera

2. Set your Anthropic API key

export ANTHROPIC_API_KEY="your-api-key"

3. Configure your cloud provider

# For GCP
gcloud auth login
gcloud config set project YOUR_PROJECT_ID

4. Run infera

cd /path/to/your/project
infera init    # Analyze codebase and create config
infera plan    # Preview infrastructure and costs
infera apply   # Provision resources

Installation Options

pipx (isolated environment)

pipx install infera

pip (global)

pip install infera

From source (development)

git clone https://github.com/computer-reinvention/infera.git
cd infera
uv sync
uv run infera --help

Requirements

  • Python 3.11+
  • Google Cloud SDK (for GCP provider)
  • ANTHROPIC_API_KEY environment variable

CLI Commands

Command Description
infera init Analyze codebase and create configuration
infera plan Generate execution plan with cost estimate
infera apply Provision infrastructure
infera destroy Tear down all resources
infera status Show current infrastructure state

Supported Architectures

  • Static Site: React, Vue, Angular โ†’ Cloud Storage + CDN
  • API Service: FastAPI, Flask, Express โ†’ Cloud Run
  • Full Stack: Next.js, Django โ†’ Cloud Run + Cloud SQL
  • Containerized: Dockerfile โ†’ Cloud Run from container

Template-Driven Intelligence

Infera's core strength lies in its library of 83 battle-tested deployment templates that encode years of production infrastructure knowledge. Instead of generating configurations from scratch, our AI agent references these templates to deliver consistent, proven infrastructure patterns.

What Are Templates?

Templates are comprehensive markdown documents that define everything needed to deploy a specific architecture pattern:

  • Architecture diagrams showing how components connect
  • Resource definitions with Terraform configurations ready to use
  • Best practices distilled from production deployments
  • Cost breakdowns with real pricing data at different traffic levels
  • Common mistakes to avoid and their solutions
  • Detection signals that help match your codebase to the right pattern

Template Categories

Category Templates Examples
GCP Deployments 15 Cloud Run, GKE, Cloud Functions, App Engine
AWS Deployments 15 Lambda, ECS Fargate, EKS, Elastic Beanstalk
Cloudflare Edge 10 Workers, Pages, D1, R2, Durable Objects
Framework-Specific 15 Next.js, FastAPI, Django, Rails, Go, Rust
Database Patterns 8 PostgreSQL, MySQL, MongoDB, Redis, DynamoDB
Specialized Architectures 10 WebSocket, GraphQL, ML Inference, Multi-tenant
Cost Optimization 5 Free tier strategies, Spot instances, Serverless vs Containers
DevOps & CI/CD 5 GitHub Actions, GitLab CI, Docker best practices

How Templates Work

  1. Codebase Analysis: Infera scans your project for framework signatures, dependencies, and patterns
  2. Template Matching: The AI agent uses detection signals to select the most appropriate template
  3. Configuration Generation: Resources are configured following template best practices
  4. Cost Estimation: Pricing data from templates provides accurate monthly estimates

Why Templates Matter

Consistency: Every FastAPI service you deploy follows the same proven Cloud Run configuration. No more reinventing the wheel.

Best Practices Built-In: Templates encode lessons learned from production incidentsโ€”proper health checks, security configurations, scaling limits, and resource sizing.

Cost Awareness: Each template includes detailed cost breakdowns. Know exactly what you'll pay before provisioning a single resource.

Multi-Cloud Ready: The same application type maps to equivalent services across providers. Deploy a Next.js app to GCP Cloud Run, AWS ECS, or Cloudflare Pages with templates optimized for each.

Example: What a Template Provides

For a simple API deployment, the gcp/cloud_run_api.md template includes:

โœ“ Architecture diagram with Cloud Run, Artifact Registry, and optional databases
โœ“ Complete Terraform configuration with variables and outputs
โœ“ Scaling recommendations (min/max instances, concurrency)
โœ“ Security setup (IAM, Secret Manager, VPC connectors)
โœ“ Cost table: 10k requests/day = $0-5, 1M requests/day = $100-300
โœ“ Common mistakes: cold starts, missing health checks, hardcoded secrets

All of this knowledge flows into your infera plan output automatically.

Roadmap

We're actively developing Infera to become the most intelligent infrastructure provisioning tool available. Here's what's coming:

Infrastructure Discovery & Alignment

Discover existing resources: Infera will scan your cloud accounts to identify already-provisioned infrastructureโ€”databases, load balancers, VPCs, and more.

Align with existing patterns: Instead of proposing a new Cloud SQL instance, Infera will recognize you already have an RDS cluster and suggest connecting to it. Your new services will follow the naming conventions, tagging strategies, and network topology already established in your environment.

Drift detection: Compare your codebase requirements against what's actually deployed. Get alerts when your infrastructure diverges from what your application expects.

Deeper Provider Integrations

One-click authentication: Native OAuth flows for GCP, AWS, and Cloudflare. No more copying service account keys or configuring credentials manually.

Real-time provisioning feedback: Stream deployment logs directly into your terminal. Watch resources come online with live status updates.

Automatic IAM configuration: Infera will create least-privilege service accounts and roles automatically, eliminating one of the most error-prone parts of cloud setup.

Cost optimization recommendations: Analyze your running infrastructure and suggest reserved instances, committed use discounts, or architecture changes that could reduce your bill.

Expanded Provider Support

  • Azure: App Service, Azure Functions, AKS, Cosmos DB
  • Vercel/Netlify: Native support for frontend-focused deployments
  • DigitalOcean: App Platform, Managed Databases, Kubernetes
  • Fly.io: Edge deployments with automatic region selection

Configuration

After infera init, configuration is stored in .infera/config.yaml:

version: "1.0"
project_name: my-app
provider: gcp
region: us-central1

resources:
  - id: app
    type: cloud_run
    name: my-app
    config:
      image: gcr.io/my-project/my-app:latest
      memory: 512Mi
      min_instances: 0

Development

# Install dev dependencies
uv sync

# Run tests
uv run pytest

# Type checking
uv run pyright

# Format code
uv run ruff format .

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

infera-0.1.1.tar.gz (507.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

infera-0.1.1-py3-none-any.whl (547.4 kB view details)

Uploaded Python 3

File details

Details for the file infera-0.1.1.tar.gz.

File metadata

  • Download URL: infera-0.1.1.tar.gz
  • Upload date:
  • Size: 507.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.6

File hashes

Hashes for infera-0.1.1.tar.gz
Algorithm Hash digest
SHA256 75b78d9167388e3bba1a8e3925bec327becfbf17f7cce79c83c325c72840cb44
MD5 b48d4be23edde914b33bf8ea14eec995
BLAKE2b-256 7856e847c2ac90feaa96c4120750b071452c9fcb235fc65a0282ce6768fe83d0

See more details on using hashes here.

File details

Details for the file infera-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: infera-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 547.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.6

File hashes

Hashes for infera-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1464738904db11d3ba19b8fd898d2f797734753b544130913c4609822a1b6743
MD5 4cb246bde924eb297c730a898261ebc0
BLAKE2b-256 33188268db6d0ae7a31b672133d6c820713225762086a034c2ce55470c49ab49

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page