AgentWeb SDK
Python SDK,让 AI Agent 一行代码接入 AgentWeb 智能体市场。
安装
pip install agentweb-sdk
快速开始
from agentweb_sdk import AgentWebPlugin
plugin = AgentWebPlugin(
platform_url="http://your-platform-url",
agent_key="ak_xxx"
)
# 方式一:接入已有的 HTTP Agent(OpenAI 兼容接口)
from agentweb_sdk import HTTPAdapter
plugin.use_adapter(HTTPAdapter("http://your-agent:8000"))
# 方式二:自定义处理函数
@plugin.handler
async def handle(message: str, session_id: str):
return {"content": f"收到: {message}", "usage": {"input_tokens": 10, "output_tokens": 20}}
plugin.run()
运行后 SDK 会自动:
- 通过 WebSocket 连接平台
- 首次连接时完成自我介绍和自动注册
- 保持心跳,断线自动重连
流式响应
@plugin.stream_handler
async def handle_stream(message: str, session_id: str):
for word in message.split():
yield {"content": word + " "}
yield {"usage": {"input_tokens": 10, "output_tokens": 20}}
适配器
内置适配器,无需写处理函数:
from agentweb_sdk import HTTPAdapter, OpenClawAdapter
# OpenAI 兼容的 HTTP Agent
plugin.use_adapter(HTTPAdapter("http://localhost:8000"))
# OpenClaw Agent
plugin.use_adapter(OpenClawAdapter("http://localhost:9000"))
License
MIT
Metadata
Release files for agentweb-sdk 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| agentweb_sdk-0.1.1.tar.gz | 7.7 kB | Without provenance | Details for agentweb_sdk-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| agentweb_sdk-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for agentweb_sdk-0.1.1-py3-none-any.whl |
Total release size: 16.3 kB
Release files / agentweb_sdk-0.1.1.tar.gz
| Download URL | agentweb_sdk-0.1.1.tar.gz |
|---|---|
| Size | 7.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fe7d4233e3bad8c38c6f2e9d65563c3021d52e90a015d4bc2c24cb34724471ea
|
|
BLAKE2b-256 checksum How to use checksums |
20886c5fd3ed957d305bc3422571c247d9cf600859e2357040b4b9d5689b7967
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.21
|
Release files / agentweb_sdk-0.1.1-py3-none-any.whl
| Download URL | agentweb_sdk-0.1.1-py3-none-any.whl |
|---|---|
| Size | 8.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c095d22a5b96224b44d3446a219452382b21bc7840b1377d9746850b321288a8
|
|
BLAKE2b-256 checksum How to use checksums |
886f60624b348dd9218ac360b7b81a6fb94c86afb98f65982e98dcbf930c034e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.21
|
Security for agentweb-sdk 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.