Thin, spec-derived Python client for the Immersive Commons Agent REST API.
Project description
immersivecommons (Python)
Thin, dependency-free Python client for the Immersive Commons Agent REST API — the surface an AI agent uses to act on Floor 10 of Frontier Tower SF.
The client is derived from the OpenAPI spec: the operations table is generated from a vendored copy of openapi.json, and the transport is table-driven, so the methods cannot drift from the spec.
Install
pip install immersivecommons
Requires Python ≥ 3.9. Zero dependencies (stdlib urllib only).
Quickstart
from immersivecommons import Client
# Public reads need no token:
ic = Client()
events = ic.list_upcoming_events(limit=5)
# Authed calls take an agt_ bearer token:
agent = Client(token="agt_...")
agent.rsvp_to_event(
"https://luma.com/some-event",
email="me@example.com",
idempotency_key="rsvp-2026-07-16-me", # safe retries
)
Minting a token (device-code flow)
ic = Client()
result = ic.authorize(
["events:read_upcoming", "events:rsvp"],
client_name="my-agent",
on_prompt=lambda s: print(f"Approve at {s['verify_url']} with code {s['user_code']}"),
)
ic.set_token(result["token"])
Sandbox / test mode
Mint a sandbox token (Client(sandbox=True).authorize(...)) and every WRITE returns a simulated receipt — {"ok": True, "sandbox": True, "simulated": True, "would_have": {...}} — instead of mutating; reads serve real data. A green receipt means well-formed + scoped, not guaranteed to pass every production business rule. Feedback, token revocation, and research reads are always real even with a sandbox token.
Errors
Non-2xx responses raise IcApiError (.status, .error_kind, .retry_after_seconds, .body). It understands both the flat {"error": "..."} shape and the /api catch-all's nested {"error": {"code", "message"}}.
Escape hatch
Every operation is reachable generically:
ic.call("getDonorWall", query={"limit": 10})
The generated OPERATIONS table (path, method, scopes, idempotency, sandbox behaviour) is exported for inspection. The 4 Clerk-cookie-only operations have no methods — agents use the equivalent MCP tools.
Regenerate after a spec bump: python scripts/generate.py.
License
MIT
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file immersivecommons-0.1.0.tar.gz.
File metadata
- Download URL: immersivecommons-0.1.0.tar.gz
- Upload date:
- Size: 23.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b9299dd9bea5639a3c999d881d066d3afbb033edf1505a3303a6042c920ce47a
|
|
| MD5 |
3c772a19d3f4b4c8575dddc98b8199ca
|
|
| BLAKE2b-256 |
7a32a24155e77001809ece805b3eecc6a21f009b2e25019096bebfd94148209d
|
File details
Details for the file immersivecommons-0.1.0-py3-none-any.whl.
File metadata
- Download URL: immersivecommons-0.1.0-py3-none-any.whl
- Upload date:
- Size: 21.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8ed4fd8db55c8e828597f23abb34609fc97f2a312986001ffd059ae42822c729
|
|
| MD5 |
30c3dd406b606c062eae4263d05d5ee7
|
|
| BLAKE2b-256 |
a13b2fef30b841bfc524ce50a79258e6302e0f75e5f7dc45c518c76d00c90469
|