Deploy the pipeline
Two stages live here. First you send the pipeline to the platform and compile it. Then you create an access token and generate keys. Deploy does not create a token or generate keys. After both stages finish, you can run queries.
Stage 2 · Deploy
studio.deploy_pipeline. You give it the pipeline and parameters from the previous stage, plus a model_name. It returns a model_id for your deployed pipeline.from lattica_studio import LatticaStudio studio = LatticaStudio(license_key) model_id = studio.deploy_pipeline( pipeline, params, "MY_MNIST_MODEL", display_graph=True, )
deploy_pipeline is an envelope. It runs several steps for you: registering the model (or reusing one with the same name), uploading, and compiling. It does not issue an access token. The next section opens it up. If you want each step as its own call, the full sequence is in the platform documentation.
Calling deploy_pipeline again with the same model_name redeploys into that model: it stops any running workers, re-uploads, and recompiles. num_devices cannot change. Use a different name if you need a different device count.
What happens inside deploy
If no model has this model_name, one is created. If one already exists, that model is reused: running workers are stopped, and the instance type can be updated. Device count cannot change.
Your pipeline and parameters are serialized and sent to the platform.
The platform turns your pipeline into an FHE circuit it can run. This is the step that can fail if the pipeline and parameters do not fit. Deploy waits for it to finish.
What compilation tells you
When compilation fails
When compilation passes
The compiler's report is one of three instruments the platform gives you. The full map (debugger, printed graph, and this report) is in Inspecting the pipeline.
What you have after deploy
Stage 3 · Key generation
Call studio.tokens.create(model_id, save_as=model_name). The token is scoped to this deployment and written locally so you can load it later with studio.tokens.load.
Create a QueryClient with the token, then call generate_key(load_if_exists=False). The secret key stays on your machine. The evaluation key uploads and registers for later queries.
from lattica_query import QueryClient token = studio.tokens.create(model_id, save_as="MY_MNIST_MODEL") query_client = QueryClient(token) query_client.generate_key(load_if_exists=False)
model_name. Authorizes your queries.Next
Inspecting the Pipeline
Print the graph locally and read the compiler report before you query.