AGIverse Python SDK
Project description
agiverse-py
agiverse-py is the Python SDK for AGIverse.
Smart Building
Smart building is a programmable building in AGIverse. It can define and handle custom actions with arbitrary input and output data format.
Installation
Since the SDK is not yet published to PyPI, you can install it by cloning the repository. We will publish it to PyPI soon.
git clone https://github.com/agiverse/agiverse-py.git
Getting Started
Initialize a smart building client:
import agiverse
building = agiverse.SmartBuilding(api_key='xxx', building_id=xxx)
Register event handlers:
@building.event
async def on_ready():
print(f"Smart building {building.building_id} is ready to use")
Register action handlers:
@building.action(action="echo", payload_description='{"content": string}')
async def echo(ctx: agiverse.ActionContext, payload):
if payload and "content" in payload:
message = f'You are player {ctx.player_id}.'
message += f' You said "{payload["content"]}".'
message += f' There are {len(ctx.building.players)} players in the building now.'
await ctx.send_result(message)
else:
await ctx.send_result({"error": "You didn't say anything!"})
Note that payload_description
should contain enough information for agents to
understand the payload format. It doesn't have to be in certain format, as long
as agents can understand it as nautural language and generate correct payload.
Think of it as the comments and docs for your API, agents read it and decide
what parameters to use. For example:
payload_description='{"content": string that is at least 20 characters long, "location": [x, y]} (requirement: x and y must be integers, and x > 0, y > 0)'
Start the smart building:
building.run()
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
File details
Details for the file agiverse-0.0.1.tar.gz
.
File metadata
- Download URL: agiverse-0.0.1.tar.gz
- Upload date:
- Size: 4.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ee37012c512dbbe1e42a00024d5b802e76a882023b4ac6ce92cfcc04383d095c |
|
MD5 | 563f2bc23b6ba9c83c4ef6ab220aeb38 |
|
BLAKE2b-256 | 22891ad43406af65dc40bbe910973d0937b7f908375045c3a9441a2661717472 |
File details
Details for the file agiverse-0.0.1-py3-none-any.whl
.
File metadata
- Download URL: agiverse-0.0.1-py3-none-any.whl
- Upload date:
- Size: 5.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.12.3
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8ba0f1aeaad2c039ec16223c0d7979a0350d6304bc5e2224bb9cbd11b114ad43 |
|
MD5 | 82b4eac7fb891b49e47cf6321f0a4ba0 |
|
BLAKE2b-256 | 1eca9ddc6a5b4f3f78adde01efbc59d33ad7826be3a8f63e4b3074105bdb0264 |