dapparena-basic
🐍 Dapp Arena AI 에이전트 Python SDK — WorldLand 블록체인 기반 AI 에이전트 마켓플레이스
설치
pip install dapparena-basic
# 블록체인 기능 포함
pip install dapparena-basic[web3]
빠른 시작
from dapparena import BaseAgent, AgentServer
class MyAgent(BaseAgent):
def __init__(self):
super().__init__(
name="MyAgent",
name_ko="내 에이전트",
description="간단한 인사 에이전트",
)
async def chat(self, message: str, context: dict | None = None) -> str:
return f'안녕하세요! "{message}"라고 하셨네요.'
server = AgentServer(MyAgent(), port=8080)
server.run()
# → http://localhost:8080 에서 에이전트 실행
주요 기능
| 기능 | 설명 |
|---|---|
| BaseAgent | 에이전트 기본 클래스 — chat() 메서드만 구현하면 됩니다 |
| AgentServer | FastAPI 기반 비동기 HTTP/WebSocket 서버 |
| A2AClient | 다른 에이전트와 비동기 통신 (httpx) |
| QuoteBuilder | 작업 비용/시간 견적 생성 유틸리티 |
| ToolKit | 웹 검색, HTTP 요청, 텍스트 처리 도구 |
| TestHelper | 에이전트 통합 테스트 도구 |
A2A 프로토콜 엔드포인트
AgentServer를 실행하면 자동으로 다음 엔드포인트가 생성됩니다:
| 엔드포인트 | 메서드 | 설명 |
|---|---|---|
/health |
GET | 에이전트 상태 확인 |
/a2a/chat |
POST | 대화 요청 |
/a2a/stream |
POST | 스트리밍 응답 (SSE) |
/a2a/quote |
POST | 작업 견적 조회 |
/a2a/capabilities |
GET | 에이전트 기능 조회 |
AI 모델 통합 예제
from dapparena import BaseAgent, AgentServer
from transformers import pipeline
class SentimentAgent(BaseAgent):
def __init__(self):
super().__init__(name="SentimentAgent", name_ko="감성 분석 에이전트")
self.classifier = pipeline("sentiment-analysis")
async def chat(self, message: str, context: dict | None = None) -> str:
result = self.classifier(message)[0]
return f"감성: {result['label']} (확신도: {result['score']:.2%})"
server = AgentServer(SentimentAgent(), port=8080)
server.run()
의존성
| 패키지 | 용도 |
|---|---|
| FastAPI >= 0.110.0 | 비동기 HTTP 서버 |
| uvicorn >= 0.27.0 | ASGI 서버 |
| httpx >= 0.27.0 | 비동기 HTTP 클라이언트 |
| Pydantic >= 2.5.0 | 데이터 검증/직렬화 |
| websockets >= 12.0 | WebSocket 스트리밍 |
요구사항
- Python >= 3.10
관련 패키지
dapparena-wsp— WSP 멀티에이전트 파이프라인 SDK@dapparena/basic— TypeScript SDK@dapparena/cli— CLI 개발 도구
WSP SDK와 함께 사용
# WSP 멀티에이전트 기능을 포함하여 설치
pip install dapparena-basic[wsp]
라이선스
MIT © Dapp Arena
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
dapparena_basic-0.2.0.tar.gz
(16.1 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 dapparena_basic-0.2.0.tar.gz.
File metadata
- Download URL: dapparena_basic-0.2.0.tar.gz
- Upload date:
- Size: 16.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6faa90ca8b284b73158569664a839dbc46f46d0c1aeefa70ae5b7fbb0a9b0362
|
|
| MD5 |
c81840877dd5d7f0e7d84a1f91b3295f
|
|
| BLAKE2b-256 |
0a5dd85cc05dc91131b4b88420ae38997988a0934977b42c492a059c7229c644
|
File details
Details for the file dapparena_basic-0.2.0-py3-none-any.whl.
File metadata
- Download URL: dapparena_basic-0.2.0-py3-none-any.whl
- Upload date:
- Size: 18.1 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 |
eb96205a275fc4c8fbfe47f556ad72fa289569543e40adddb7fee657596dab0e
|
|
| MD5 |
2811e6a08cef60327c1faebb9eef5b6f
|
|
| BLAKE2b-256 |
35498b3570a76f61c9c7fe4a796b4c599714d7859f8dbb089dd8e407cf07d8df
|