Keep the program identity#
Compilation produces a program you can keep. Save its identifier, then load it when the application starts. New emails call the interpreter with that same program; they do not invoke the compiler again.
Run the saved function#
Function specificationClassify whether this email needs prompt action from its recipient. Return exactly URGENT or ROUTINE. An imminent deadline or an immediate blocker is URGENT. Newsletters, completed work, and FYI updates are ROUTINE.
Actual output
Run the function to see its output.
Your email is sent to the hosted PAW interpreter. Every call uses saved program 224359803d6f6f105b65.
Load once and call twice#
import programasweights as paw
program_id = "224359803d6f6f105b65"
with paw.function(program_id) as urgency:
print(urgency("Please approve this by 5 p.m. today."))
print(urgency("The request was resolved yesterday. FYI."))This identifier loads the same program used above. Replace it with your own compiled program to use a different policy. Save a .paw file and prepare offline execution in the complete walkthrough.
Compose the function with Python#
Use the returned label in ordinary application code: add an urgent email to a queue or send a routine item to a later batch. Changing the policy creates a new program; changing queue logic changes the application.