Agno : コンセプト : モデル – 概要, OpenAI, Anthropic Claude

言語モデルは、自然言語とコードを理解できるようにトレーニングされた機械学習プログラムです。モデルはエージェントの頭脳として機能し、エージェントの推論、行動、そしてユーザへの応答を支援します。より良いモデルにより、エージェントはより賢くなります。

Agno : ユーザガイド : コンセプト : モデル – 概要, OpenAI, Anthropic Claude

作成 : クラスキャット・セールスインフォメーション
作成日時 : 07/29/2025
バージョン : Agno 1.7.5

* 本記事は docs.agno.com の以下のページを独自に翻訳した上で、補足説明を加えてまとめ直しています :

* サンプルコードの動作確認はしておりますが、必要な場合には適宜、追加改変しています。
* ご自由にリンクを張って頂いてかまいませんが、sales-info@classcat.com までご一報いただけると嬉しいです。

 

 

Agno ユーザガイド : コンセプト : モデル – 概要

言語モデルは、自然言語とコードを理解できるようにトレーニングされた機械学習プログラムです。

モデルはエージェントの頭脳として機能し、エージェントの推論、行動、そしてユーザへの応答を支援します。より良いモデルにより、エージェントはより賢くなります。

from agno.agent import Agent
from agno.models.openai import OpenAIChat

agent = Agent(
    model=OpenAIChat(id="gpt-4o"),
    description="Share 15 minute healthy recipes.",
    markdown=True,
)
agent.print_response("Share a breakfast recipe.", stream=True)

 

エラー処理

エージェントで exponential_backoff を True に設定して、3rd パーティ・モデルプロバイダーのエラーにより失敗したリクエストを自動的にリトライするようにできます。

agent = Agent(
    model=OpenAIChat(id="gpt-4o"),
    exponential_backoff=True,
    retries=2,
    retry_delay=1,
)

 

Agno ユーザガイド : コンセプト : モデル – OpenAI

Agno で OpenAI モデルを使用する方法を学習します。

GPT モデルはクラス最高の LLM で、エージェントのデフォルト LLM として使用されます。OpenAI は様々なワールドクラスのモデルをサポートしています。See their models here.

ユースケースに最適なモデルを見つけるために実験することを勧めます。幾つかの一般的な推奨は以下です :

  • gpt-4o は殆どの一般的なユースケースに適しています。

  • gpt-4o-mini モデルはより小さいタスクや高速な推論に適しています。

  • o1 モデルは複雑な推論や複数ステップのタスクに適しています。

  • o3-mini は、ツール呼び出しと構造化出力をサポートする強力な推論モデルで、コストは遥かに安価です。

OpenAI は tier ベースのレート制限があります。See the docs for more information.

 

認証

OPENAI_API_KEY 環境変数を設定します。You can get one from OpenAI here.

export OPENAI_API_KEY=sk-***

 

エージェントで OpenAIChat を使用します :

agent.py

from agno.agent import Agent, RunResponse
from agno.models.openai import OpenAIChat

agent = Agent(
    model=OpenAIChat(id="gpt-4o"),
    markdown=True
)

# Print the response in the terminal
agent.print_response("Share a 2 sentence horror story.")

View more examples here.

 

Agno ユーザガイド : コンセプト : モデル – Anthropic Claude

Agno で Anthropic Claude モデルを使用する方法を学習します。

Claude は Anthropic の基盤となる AI モデルのファミリーで、様々なアプリケーションで使用できます。See their model comparisons here.

ユースケースに最適なモデルを見つけるために実験することを勧めます。幾つかの一般的な推奨は以下です :

  • claude-3-5-sonnet-20241022 モデルは殆どのユースケースに適し、画像入力をサポートします。

  • claude-3-5-haiku-20241022 モデルは最速のモデルです。

Anthropic は API にレート制限があります。See the docs for more information.

 

認証

ANTHROPIC_API_KEY 環境変数を設定します。You can get one from Anthropic here.

export ANTHROPIC_API_KEY =sk-***

 

エージェントで Claude を使用します :

agent.py

from agno.agent import Agent, RunResponse
from agno.models.anthropic import Claude

agent = Agent(
    model=Claude(id="claude-3-5-sonnet-20240620"),
    markdown=True
)

# Print the response on the terminal
agent.print_response("Share a 2 sentence horror story.")

View more examples here.

 

以上