Resources

Recommendations

Overview

Recommendations represent pending savings opportunities identified by LevelFour across your cloud accounts. Each recommendation includes the affected service, estimated monthly and annual savings, and available actions (accept, reject, execute).

Methods

Get Savings by Provider

Returns a summary of potential savings grouped by cloud provider (AWS, GCP, Azure, K8s).

summary = client.recommendations.get_savings_by_provider()

Get Potential Savings

Returns potential savings summary grouped by provider.

potential = client.recommendations.get_potential_savings()

Get Overview

Returns overview metrics across all providers: total spend, available savings, pending savings, and saved-to-date.

overview = client.recommendations.get_overview()

List Recommendations

Returns a paginated list of all recommendations. Supports sorting by multiple fields.

page = client.recommendations.list(
    page=1,
    page_size=50,
    sort_by="monthly_savings",
    sort_order="desc",
)

for rec in page:
    print(f"{rec.service}: ${rec.monthly_savings}/mo")

Parameters

ParameterTypeDescription
pageintPage number (1-indexed)
page_sizeintItems per page (max 100)
sort_bystringSort field: recommendation_id, service, environment, monthly_savings, annual_savings, savings_percentage, analysis_period, created_at
sort_orderstringasc or desc

Get Recommendation

Returns complete details for a specific recommendation by ID.

detail = client.recommendations.get("rec_123")

Get Provider Overview

Returns high-level KPI metrics for recommendations scoped to a single provider: total spend, available savings, pending savings, and saved-to-date. Useful for rendering per-provider dashboard headers.

overview = client.recommendations.get_provider_overview("aws")

List By Provider

Returns a paginated per-provider recommendations list with filtering by service, environment, account, tag, and display status. Each row includes monthly/annual savings, current spend, and a savings percentage.

page = client.recommendations.list_by_provider(
    "aws",
    page=1,
    page_size=20,
    service=["EC2", "RDS"],
    environment=["production"],
    display_status=["available"],
    sort_by="monthly_savings",
    sort_order="desc",
)

for rec in page:
    print(f"{rec.service}: ${rec.monthly_savings}/mo")

Parameters

ParameterTypeDescription
pageintPage number (1-indexed)
page_sizeintItems per page (max 100)
sort_bystringSort field: recommendation_id, service, environment, account, tag, monthly_savings, savings_percentage, status
sort_orderstringasc or desc
servicestring[]Filter by service
environmentstring[]Filter by environment
accountstring[]Filter by account ID
tagstring[]Filter by tag
display_statusstring[]Filter by status: available, pending, processing, optimized, rejected, unavailable

For filter recipes using these parameters — including the "RDS delete candidates" pattern, top-N-by-savings ranking, and CSV export — see Filtering and sorting.

List In-Progress

Returns all recommendations currently in processing status.

processing = client.recommendations.list_in_progress()

Response Types

RecommendationItem

Returned in paginated list responses.

FieldTypeDescription
recommendation_idstringUnique business identifier
servicestringCloud service name
environmentstring?Environment tag
analysis_periodstring?Analysis time window
monthly_savingsfloatEstimated monthly savings
annual_savingsfloatEstimated annual savings
current_spendingfloatCurrent monthly spend
savings_percentagefloatSavings as percentage of current spend
actionsobject?Available actions for this recommendation

Example: Find High-Value AWS Recommendations

from levelfour import LevelFour

client = LevelFour()

for rec in client.providers.list_recommendations(
    "aws",
    page_size=20,
    sort_by="monthly_savings",
    sort_order="desc",
    display_status=["available"],
):
    if rec.monthly_savings > 100:
        print(f"{rec.recommendation_id}: ${rec.monthly_savings}/mo")