Skip to main content

Dapp Arena Agent SDK โ€” Build and deploy AI agents on Dapp Arena marketplace

Project description

dapparena-basic

๐Ÿ Dapp Arena AI ์—์ด์ „ํŠธ Python SDK โ€” WorldLand ๋ธ”๋ก์ฒด์ธ ๊ธฐ๋ฐ˜ AI ์—์ด์ „ํŠธ ๋งˆ์ผ“ํ”Œ๋ ˆ์ด์Šค

PyPI version License: MIT Python 3.10+

์„ค์น˜

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

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_basic-0.2.0.tar.gz (16.1 kB view details)

Uploaded Source

Built Distribution

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

dapparena_basic-0.2.0-py3-none-any.whl (18.1 kB view details)

Uploaded Python 3

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

Hashes for dapparena_basic-0.2.0.tar.gz
Algorithm Hash digest
SHA256 6faa90ca8b284b73158569664a839dbc46f46d0c1aeefa70ae5b7fbb0a9b0362
MD5 c81840877dd5d7f0e7d84a1f91b3295f
BLAKE2b-256 0a5dd85cc05dc91131b4b88420ae38997988a0934977b42c492a059c7229c644

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for dapparena_basic-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 eb96205a275fc4c8fbfe47f556ad72fa289569543e40adddb7fee657596dab0e
MD5 2811e6a08cef60327c1faebb9eef5b6f
BLAKE2b-256 35498b3570a76f61c9c7fe4a796b4c599714d7859f8dbb089dd8e407cf07d8df

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