Skip to main content

CLI型AIエージェントACEをPythonから簡単に利用するためのラッパーライブラリ

Project description

ace-py

概要

ace-py は来栖川電算の CLI 型 AI エージェント ACE を Python から簡単に利用するためのラッパーライブラリです。

インストール

リポジトリ名は ace-py ですが、PyPI上のパッケージ名は ace-client です。インストール時はパッケージ名にご注意ください。

pip install ace-client

または uv を使用する場合:

uv add ace-client

使用例

簡単な使用例です。環境変数 OPENAI_API_KEY に API キーを入れて実行します。

import asyncio
import os

import msgspec

from ace_client import Ace


class Response(msgspec.Struct):
    answer: str


async def main() -> None:
    api_key = os.environ.get("OPENAI_API_KEY", "")
    if not api_key:
        print("環境変数 OPENAI_API_KEY を設定してください", file=sys.stderr)
        sys.exit(1)

    ace = Ace(api_key=api_key)

    try:
        # 30秒のタイムアウトを設定してACEを呼び出す
        # イベントをトリガーにしてキャンセルしたい場合はTaskGroup等を使用して明示的にキャンセルを呼び出してください
        async with asyncio.timeout(30):
            result = await ace.invoke(
                config_path="example/simple.yaml",
                agent_name="root",
                input_data={"question": "今日の名古屋の天気は?"},
            )
            response = result.unmarshal(Response)
            print(response.answer)

    except Exception as e:
        print(f"エラーが発生しました: {e}", file=sys.stderr)
        sys.exit(1)


if __name__ == "__main__":
    asyncio.run(main())

ライセンス

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ace_client-0.1.1.tar.gz (2.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ace_client-0.1.1-py3-none-any.whl (3.0 kB view details)

Uploaded Python 3

File details

Details for the file ace_client-0.1.1.tar.gz.

File metadata

  • Download URL: ace_client-0.1.1.tar.gz
  • Upload date:
  • Size: 2.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.6.0

File hashes

Hashes for ace_client-0.1.1.tar.gz
Algorithm Hash digest
SHA256 c5c97c5f40468ccafe9dafa65e6a2a36e10cc22b817a58517ba2753c28c5c233
MD5 837d94f1797ccc697b547504f3427e31
BLAKE2b-256 97dcfd1152c18240403e4a84184a74144518a667bbd764d737eca514bb59228e

See more details on using hashes here.

File details

Details for the file ace_client-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for ace_client-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f6a3b41dcf6289acc68739949f919e9c0135e7c48cdef7203eadbbac6da35e0f
MD5 3d96ddb1aad4bc1bcd058371af87028e
BLAKE2b-256 5e950284493b4cbc18c3f19fb71beb9a94be0e794051ec2d94074b73cbf6890a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page