AWS Lambda

AWSLambdaTools lets agents list and invoke AWS Lambda functions.

Prerequisites

The following example requires the boto3 library, an OpenAI API key, and AWS credentials for an IAM principal that can list and invoke Lambda functions.

uv pip install agno openai boto3
export OPENAI_API_KEY="your_openai_api_key_here"
export AWS_ACCESS_KEY_ID="your_aws_access_key_id"
export AWS_SECRET_ACCESS_KEY="your_aws_secret_access_key"
export AWS_DEFAULT_REGION="us-east-1"

For temporary AWS credentials, also set AWS_SESSION_TOKEN. Grant the IAM principal these permissions:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "lambda:ListFunctions",
        "lambda:InvokeFunction"
      ],
      "Resource": "*"
    }
  ]
}

Use an existing Lambda function that accepts the supplied payload. Replace hello-world and us-east-1 with its name and region. list_functions reads one provider response page; it does not enumerate all functions across pages or regions.

Example

The following agent lists Lambda functions in the configured AWS account and invokes a specific function.

cookbook/91_tools/aws_lambda_tools.py
from agno.agent import Agent
from agno.tools.aws_lambda import AWSLambdaTools

# Create an Agent with the AWSLambdaTool
agent = Agent(
    tools=[AWSLambdaTools(region_name="us-east-1")],
    name="AWS Lambda Agent",
)

# Example 1: List the first page of regional Lambda functions
agent.print_response("List the Lambda functions returned for this region", markdown=True)

# Example 2: Invoke a specific Lambda function
agent.print_response("Invoke the 'hello-world' Lambda function with an empty payload", markdown=True)

Toolkit Params

ParameterTypeDefaultDescription
region_namestr"us-east-1"AWS region name where Lambda functions are located.
enable_list_functionsboolTrueEnable the list_functions functionality.
enable_invoke_functionboolTrueEnable the invoke_function functionality.
allboolFalseEnable all functionality.

Toolkit Functions

FunctionDescription
list_functionsReturns the first page (up to 50) in the configured region; pagination is not implemented.
invoke_functionInvokes a specific Lambda function with an optional payload. Takes function_name and optional payload parameters.

Developer Resources