Movatterモバイル変換


[0]ホーム

URL:


Skip to main content
OurBuilding Ambient Agents with LangGraph course is now available on LangChain Academy!
Open In ColabOpen on GitHub

AWS Lambda

Amazon AWS Lambda is a serverless computing service provided byAmazon 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.

This notebook goes over how to use theAWS Lambda Tool.

By including theAWS Lambda in the list of tools provided to an 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 theAWS Lambda tool, it will provide an argument of type string which will in turn be passed into the Lambda function via the event parameter.

First, you need to installboto3 python package.

%pip install--upgrade--quiet  boto3>/dev/null
%pip install--upgrade--quiet 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.

Note that because this tool is effectively just a wrapper around the boto3 library, you will need to runaws configure in order to make use of the tool. For more detail, seehere

from langchain.agentsimport AgentType, initialize_agent, load_tools
from langchain_openaiimport 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= initialize_agent(
tools, llm, agent=AgentType.ZERO_SHOT_REACT_DESCRIPTION, verbose=True
)

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

Related


[8]ページ先頭

©2009-2025 Movatter.jp