Upgrade to Pro — share decks privately, control downloads, hide ads and more …

デモ実装で考えるStrands Agentsのいいところ

Avatar for yoko yoko
July 22, 2025
560

デモ実装で考えるStrands Agentsのいいところ

Avatar for yoko

yoko

July 22, 2025
Tweet

Transcript

  1. from strands import Agent agent = Agent( model=model, tools=tools, system_prompt=system_prompt

    ) Strands Agents? Strands Agents? オープンソースのエージェント開発フレームワーク 👆これだけでAIエージェントが定義できる
  2. StrandsAgents:実装 StrandsAgents:実装 ソースコード(抜粋) #使⽤するモデルの定義 bedrock_model=BedrockModel(  model_id= apac.anthropic.claude-3-5-sonnet-20241022-v2:0 ,  region_name= ap-northeast-1

    ,  temperature=0.7,  max_tokens=4000 ) #MCPクライアント、ツールの定義 MCP_URL=os.environ[ MCP_URL ] mcp_client=MCPClient(lambda:streamablehttp_client(MCP_URL)) mcp_tools=mcp_client.list_tools_sync() #エージェントの定義 agent=Agent(  model=bedrock_model,  tools=all_tools,  system_prompt=system_prompt ) #エージェントの応答をストリーミング loop=asyncio.new_event_loop() response=loop.run_until_complete(stream_agent_response(agent,prompt,st.container())) loop.close()
  3. StrandsAgents:実装 StrandsAgents:実装 ファイル全部でこれだけ aws-detective-agent/ ├──app/#エージェントアプリ │├──main.py │├──requirements.txt │├──Dockerfile ├──lambda/#MCPサーバー │├──mcpserver/

    ││└──main.py │├──Dockerfile │└──pyproject.toml ├──lib/       #CDK │├──config.ts │└──stack.ts ├──bin/        #CDK │└──app.ts └──cdk.json └──package.json
  4. おしまい おしまい 参考 https://strandsagents.com/latest/ https://github.com/jlowin/fastmcp https://github.com/ag-ui-protocol/ag-ui https://github.com/strands-agents/sdk-python https://github.com/awslabs/mcp/blob/main/src/lambda-tool-mcp-server https://aws.amazon.com/jp/blogs/news/introducing-strands-agents-an-open-source-ai-agents-sdk/ https://qiita.com/minorun365/items/dd05a3e4938482ac6055

    https://qiita.com/kyuko/items/cb75e8f0a50985ca2030 https://qiita.com/5enxia/items/0dfca327e8f14f0b9d86 https://www.ranthebuilder.cloud/post/mcp-server-on-aws-lambda https://memoribuka-lab.com/?p=4460#google_vignette https://dev.classmethod.jp/articles/aws-lambda-mpc-server/