aicc-py 0.1.0: initial SDK

- protocol.py: pydantic models for all AICC message types (envelope,
  session_init, tool_call, tool_result, event, error, heartbeat)
- bridge.py: Bridge with @bridge.tool registration, capability checks,
  session management, serve_forever
- client.py: AICCClient with single background reader (safe on
  concurrent transports like WebSocket), call_tool, events, manifest
- tool.py: @tool decorator with schema generation from type hints
- schema.py: JSON Schema generation (str/int/float/bool, list, dict,
  Optional, pydantic models)
- transport: Transport protocol, InProcessTransport, WebSocket client+server
- tests: 12 passing (integration, schema, websocket roundtrip)
- examples: bridge_minimal.py + agent_minimal.py (verified end-to-end)
This commit is contained in:
Emil Shanaty
2026-08-08 03:10:35 +03:00
commit 0cfb4277b5
22 changed files with 1698 additions and 0 deletions
+30
View File
@@ -0,0 +1,30 @@
"""Minimal AICC agent connecting to the bridge example.
Run bridge_minimal.py first, then:
python examples/agent_minimal.py
"""
import asyncio
from aicc import AICCClient
from aicc.transport import WebSocketClientTransport
async def main() -> None:
async with AICCClient(WebSocketClientTransport("ws://127.0.0.1:8765")) as client:
manifest = await client.handshake()
print(f"Connected to world: {manifest.world.name} ({manifest.world.kind})")
print(f"Tools: {[t.id for t in manifest.tools]}")
res = await client.call_tool("proprioception", {})
print(f"proprioception -> {res.output}")
res = await client.call_tool("move", {"forward": 2.5})
print(f"move -> {res.output}")
res = await client.call_tool("turn", {"yaw": -45})
print(f"turn -> {res.output}")
if __name__ == "__main__":
asyncio.run(main())
+45
View File
@@ -0,0 +1,45 @@
"""Minimal AICC bridge with a capsule in a room.
Run:
python examples/bridge_minimal.py
Then connect from another terminal:
python examples/agent_minimal.py
"""
import asyncio
from aicc import Bridge
from aicc.transport import WebSocketServer
async def main() -> None:
bridge = Bridge(name="capsule-room", kind="3d", tick_rate_hz=10.0)
@bridge.tool(description="Get the agent's current position and rotation.")
async def proprioception() -> dict:
return {
"position": {"x": 1.0, "y": 0.5, "z": 2.0},
"rotation": {"yaw": 0.0, "pitch": 0.0},
"velocity": {"x": 0.0, "y": 0.0, "z": 0.0},
"health": 100,
}
@bridge.tool(description="Move the agent forward by the given distance in meters.")
async def move(forward: float = 0.0) -> dict:
return {"moved": forward}
@bridge.tool(description="Turn the agent's heading by the given yaw angle in degrees.")
async def turn(yaw: float = 0.0) -> dict:
return {"turned": yaw}
print(f"AICC bridge '{bridge.name}' listening on ws://127.0.0.1:8765")
async with WebSocketServer(bridge, port=8765):
await bridge.serve_forever()
if __name__ == "__main__":
try:
asyncio.run(main())
except KeyboardInterrupt:
pass