CLI型AIエージェントACEをPythonから簡単に利用するためのラッパーライブラリ
Project description
ace-py
概要
ace-py は来栖川電算の CLI 型 AI エージェント ACE を
Python から簡単に利用するためのラッパーライブラリです。
インストール
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.0.tar.gz
(2.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.0.tar.gz.
File metadata
- Download URL: ace_client-0.1.0.tar.gz
- Upload date:
- Size: 2.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fd389bfe91fe5a3ad03e175be5eadde46241e53d2c7b718c8419c1e72264cc06
|
|
| MD5 |
84a984c8f07c2b1c99ecd263751cc941
|
|
| BLAKE2b-256 |
cbbc28d08aa4db3ce937f28c7a1698fb395d6e7d8c8421d21a2f156557acdd7f
|
File details
Details for the file ace_client-0.1.0-py3-none-any.whl.
File metadata
- Download URL: ace_client-0.1.0-py3-none-any.whl
- Upload date:
- Size: 2.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.0
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f58deb3585bdd11c9f8d3cf7cec522ba391a121197a75c82ca61610d537be5e2
|
|
| MD5 |
33310e3035426d528aea7eed5f2a433e
|
|
| BLAKE2b-256 |
832abac99381008c53faa23f1ba0c708b1d638586f407019941239627facd69e
|