Skip to main content

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 ์—์ด์ „ํŠธ ๋งˆ์ผ“ํ”Œ๋ ˆ์ด์Šค

PyPI version License: MIT Python 3.10+

์„ค์น˜

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

๊ด€๋ จ ํŒจํ‚ค์ง€

WSP SDK์™€ ํ•จ๊ป˜ ์‚ฌ์šฉ

# WSP ๋ฉ€ํ‹ฐ์—์ด์ „ํŠธ ๊ธฐ๋Šฅ์„ ํฌํ•จํ•˜์—ฌ ์„ค์น˜
pip install dapparena-agent-sdk[wsp]

๋ผ์ด์„ ์Šค

MIT ยฉ Dapp Arena

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

dapparena_agent_sdk-0.2.0.tar.gz (16.0 kB view details)

Uploaded Source

Built Distribution

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

dapparena_agent_sdk-0.2.0-py3-none-any.whl (18.0 kB view details)

Uploaded Python 3

File details

Details for the file dapparena_agent_sdk-0.2.0.tar.gz.

File metadata

  • Download URL: dapparena_agent_sdk-0.2.0.tar.gz
  • Upload date:
  • Size: 16.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for dapparena_agent_sdk-0.2.0.tar.gz
Algorithm Hash digest
SHA256 e85ff3191efd26dcf228bf569d34c014cc5a7475519de5a86e59c4c34188c041
MD5 7fb29fea1e2b31e1745f6281001dbacf
BLAKE2b-256 844deb85f4693383cafb00037534925207a195977199508183a0884e11b9b4b3

See more details on using hashes here.

File details

Details for the file dapparena_agent_sdk-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for dapparena_agent_sdk-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 97ac71deea728b5144c3bc21147de2ff8d4641fc4e56004127d827c0e12e7012
MD5 e6e722750be3ec605a75ba599109f9a8
BLAKE2b-256 67a1cafedcb661787d4d9326ebaf6cf4bedf5f3c1ac6a8e0f46159d0d1042727

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