Skip to main content

SDK for Cassiopeia Agent via Redis

Project description

Cassiopeia Agent Python SDK

한국어 | English

English

Overview

Official Python SDK for the Cassiopeia Agent framework. Install this single library to connect your agent to the orchestra network — no Redis wiring, no message schema boilerplate.

What you get:

  • AgentBase — base class: implement handle() and you're done
  • AgentBrain — NLU router: natural-language → BrainDecision (tool + params) with injection guard, retry, rate limit
  • Tool — typed tool definition with JSON Schema validation
  • CassiopeiaClient — low-level Redis Pub/Sub messaging
  • verify_message — HMAC signature verification for incoming tasks
  • Protocol types: AgentResult, OrchestraTask, LLMRequest, LLMResponse

Requirements

  • Python 3.10+
  • Access to the orchestra's Redis server

Installation

pip install cassiopeia-sdk

Quickstart

import asyncio, os
from cassiopeia_sdk import AgentBase, AgentMessage

class MyAgent(AgentBase):
    async def handle(self, msg: AgentMessage) -> None:
        # Call LLM through the orchestra gateway (no API key needed)
        response = await self.request_llm([
            {"role": "user", "content": msg.payload["content"]}
        ])
        await self.send_result(msg.payload["task_id"], {"answer": response["content"]})

async def main():
    agent = MyAgent(os.getenv("AGENT_ID"), os.getenv("REDIS_URL"))
    await agent.register(os.getenv("ORCHESTRA_URL"), capabilities=["my_action"],
                         allow_llm_access=True, api_key=os.getenv("ORCHESTRA_API_KEY"))
    await agent.start()

asyncio.run(main())

See GUIDE.md for the full reference.


한국어

개요

Cassiopeia 에이전트 프레임워크의 공식 Python SDK입니다. 이 라이브러리 하나만 설치하면 오케스트라 네트워크에 에이전트를 연결할 수 있습니다. Redis 연결이나 메시지 스키마를 직접 다룰 필요가 없습니다.

제공 기능:

  • AgentBase — 기본 클래스: handle()만 구현하면 동작
  • AgentBrain — NLU 라우터: 자연어 → BrainDecision(Tool + 파라미터), 인젝션 방어·재시도·속도 제한 내장
  • Tool — JSON Schema 기반 타입 안전 도구 정의
  • CassiopeiaClient — 저수준 Redis Pub/Sub 메시징
  • verify_message — 수신 메시지 HMAC 서명 검증
  • 프로토콜 타입: AgentResult, OrchestraTask, LLMRequest, LLMResponse

요구사항

  • Python 3.10 이상
  • 오케스트라의 Redis 서버 접근 가능

설치

pip install cassiopeia-sdk

빠른 시작

import asyncio, os
from cassiopeia_sdk import AgentBase, AgentMessage

class MyAgent(AgentBase):
    async def handle(self, msg: AgentMessage) -> None:
        # 오케스트라 LLM 게이트웨이 호출 (별도 API 키 불필요)
        response = await self.request_llm([
            {"role": "user", "content": msg.payload["content"]}
        ])
        await self.send_result(msg.payload["task_id"], {"answer": response["content"]})

async def main():
    agent = MyAgent(os.getenv("AGENT_ID"), os.getenv("REDIS_URL"))
    await agent.register(os.getenv("ORCHESTRA_URL"), capabilities=["my_action"],
                         allow_llm_access=True, api_key=os.getenv("ORCHESTRA_API_KEY"))
    await agent.start()

asyncio.run(main())

전체 레퍼런스는 GUIDE.md를 참고하세요.

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

cassiopeia_sdk-0.3.0.tar.gz (31.9 kB view details)

Uploaded Source

Built Distribution

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

cassiopeia_sdk-0.3.0-py3-none-any.whl (33.4 kB view details)

Uploaded Python 3

File details

Details for the file cassiopeia_sdk-0.3.0.tar.gz.

File metadata

  • Download URL: cassiopeia_sdk-0.3.0.tar.gz
  • Upload date:
  • Size: 31.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.20

File hashes

Hashes for cassiopeia_sdk-0.3.0.tar.gz
Algorithm Hash digest
SHA256 b43ae5105d2cd263f6735965673c1956ab54106ea58024c23ae4a08414a55bf4
MD5 2d31dcd59703c935e7b0cd6d10b3bb99
BLAKE2b-256 daabad77561bf34a19010c7015dc60c00520e1a259227eef191fd6559708404e

See more details on using hashes here.

File details

Details for the file cassiopeia_sdk-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: cassiopeia_sdk-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 33.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.20

File hashes

Hashes for cassiopeia_sdk-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5e02a044bade4928c8ff29f47fe4db3e9ad473b6b82155315fdba4ee09d15957
MD5 71af86f66d4b9f6d4fa08e4c226bcc5e
BLAKE2b-256 278d768ff97fbc9b08d17ee961315def49a4da09a60878d8900cc116b14da447

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