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
Release history Release notifications | RSS feed
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.2.tar.gz
(4.9 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ace_client-0.1.2.tar.gz.
File metadata
- Download URL: ace_client-0.1.2.tar.gz
- Upload date:
- Size: 4.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5b5cf8034a8bb2a08e4e192b5f8d2b9271298b4c2e8065f69feaf7f9183dd65b
|
|
| MD5 |
2b3fc7ebfd04c37a16b25225a600d0dc
|
|
| BLAKE2b-256 |
7b4b72fbac35a9be7bc40928d3131a1a06ab7d2b2f51e9f6d806db83fd884293
|
File details
Details for the file ace_client-0.1.2-py3-none-any.whl.
File metadata
- Download URL: ace_client-0.1.2-py3-none-any.whl
- Upload date:
- Size: 6.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
64dfe74ad319c5c4178611052c558a30be5a33bae6921e5829da48c02ec82dcb
|
|
| MD5 |
b6633e596c9ca29adfccd6cf9236d296
|
|
| BLAKE2b-256 |
c9de570ae77f841a6fa3285cc10338990995aa1c292ca415e1fc8a0d266df10a
|