Skip to main content

⚠️ Solace Agent Mesh plugins in Python are now deprecated

👋 Thank you to everyone who's used the Solace Agent Mesh plugins! This Python version is now deprecated — it's no longer under active development and won't receive new features, bug fixes or security updates.

🚀 Check out the new version of Solace Agent Mesh → https://docs.solace.com/Agent-Mesh/agent-mesh.htm

🖥️ A free edition of the Solace Agent Mesh desktop app is available: https://solace.com/products/agent-mesh/download

These packages remain installable; the repository will be archived (read-only) for reference.

sam-mongodb SAM Plugin

A plugin that provides a MongoDB agent to perform complex queries based on natural language.

This plugin enables Solace Agent Mesh (SAM) agents to interact with MongoDB databases through natural language queries. The agent translates user questions into MongoDB aggregation pipelines and executes them, returning results in various formats.

About Solace Agent Mesh

Solace Agent Mesh (SAM) is an open-source framework for building event-driven, multi-agent AI systems where specialized agents collaborate on complex tasks. It provides a standardized way for agents to communicate, share data, and integrate with external systems while keeping components loosely coupled and production-ready.

SAM helps you:

  • Build event-driven multi-agent systems on Solace Event Mesh
  • Connect agents, tools, gateways, and services through a common runtime
  • Extend projects with installable plugins such as sam-mongodb

Learn more in the Solace Agent Mesh documentation and the main project repository.

Features

  • Natural Language to MongoDB: Converts user queries into MongoDB aggregation pipelines
  • Lifecycle Management: Efficient database connection management with initialization and cleanup
  • Schema Auto-Detection: Automatically detects and summarizes database schema for better LLM context
  • Multiple Output Formats: Supports JSON, YAML, CSV, and Markdown output formats
  • Artifact Management: Large results are saved as artifacts for efficient handling
  • Configurable Collection Targeting: Can target specific collections or query across all collections

Architecture

The plugin follows a modern, tool-based architecture with clear separation of concerns:

  • lifecycle.py: Manages agent initialization and cleanup, including database connections and schema detection
  • search_query.py: Contains the main mongo_query tool that executes aggregation pipelines
  • services/database_service.py: Encapsulates all MongoDB operations and connection management

Installation

sam plugin add <your-component-name> --plugin sam-mongodb

This creates a new component configuration at configs/plugins/<your-component-name-kebab-case>.yaml.

Configuration

Environment Variables

Set the following environment variables for your MongoDB connection:

export MONGO_HOST="localhost"
export MONGO_PORT=27017
export MONGO_USER="your_username"
export MONGO_PASSWORD="your_password"
export MONGO_DB="your_database"
export MONGO_COLLECTION="your_collection"
export DB_PURPOSE="Description of your database purpose"
export DB_DESCRIPTION="Detailed description of your data"

Agent Configuration

The plugin uses agent lifecycle functions for efficient resource management. Key configuration sections:

Agent Initialization

agent_init_function:
  module: "sam_mongodb.lifecycle"
  name: "initialize_mongo_agent"
  config:
    db_host: "${MONGO_HOST}"
    db_port: ${MONGO_PORT}
    db_user: "${MONGO_USER}"
    db_password: "${MONGO_PASSWORD}"
    db_name: "${MONGO_DB}"
    database_collection: "${MONGO_COLLECTION}"
    database_purpose: "${DB_PURPOSE}"
    data_description: "${DB_DESCRIPTION}"
    auto_detect_schema: true
    max_inline_results: 10

Tool Configuration

tools:
  - tool_type: python
    component_module: "sam_mongodb.search_query"
    function_name: "mongo_query"
    tool_config:
      collection: "${MONGO_COLLECTION}"

Example Queries

The agent can handle various types of MongoDB queries:

  • Aggregation queries: "Show me the top 5 products by sales"
  • Filtering: "Find all users registered in the last 30 days"
  • Grouping: "Group orders by status and count them"
  • Complex pipelines: "Calculate average order value by customer segment"

Metadata

Release files for sam-mongodb 0.1.4

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

Built distribution (wheel)

Table of built distributions (wheels) for sam-mongodb 0.1.4
File Interpreter ABI Platform
sam_mongodb-0.1.4-py3-none-any.whl Python 3 none any Details

Release files / sam_mongodb-0.1.4-py3-none-any.whl

Download URL sam_mongodb-0.1.4-py3-none-any.whl
Size 15.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5668990b81135ef08e067ece82c95deaa3d09696d968e4b63a6079de22bf2e3e
BLAKE2b-256 checksum
How to use checksums
d524ae6f1e56c28b3e52de67be0dd18b4765c70b21c6510d2a4dc2aedf026a90
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 28, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.4 This release

1 release file

0.1.2

1 release file

0.1.1

1 release file

0.1.0

1 release file

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