CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-aws-lambda-powertools

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

89

1.21x
Overview
Eval results
Files

task.mdevals/scenario-6/

Lambda Request Processor

A Lambda function that processes user requests and generates structured logs with automatic context enrichment.

Capabilities

Processes incoming requests

  • The function accepts an event with a "userId" and "action" field and returns a success response with both values echoed back. @test
  • When the event is missing the "userId" field, the function raises a ValueError with message "userId is required". @test

Logs request processing with Lambda context

  • The logger automatically captures Lambda function name, request ID, memory limit, and cold start status without explicit code. @test
  • The logger includes the userId from the event in all log statements as a persistent context key. @test

Implementation

@generates

API

def lambda_handler(event: dict, context) -> dict:
    """
    Process user requests with automatic Lambda context logging.

    Args:
        event: Dictionary containing 'userId' (str) and 'action' (str)
        context: Lambda context object

    Returns:
        Dictionary with 'statusCode' (200), and 'body' containing 'userId' and 'action'

    Raises:
        ValueError: If userId is missing from event
    """
    pass

Dependencies { .dependencies }

aws-lambda-powertools { .dependency }

Provides structured logging with automatic Lambda context injection.

@satisfied-by

Install with Tessl CLI

npx tessl i tessl/pypi-aws-lambda-powertools

tile.json