見出し画像

Strands Agents SDK × OllamaでAIエージェントを動かしてみる。

AWSが公開したStrands Agents SDKとOllamaモデルを組み合わせてみました。

コードのポイント:

  • ローカルで起動しているOllamaサーバーに接続し、`phi4-mini` モデルを使用します。

  • エージェントに「Tell me about Strands agents.」という指示を与えます。

実行結果(抜粋):

As of my last update in October 2023, there is no widely recognized concept or entity known as "Strands Agents."
 It's possible that this could be a newly emerging term related to recent developments unknown at the time you asked.

If you're referring specifically to something like Strandlife (a life insurance company), Strands Holdings Inc. 
...

コード全体:

from strands import Agent
from strands.models.ollama import OllamaModel

# Create an Ollama model instance
ollama_model = OllamaModel(
    host="http://localhost:11434",
    model_id="phi4-mini"
)

# Create an agent using the Ollama model
agent = Agent(model=ollama_model)

# Use the agent
agent("Tell me about Strands agents.")

まとめ:

Strands Agents SDKとOllamaを組み合わせることで、簡単にエージェントを起動できます。マルチエージェントやMCPにも対応しているようです。
エンジョイ!

いいなと思ったら応援しよう!