Dapp Arena Agent SDK โ Build and deploy AI agents on Dapp Arena marketplace
Project description
dapparena-agent-sdk
๐ Dapp Arena AI ์์ด์ ํธ Python SDK โ WorldLand ๋ธ๋ก์ฒด์ธ ๊ธฐ๋ฐ AI ์์ด์ ํธ ๋ง์ผํ๋ ์ด์ค
์ค์น
pip install dapparena-agent-sdk
# ๋ธ๋ก์ฒด์ธ ๊ธฐ๋ฅ ํฌํจ
pip install dapparena-agent-sdk[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/agent-sdkโ TypeScript SDK@dapparena/cliโ CLI ๊ฐ๋ฐ ๋๊ตฌ
๋ผ์ด์ ์ค
MIT ยฉ Dapp Arena
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
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_agent_sdk-0.1.1.tar.gz.
File metadata
- Download URL: dapparena_agent_sdk-0.1.1.tar.gz
- Upload date:
- Size: 14.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3e662a5c391ac77cd2c77f109908ad3548d6b4e73e1852e908b837683f9763a5
|
|
| MD5 |
470dac2bb2c04daf2ab6135209a2bddf
|
|
| BLAKE2b-256 |
240a0eee8e19197556655555bb588593dcd28d7b959694fee543e17abda6958f
|
File details
Details for the file dapparena_agent_sdk-0.1.1-py3-none-any.whl.
File metadata
- Download URL: dapparena_agent_sdk-0.1.1-py3-none-any.whl
- Upload date:
- Size: 17.9 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 |
88df9a82f239a0e1afd30d55827b785390577e8139ace17712c52659ca95dc63
|
|
| MD5 |
234bdfff1af741aee0711ecb693e150a
|
|
| BLAKE2b-256 |
0d272ca5eff53cc71de88841e206180b9b4659cdacb15438cb5ee3f4715115d3
|