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

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

๋ผ์ด์„ ์Šค

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.1.1.tar.gz (14.3 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.1.1-py3-none-any.whl (17.9 kB view details)

Uploaded Python 3

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

Hashes for dapparena_agent_sdk-0.1.1.tar.gz
Algorithm Hash digest
SHA256 3e662a5c391ac77cd2c77f109908ad3548d6b4e73e1852e908b837683f9763a5
MD5 470dac2bb2c04daf2ab6135209a2bddf
BLAKE2b-256 240a0eee8e19197556655555bb588593dcd28d7b959694fee543e17abda6958f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dapparena_agent_sdk-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 88df9a82f239a0e1afd30d55827b785390577e8139ace17712c52659ca95dc63
MD5 234bdfff1af741aee0711ecb693e150a
BLAKE2b-256 0d272ca5eff53cc71de88841e206180b9b4659cdacb15438cb5ee3f4715115d3

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