Lambda
Serverless: no GPU, no instance to reserve, nothing standing between requests.
The SDK’s deploy/lambda/ CDK stack builds an arm64 image with the 2B Qwen3.5
Decider baked in (LoRA merged into the torso, quantized to Q8_0 for
llama.cpp) and creates one Lambda
function behind an IAM-authenticated Function URL. Requests take seconds.
- When to pick it: triage, moderation, routing queues, batch scoring, pre-action checks — decisions that can wait seconds, at volumes where a GPU would sit idle. For a per-tool-call guard inside an agent loop, serve on a GPU instead.
Deploy
Section titled “Deploy”Requires an AWS account, Node.js 22+, awscurl + AWS CLI v2 for testing.
git clone https://github.com/strands-labs/strands-decidercd strands-decider/deploy/lambdanpm installnpx cdk bootstrap aws://<account>/<region>npx cdk deployCDK builds the image in CodeBuild (~10 min) and publishes the function. The
Function URL is in cdk deploy’s outputs.
Call it
Section titled “Call it”awscurl --service lambda --region <region> -X POST -H 'content-type: application/json' \ -d '{"state": "Help! My payouts have been failing for 3 days!", "questions": {"is_urgent": {"type": "noul", "instructions": "Does this convey urgency?"}}}' \ <FunctionUrl>v1/systemone{"model": "strands-decider-2B-qwen3.5-v1-2610-q8_0", "answers": {"is_urgent": {"type": "noul", "noul": 0.8634}}, "usage": {"input_tokens": 86, "output_tokens": 1}, "latency_ms": 1033.72}The URL only accepts SigV4-signed requests from principals with
lambda:InvokeFunctionUrl. Direct aws lambda invoke works too, with the
request as the event payload.
CDK context knobs
Section titled “CDK context knobs”Set in cdk.json, or pass -c key=value to cdk deploy:
| Setting | Default | Meaning |
|---|---|---|
model | StrandsAgents/strands-decider-2B-qwen3.5-v1-2610 | Any Qwen3.5 Decider Hub id; names the stack. |
model_revision | main | Pin to a release tag (YYMMDD) for reproducibility. |
snapstart | false | true → ~6 s cold starts instead of up to 30 s; ~$39.50/month for the snapshot cache. |
vision | false | true adds the base model’s vision tower so requests may carry images. |
image_long_side | 448 | Longest side an image is scaled to before token-gridding. |
decoder_precision / vision_precision | q8_0 / f16 | f16 / f32 is closer to torch fp32, slower. |
max_request_tokens | 24576 | Cap on one request’s state-plus-questions tokens. |
Delete it
Section titled “Delete it”npx cdk destroy # the default modelnpx cdk destroy -c model=<Hub id> # any other deployed modelRemoves the function, versions, snapshots, log group, ECR repo, CodeBuild project, and IAM roles.
Lambda Managed Instances (GPU)
Section titled “Lambda Managed Instances (GPU)”A separate CDK stack at deploy/lambda-gpu/ serves the same
POST /v1/systemone API on a CUDA GPU under Lambda Managed Instances.
Same torch + CUDA code path as SageMaker, so the engine sees
the model’s full weights and the GPU does the forward pass. The stack
defaults to T4 (g4dn) for availability; switch to L4 with
-c instance_types=g6.xlarge,g6.2xlarge -c accelerator_memory_gb=24.
- When to pick it: Low-latency agent-loop guards, per-tool-call
checks, and moderate-throughput classifiers behind SQS / EventBridge /
direct
Invoke. Requires an EC2 GPU vCPU quota; Event Functions only — no Function URL, no synchronous HTTP.
Deploy
Section titled “Deploy”git clone https://github.com/strands-labs/strands-decidercd strands-decider/deploy/lambda-gpunpm installnpx cdk bootstrap aws://<account>/<region>npx cdk deployCodeBuild builds the image (~15 min — torch + CUDA layers + model download), publishes to an ECR repository in the stack, and creates the function with a Lambda capacity provider over the configured GPU instance types.
Call it
Section titled “Call it”aws lambda invoke --function-name <FunctionArn> --cli-binary-format raw-in-base64-out \ --payload '{"state": "Help! My payouts have been failing for 3 days!", "questions": {"is_urgent": {"type": "noul", "instructions": "Does this convey urgency?"}}}' \ answer.jsoncat answer.json{"model": "strands-decider-2B-qwen3.5-v1-2610", "answers": {"is_urgent": {"type": "noul", "noul": 0.86}}, "usage": {"input_tokens": 86, "output_tokens": 1}, "latency_ms": 42.5}Same JSON works as an SQS message body or an EventBridge event detail.
Delete it
Section titled “Delete it”npx cdk destroy # the default modelnpx cdk destroy -c model=<Hub id> # any other deployed modelRemoves the function, capacity provider, VPC, ECR repository, CodeBuild
project, log groups, and IAM roles. Log groups default to
RemovalPolicy.RETAIN; delete them from the CloudWatch console if you want
to drop their retained cost.
See also
Section titled “See also”- CPU stack:
deploy/lambda/— full README. Exhaustive measurements, precision notes, image-size tradeoffs, cost breakdown, and debugging. - GPU stack:
deploy/lambda-gpu/— full README. CDK context knobs, capacity-provider wiring, image-build caveats.