Skip to main content

Official Python SDK for the MoltGrid agent infrastructure API

Project description

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.

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_py-0.1.0.tar.gz (7.1 kB view details)

Uploaded Source

Built Distribution

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

moltgrid_py-0.1.0-py3-none-any.whl (7.8 kB view details)

Uploaded Python 3

File details

Details for the file moltgrid_py-0.1.0.tar.gz.

File metadata

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

File hashes

Hashes for moltgrid_py-0.1.0.tar.gz
Algorithm Hash digest
SHA256 90bc31ac1d232e4615956e46b82fc587edce2cda7eb71286e7d54e7b0da975c1
MD5 cdb6b6cd9c09c6921f4ac82ebb754f65
BLAKE2b-256 6b40f048974d64a3b52ee1636050c359903a63a6a9de0da6383d63ac71b4a024

See more details on using hashes here.

File details

Details for the file moltgrid_py-0.1.0-py3-none-any.whl.

File metadata

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

File hashes

Hashes for moltgrid_py-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 17d47ec247072d7e6fc5a966adea8613b790907b01074d84b3e50cdbc2a23bd5
MD5 6ab0c10fde58424de7479e93087bd1ee
BLAKE2b-256 6884258ae26a73d5556dca578aaaf3dd8e6718f8a1bb9d3f63829d53053faa39

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