> ## Documentation Index
> Fetch the complete documentation index at: https://nvd-54.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# AWS lambda 集成

> 使用 LangChain Python 集成 AWS lambda。

> [`Amazon AWS Lambda`](https://aws.amazon.com/pm/lambda/) is a serverless computing service provided by `Amazon Web Services` (`AWS`). It helps developers to build and run applications and services without provisioning or managing servers. This serverless architecture enables you to focus on writing and deploying code, while AWS automatically takes care of scaling, patching, and managing the infrastructure required to run your applications.

本 notebook 介绍如何使用 `AWS Lambda` Tool.

By including the `AWS Lambda` in the list of tools provided 提供自然语言接口 Agent, you can grant your Agent the ability to invoke code running in your AWS Cloud for whatever purposes you need.

When an Agent uses the `AWS Lambda` tool, it will provide an argument of type string which will in turn be passed into the Lambda function via the event parameter.

首先，你需要安装 `boto3` Python 包。

```python theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
pip install -qU boto3 > /dev/null
pip install -qU langchain-community
```

In order for an agent to use the tool, you must provide it with the name and description that match the functionality of you lambda function's logic.

You must also provide the name of your function.

请注意 because this tool is effectively just a wrapper around the boto3 library, you will need to run `aws configure` in order to make use of the 工具。 For more detail, see the [AWS CLI documentation](https://docs.aws.amazon.com/cli/index.html)

```python theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
from langchain.agents import create_agent, load_tools
from langchain_openai import OpenAI

llm = OpenAI(temperature=0)

tools = load_tools(
    ["awslambda"],
    awslambda_tool_name="email-sender",
    awslambda_tool_description="sends an email with the specified content to test@testing123.com",
    function_name="testFunction1",
)

agent = create_agent(
    model=llm,
    tools=tools,
)

agent.invoke("Send an email to test@testing123.com saying hello world.")
```

```python theme={"theme":{"light":"catppuccin-latte","dark":"catppuccin-mocha"}}
```

***

<div className="source-links">
  <Callout icon="terminal-2">
    [Connect these docs](/use-these-docs) to Claude, VSCode, and more via MCP for real-time answers.
  </Callout>

  <Callout icon="edit">
    [Edit this page on GitHub](https://github.com/langchain-ai/docs/edit/main/src/oss/python/integrations/tools/awslambda.mdx) or [file an issue](https://github.com/langchain-ai/docs/issues/new/choose).
  </Callout>
</div>
