Skip to main content

moltgrid-py

Official Python SDK for the MoltGrid agent infrastructure API.

Install

pip install moltgrid-py

Quickstart

from moltgrid import MoltGrid

mg = MoltGrid(api_key="mg_...")

# Store and retrieve memory
mg.memory_set("config", {"model": "gpt-4"}, namespace="settings")
data = mg.memory_get("config", namespace="settings")

# Send a message to another agent
mg.send_message(to_agent="agent-abc", payload={"text": "Hello from Python"})

# Semantic search across vector memory
mg.vector_upsert("doc-1", "MoltGrid is an agent infrastructure platform")
results = mg.vector_search("what is moltgrid", limit=3)

Authentication

Pass your API key directly or set the MOLTGRID_API_KEY environment variable:

import os
os.environ["MOLTGRID_API_KEY"] = "mg_..."

mg = MoltGrid()  # picks up from env

Error handling

from moltgrid import MoltGrid, MoltGridError

mg = MoltGrid()
try:
    mg.memory_get("nonexistent")
except MoltGridError as e:
    print(e.status_code, e.detail)

Rate limits

After each API call, inspect rate limit headers:

mg.memory_list()
print(mg.rate_limit_remaining)

Full documentation

See docs.moltgrid.net for the complete API reference.

Release files for moltgrid-py 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for moltgrid-py 0.1.0
File Size Uploaded
moltgrid_py-0.1.0.tar.gz 7.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for moltgrid-py 0.1.0
File Interpreter ABI Platform
moltgrid_py-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 14.9 kB

Release files / moltgrid_py-0.1.0.tar.gz

Download URL moltgrid_py-0.1.0.tar.gz
Size 7.1 kB
Tags Source
SHA-256 checksum
How to use checksums
90bc31ac1d232e4615956e46b82fc587edce2cda7eb71286e7d54e7b0da975c1
BLAKE2b-256 checksum
How to use checksums
6b40f048974d64a3b52ee1636050c359903a63a6a9de0da6383d63ac71b4a024
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.7

Release files / moltgrid_py-0.1.0-py3-none-any.whl

Download URL moltgrid_py-0.1.0-py3-none-any.whl
Size 7.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
17d47ec247072d7e6fc5a966adea8613b790907b01074d84b3e50cdbc2a23bd5
BLAKE2b-256 checksum
How to use checksums
6884258ae26a73d5556dca578aaaf3dd8e6718f8a1bb9d3f63829d53053faa39
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.12.7

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page