SDK for Cassiopeia Agent via Redis
Project description
Cassiopeia Agent Python SDK
English
Overview
This is the official Python SDK for the Cassiopeia Agent framework. It provides an asynchronous, easy-to-use interface to connect to the Cassiopeia messaging bus (via Redis Pub/Sub), register tools, and communicate with other agents.
Installation
pip install cassiopeia-sdk
Usage Example
import asyncio
from cassiopeia_sdk.client import CassiopeiaClient
from cassiopeia_sdk.tools import Tool, ToolExecutor
async def main():
# 1. Initialize the client
client = CassiopeiaClient(agent_id="my_agent", redis_url="redis://localhost:6379")
# 2. Define and register a custom tool
executor = ToolExecutor()
async def hello_handler(args):
return f"Hello, {args.get('name')}!"
my_tool = Tool(
name="say_hello",
description="Greets the user",
parameters={"type": "object", "properties": {"name": {"type": "string"}}}
)
executor.register_tool(my_tool, hello_handler)
# 3. Connect to the messaging bus
await client.connect()
# 4. Send a message
await client.send_message(action="do_task", payload={"task": "test"})
if __name__ == "__main__":
asyncio.run(main())
한국어
개요
Cassiopeia 에이전트 프레임워크를 위한 공식 Python SDK입니다. 비동기 기반의 쉬운 인터페이스를 통해 Cassiopeia 메시징 버스(Redis Pub/Sub)에 연결하고, 도구(Tool)를 등록하며, 다른 에이전트와 통신할 수 있도록 지원합니다.
설치 방법
pip install cassiopeia-sdk
사용 예시
import asyncio
from cassiopeia_sdk.client import CassiopeiaClient
from cassiopeia_sdk.tools import Tool, ToolExecutor
async def main():
# 1. 클라이언트 초기화
client = CassiopeiaClient(agent_id="my_agent", redis_url="redis://localhost:6379")
# 2. 커스텀 도구 등록
executor = ToolExecutor()
async def hello_handler(args):
return f"안녕하세요, {args.get('name')}님!"
my_tool = Tool(
name="say_hello",
description="사용자에게 인사합니다",
parameters={"type": "object", "properties": {"name": {"type": "string"}}}
)
executor.register_tool(my_tool, hello_handler)
# 3. 메시징 버스에 연결
await client.connect()
# 4. 메시지 전송
await client.send_message(action="do_task", payload={"task": "test"})
if __name__ == "__main__":
asyncio.run(main())
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
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 cassiopeia_sdk-0.1.0.tar.gz.
File metadata
- Download URL: cassiopeia_sdk-0.1.0.tar.gz
- Upload date:
- Size: 9.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c4fbf8328118a2a424a8d0a2ee584fe35ec37073932b3f703d428039cd6eba4c
|
|
| MD5 |
0376c5e9bc6835daab8c0854f2d268ab
|
|
| BLAKE2b-256 |
2197852350e1e2a60937e721495d0c593549c0b7cdeb3db6448ec679f59dda7b
|
File details
Details for the file cassiopeia_sdk-0.1.0-py3-none-any.whl.
File metadata
- Download URL: cassiopeia_sdk-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9cc234a0a7cc315b30e278f6f9c9295eb80e33800abe9c03de9cf0368320a02e
|
|
| MD5 |
5a5bf245c9d851a5a78589d3dabaac4a
|
|
| BLAKE2b-256 |
6032c0b88722215e1204a50c069b86e3bb291089bf41fb5de1b282c9ae3f1d70
|