Skip to main content

Strands Agents Moss Integration

Moss delivers sub-10ms semantic retrieval, giving your Strands Agents instant access to a knowledge base during conversations.

Installation

pip install strands-agents-moss

Prerequisites

  • Moss project ID and project key (get them from Moss Portal)
  • Python 3.10+
  • Model provider credentials — Strands Agents defaults to Amazon Bedrock as the LLM provider. Make sure your AWS credentials are configured (e.g. AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY, AWS_REGION). To use a different provider, see Choosing a model provider below.

Quick Start

import asyncio
import os

from strands import Agent
from strands_agents_moss import MossSearchTool

async def main():
    # Create and pre-load the Moss search tool
    moss = MossSearchTool(
        project_id=os.getenv("MOSS_PROJECT_ID"),
        project_key=os.getenv("MOSS_PROJECT_KEY"),
        index_name="my-index",
    )
    await moss.load_index()

    # Create a Strands agent with Moss retrieval
    agent = Agent(tools=[moss.tool])
    agent("What is your refund policy?")

asyncio.run(main())

Choosing a Model Provider

Strands Agents defaults to Amazon Bedrock. If you don't have AWS credentials or prefer a different provider, pass a model argument to Agent:

# OpenAI
from strands.models.openai import OpenAIModel
agent = Agent(model=OpenAIModel("gpt-4o"), tools=[moss.tool])

# Anthropic
from strands.models.anthropic import AnthropicModel
agent = Agent(model=AnthropicModel("claude-sonnet-4-20250514"), tools=[moss.tool])

See the Strands model providers docs for all supported providers.

Configuration Options

MossSearchTool

Parameter Default Description
project_id MOSS_PROJECT_ID env var Moss project ID
project_key MOSS_PROJECT_KEY env var Moss project key
index_name (required) Name of the Moss index to query
tool_name moss_search Tool name exposed to the LLM
tool_description (auto-generated) Tool description exposed to the LLM
top_k 5 Number of results to retrieve per query
alpha 0.8 Blend: 1.0 = semantic only, 0.0 = keyword only
result_prefix Relevant knowledge base results:\n\n Prefix for formatted results

Methods

Method Description
load_index() Async. Pre-load the Moss index for fast first queries
search(query) Async. Query Moss and return formatted results as a string
tool Property. Returns the Strands-compatible tool to pass to Agent(tools=[...])

Multi-Agent Example

Moss tools work seamlessly with Strands' agents-as-tools pattern:

from strands import Agent
from strands_agents_moss import MossSearchTool

async def main():
    moss = MossSearchTool(
        index_name="product-docs",
    )
    await moss.load_index()

    # Research agent with knowledge base access
    researcher = Agent(
        system_prompt="You are a research assistant. Use moss_search to find information.",
        tools=[moss.tool],
    )

    # Orchestrator that delegates to the researcher
    orchestrator = Agent(
        system_prompt="You coordinate research tasks. Delegate questions to the researcher.",
        tools=[researcher.as_tool(
            name="researcher",
            description="A research assistant with access to the knowledge base",
        )],
    )

    orchestrator("Summarize our return and refund policies.")

License

This integration is provided under the BSD 2-Clause License.

Support

Release files for strands-agents-moss 0.0.1

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

Source distribution (sdist)

Source distribution for strands-agents-moss 0.0.1
File Size Uploaded
strands_agents_moss-0.0.1.tar.gz 7.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for strands-agents-moss 0.0.1
File Interpreter ABI Platform
strands_agents_moss-0.0.1-py3-none-any.whl Python 3 none any Details

Total release size: 14.1 kB

Release files / strands_agents_moss-0.0.1.tar.gz

Download URL strands_agents_moss-0.0.1.tar.gz
Size 7.8 kB
Tags Source
SHA-256 checksum
How to use checksums
d72c01609a123616890f8b579d4fc598addeb815a580088ccfddd762f429789f
BLAKE2b-256 checksum
How to use checksums
3e283fea8579e6437dc670ef804cc48293f4c69a4f4884aa6423c74e2a8506d4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.15

Release files / strands_agents_moss-0.0.1-py3-none-any.whl

Download URL strands_agents_moss-0.0.1-py3-none-any.whl
Size 6.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cfa75610b316a9bc2a2d6f7a9307235afea9a350f6135ed0e7cdd3238b36b590
BLAKE2b-256 checksum
How to use checksums
4db2e8259626467a701a3281403d2e8560ca6e112725f319f9e39a8ceff10cea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.11.15

Release history Release notifications | RSS feed

This release

0.0.1 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