Reference

Recommendations

Every recommendations method in the Python, TypeScript and Go SDKs, with its parameters, the row shape it returns, and a worked example.

A recommendation is one pending savings opportunity LevelFour found in your cloud accounts. Each one carries the affected service, the estimated monthly and annual savings, and the actions available on it: accept, reject, execute.

Pagination has the defaults, the page-size cap, and the auto-paginating iterators the examples below rely on.

Methods

MethodReturns
Get savings by providerA summary of potential savings grouped by cloud provider
Get potential savingsA potential savings summary grouped by provider
Get overviewTotal spend, available savings, pending savings and saved-to-date, across every provider
List recommendationsA paginated list of every recommendation. Sorts, does not filter
Get recommendationThe full detail for one recommendation
Get provider overviewThe same metrics as Get overview, for one provider
List by providerA paginated list for one provider, with filters
List in-progressEvery recommendation in processing status
Choose the resourcesLimits a recommendation to the resources you keep
Say why it was rejectedAdds a reason to a rejected recommendation
Read the activity timelineViews and decisions on one recommendation, in order
Request executionSubmits a recommendation for an admin to release
List what is waiting for approvalSubmissions still waiting for an admin
Check Automated Savings accessWhether Automated Savings can run for this recommendation

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 a 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 every recommendation.

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
sort_bystringSort field: recommendation_id, service, environment, monthly_savings, annual_savings, savings_percentage, analysis_period, created_at
sort_orderstringasc or desc
This list sorts and pages. It takes no filters: to narrow by service, environment, account, tag or status, use List by provider.

Get recommendation

Returns the full detail for one recommendation.

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

Get provider overview

Returns the same metrics as Get overview, scoped to a single provider: total spend, available savings, pending savings, and saved-to-date. Use it for a per-provider dashboard header.

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

List by provider

Returns a paginated per-provider recommendations list, filtered by service, environment, account, tag, and display status. Each row includes monthly and 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
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
virtual_tag_keystringA virtual tag's name or id. Keeps the opportunities whose resources carry one of virtual_tag_value under it
virtual_tag_valuestring[]Values of virtual_tag_key to keep. __unallocated__ keeps the opportunities no config assigned
display_statusstring[]Filter by status: available, pending, processing, optimized, rejected, unavailable

Filtering and sorting has recipes built on these parameters: the "RDS delete candidates" pattern, top-N-by-savings ranking, and CSV export.

List in-progress

Returns every recommendation currently in processing status.

processing = client.recommendations.list_in_progress()

Acting on a recommendation

These calls change one recommendation, or read who did what to it. Accepting or rejecting one happens in the dashboard, with l4 recommendations, or through the MCP server. Choosing resources, adding rejection feedback, requesting execution and reading the approval queue take a read-write key. The activity timeline and the Automated Savings check work with any key. The examples show the Go SDK and plain HTTP; SDK Overview lists which languages carry each namespace.

Choose the resources

Limits a recommendation to the resources you keep. Any resource you leave out is removed from it, and the savings figure follows. The list must be a non-empty subset of the resources the recommendation carries.

_, err := client.Recommendations.UpdateResourceSelection(ctx, "REC-1234",
    &levelfour.ResourceSelectionRequest{
        SelectedResources: []string{"vol-0abc1234def567890", "vol-0def5678abc123456"},
    },
)

Say why it was rejected

Adds a reason to a recommendation that is already rejected. reason is one of operational, strategy, not_applicable or other, and explanation is optional free text.

_, err := client.Recommendations.AddRejectionFeedback(ctx, "REC-1234",
    &levelfour.RejectionFeedbackRequest{
        Reason:      "not_applicable",
        Explanation: levelfour.String("This volume backs a disaster recovery test."),
    },
)

Read the activity timeline

Returns the recommendation's events in order: who viewed it and every decision taken on it.

activity, err := client.Recommendations.GetRecommendationActivity(ctx, "REC-1234")

Request execution

Puts an accepted recommendation in front of an admin to release. It moves to pending_approval until an admin approves it in the dashboard. implementation_method picks how the change is delivered:

ValueDelivers the change as
one-clickAutomated Savings: LevelFour applies it through the access you granted
iacA pull request against your infrastructure-as-code repository
one-click-plus-iacBoth: LevelFour applies it, and a pull request keeps your code in step
manualSteps your team carries out
approval, err := client.Recommendations.RequestExecution(ctx, "REC-1234",
    &levelfour.RequestExecutionBody{
        ImplementationMethod: levelfour.String("iac"),
    },
)

A pull request needs a repository to land in. Repository binding chooses it, and Automated Savings needs a grant first.

List what is waiting for approval

Returns every recommendation a member has submitted for execution that still needs an admin's release.

waiting, err := client.Recommendations.ListPendingApprovals(ctx)

Check Automated Savings access

Returns whether the access Automated Savings needs is in place for this recommendation's account, and the link that sets it up when it is not.

access, err := client.Recommendations.GetAutomatedSavings(ctx, "REC-1234")

Automated Savings covers the access itself.

RecommendationItem

Returned in paginated list responses.

FieldTypeDescription
recommendation_idstringUnique business identifier
servicestringCloud service name
environmentstring?Environment tag
virtual_tagsobject?The value of each virtual key on this opportunity, key name to value
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

Find high-value AWS recommendations

from levelfour import LevelFour

client = LevelFour()

for rec in client.recommendations.list_by_provider(
    "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")

Next

  • Savings is the realized side: what was accepted, implemented and measured
  • Providers is the providers namespace: provider-scoped recommendations, realized savings, costs and the filter values you can pass
  • Pagination has the iterators, the defaults and the page-size cap
  • Error handling has the codes these methods raise

On this page

Ask the FinOps Agent about your cloud spend