or run

tessl search
Log in

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/aws-lambda-powertools@3.19.x
tile.json

tessl/pypi-aws-lambda-powertools

tessl install tessl/pypi-aws-lambda-powertools@3.19.0

Comprehensive developer toolkit implementing serverless best practices for AWS Lambda functions in Python

Agent Success

Agent success rate when using this tile

89%

Improvement

Agent success rate improvement when using this tile compared to baseline

1.22x

Baseline

Agent success rate without this tile

73%

task.mdevals/scenario-5/

Order Processing Service

A Lambda function that processes customer orders from an API Gateway endpoint and logs all operations with proper correlation tracking across distributed service calls.

Requirements

Core Functionality

Build a Lambda handler that:

  • Accepts order data from API Gateway events containing order details (order_id, customer_name, items)
  • Logs the start and completion of order processing
  • Simulates calling an external inventory service (log a message indicating the call)
  • Simulates calling an external payment service (log a message indicating the call)
  • Returns a success response with order confirmation

Correlation Tracking

  • Extract and use correlation IDs from incoming requests to track the entire request lifecycle
  • Ensure all log entries include the correlation ID so they can be grouped together
  • The correlation ID should be automatically extracted from API Gateway request headers or context
  • All log messages throughout the handler execution should include this correlation ID

Test Cases

  • Processing an order with correlation ID from request headers produces logs containing that correlation ID @test
  • Processing an order without explicit correlation ID generates logs with an auto-generated correlation ID @test
  • All log entries within a single request share the same correlation ID @test

Implementation

@generates

API

def lambda_handler(event: dict, context) -> dict:
    """
    Process customer orders with correlation ID tracking.

    Args:
        event: API Gateway proxy event containing order details
        context: Lambda context object

    Returns:
        dict: API Gateway proxy response with status code and body
    """
    pass

Dependencies { .dependencies }

aws-lambda-powertools { .dependency }

Provides structured logging with correlation ID management for distributed tracing.