Skip to content
プロジェクト

概要

A ReAct-Based Highly Robust Autonomous Agent (Harness) Framework.

Web・アプリ開発

この数値の測り方

計測したスター増加

24時間
0
7日間
0
15日間
0
1か月
履歴を収集中

期間ごとの純増数です。期間は重複しており、日別の値ではありません。未計測の値は空欄です。スター数は注目度の指標であり、品質の保証ではありません。

i18n/README_ja-jp.md

オリジナル

Autono

Paper 基于 ReAct パラダイムの非常に強靭な自律型エージェントAIフレームワーク.

English | 繁體中文 | 简体中文 | 日本語


インストール

  • PYPIから

    pip install -U autono
    
  • Githubから

    pip install git+https://github.com/vortezwohl/Autono.git
    

引用

autonoフレームワークを研究に組み込む場合は、その貢献を認めるために適切に引用することを忘れないでください.

@article{wu2025autono,
author = {Zihao Wu},
title = {Autono: A ReAct-Based Highly Robust Autonomous Agent Framework},
journal = {arXiv preprint},
year = {2025},
eprint = {2504.04650},
archivePrefix = {arXiv},
primaryClass = {cs.MA},
url = {https://arxiv.org/abs/2504.04650}
}
@software{Wu_Autono_2025,
author = {Wu, Zihao},
license = {GPL-3.0},
month = apr,
title = {{Autono}},
url = {https://github.com/vortezwohl/Autono},
version = {1.0.0},
year = {2025}
}

クイックスタート

独自のエージェントを構築するには、以下の手順に従ってください。

  1. 環境変数OPENAI_API_KEYを設定

    # .env
    OPENAI_API_KEY=sk-...
    
  2. autonoからSDKを導入

    • Agentはエージェントをインスタンス化します。

    • Personalityはエージェントの個性をカスタマイズするための列挙クラスです。

      • Personality.PRUDENTはエージェントの行動をより慎重にします。

      • Personality.INQUISITIVEはエージェントがより積極的に試行錯誤し、探索することを奨励します。

    • get_openai_modelは思考エンジンとしてBaseChatModelを提供します。

    • @ability(brain: BaseChatModel, cache: bool = True, cache_dir: str = '')は関数をAbilityとして宣言するためのデコレータです。

    • @agentic(agent: Agent)は関数をAgenticAbilityとして宣言するためのデコレータです。

    from autono import (
        Agent,
        Personality,
        get_openai_model,
        ability,
        agentic
    )
    
  3. 基本的な能力として関数を宣言

    @ability
    def calculator(expr: str) -> float:
        # この関数は単一の数学式のみを受け付けます
        return simplify(expr)
    
    @ability
    def write_file(filename: str, content: str) -> str:
        with open(filename, 'w', encoding='utf-8') as f:
            f.write(content)
        return f'{content}が{filename}に書き込まれました。'
    
  4. エージェントをインスタンス化

    エージェントに能力を付与しながらインスタンス化できます。

    model = get_openai_model()
    agent = Agent(abilities=[calculator, write_file], brain=model, name='autono', personality=Personality.INQUISITIVE)
    
    • 後でエージェントにさらに能力を付与することもできます:

      agent.grant_ability(calculator)
      

      または

      agent.grant_abilities([calculator])
      
    • 能力を剥奪するには:

      agent.deprive_ability(calculator)
      

      または

      agent.deprive_abilities([calculator])
      

    メソッドchange_personality(personality: Personality)を使用してエージェントの個性を変更できます。

    agent.change_personality(Personality.PRUDENT)
    
  5. エージェントにリクエストを割り当てる

    agent.assign("Here is a sphere with radius of 9.5 cm and pi here is 3.14159, find the area and volume respectively then write the results into a file called 'result.txt'.")
    
  6. 残りの作業をエージェントに任せる

    response = agent.just_do_it()
    print(response)
    

autonoはマルチエージェント協力シナリオもサポートしています。@agentic(agent: Agent)を使用して関数をエージェント呼び出し能力として宣言し、それをエージェントに付与します。例を参照.

観測可能性

エージェントの作業プロセスを観測可能にするために、BeforeActionTakenとAfterActionTakenという2つのフックを提供します。 これらは、エージェントの各ステップのアクションの意思決定と実行結果を観察し、介入することを可能にします。 BeforeActionTakenフックを使用して、エージェントの次のアクションの意思決定結果を取得および変更でき、 AfterActionTakenフックを使用して、アクションの実行結果を取得および変更できます(改ざんされた実行結果はエージェントの記憶の一部になります)。

フックの使用を開始するには、以下の手順に従ってください。

  1. autonoからフックとメッセージを導入

    from autono.brain.hook import BeforeActionTaken, AfterActionTaken
    from autono.message import BeforeActionTakenMessage, AfterActionTakenMessage
    
  2. 関数を宣言し、それらをフックとしてカプセル化

    def before_action_taken(agent: Agent, message: BeforeActionTakenMessage):
        print(f'Agent: {agent.name}, Next move: {message}')
        return message
    
    def after_action_taken(agent: Agent, message: AfterActionTakenMessage):
        print(f'Agent: {agent.name}, Action taken: {message}')
        return message
    
    before_action_taken_hook = BeforeActionTaken(before_action_taken)
    after_action_taken_hook = AfterActionTaken(after_action_taken)
    

    これらの2つのフック関数では、メッセージをインターセプトし、メッセージ内の情報を印刷しました。 その後、メッセージを変更せずにエージェントに返しました。 もちろん、メッセージ内の情報を変更するオプションもあり、 これによりエージェントの作業プロセスに介入することができます。

  3. エージェントの作業プロセス中にフックを使用

    agent.assign(...).just_do_it(before_action_taken_hook, after_action_taken_hook)
    

関連プロジェクトを探す

読み込み中…