Skip to main content
Version: 2.34.0

Define Control Points

Aperture Python SDK can be used to define feature control points within a Python service.

Run the command below to install the SDK:

pip install aperture-py

The next step is to create an Aperture Client instance, for which, the address of the organization created in Aperture Cloud and API key are needed. You can locate both these details by clicking on the Aperture tab in the sidebar menu of Aperture Cloud.


You can create an API key for your project in the Aperture Cloud UI. For detailed instructions on locating API Keys, please refer to the API Keys section.

The created instance can then be used to start a flow:

The above code snippet is making start_flow calls to Aperture. For this call, it is important to specify the control point (AwesomeFeature in the example) and FlowParams that will be aligned with the policy created in Aperture Cloud. For request prioritization use cases, it's important to set a higher gRPC deadline. This parameter specifies the maximum duration a request can remain in the queue. For each flow that is started, a should_run decision is made, determining whether to allow the request into the system or to rate limit it. It is important to make the end call made after processing each request, to send telemetry data that would provide granular visibility for each flow.

You can also use the flow as a context manager:

Additionally, you can decorate any function with aperture client. This will skip running the function if the flow is rejected by Aperture Agent. This might be helpful to handle specific routes in your service.

For more context on using the Aperture Python SDK to set feature control points, refer to the example app available in the repository.