Skip to main content

Official Python SDK for the MoltGrid agent infrastructure API

Project description

moltgrid

Official Python SDK for the MoltGrid agent infrastructure API.

Install

pip install moltgrid

Quick Start

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)

Documentation

Full API reference: api.moltgrid.net/docs

License

Apache 2.0

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

moltgrid-0.2.0.tar.gz (14.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

moltgrid-0.2.0-py3-none-any.whl (13.4 kB view details)

Uploaded Python 3

File details

Details for the file moltgrid-0.2.0.tar.gz.

File metadata

  • Download URL: moltgrid-0.2.0.tar.gz
  • Upload date:
  • Size: 14.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.7

File hashes

Hashes for moltgrid-0.2.0.tar.gz
Algorithm Hash digest
SHA256 432e46d15bd104851bdb95236fda65f41f1a08d79e1375a80815cdea5a6b1363
MD5 de37be49c46062575d06ec5a5be3fe8f
BLAKE2b-256 0a142a1cffad94ec2bccdb2f92e503e051c36e8096546bcc63e752c900945950

See more details on using hashes here.

File details

Details for the file moltgrid-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: moltgrid-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 13.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.7

File hashes

Hashes for moltgrid-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 41ea86beb1772c3c3897b07c6cc6fa68060dcd2919dc85e137abaf7d2060290d
MD5 0ce71daeb3145849e10cda0771abbcb7
BLAKE2b-256 2064cdc384adb7ac3e0162b1676e5fd0147a788d92f052a56fd5dcdbef896a59

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page