Moss semantic search integration for Strands Agents
Project description
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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file strands_agents_moss-0.0.1.tar.gz.
File metadata
- Download URL: strands_agents_moss-0.0.1.tar.gz
- Upload date:
- Size: 7.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d72c01609a123616890f8b579d4fc598addeb815a580088ccfddd762f429789f
|
|
| MD5 |
21c8df1a6569d08e430678de0b9aab10
|
|
| BLAKE2b-256 |
3e283fea8579e6437dc670ef804cc48293f4c69a4f4884aa6423c74e2a8506d4
|
File details
Details for the file strands_agents_moss-0.0.1-py3-none-any.whl.
File metadata
- Download URL: strands_agents_moss-0.0.1-py3-none-any.whl
- Upload date:
- Size: 6.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.15
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cfa75610b316a9bc2a2d6f7a9307235afea9a350f6135ed0e7cdd3238b36b590
|
|
| MD5 |
fde5d5f8a32c9b7c75ab62d0ec53432f
|
|
| BLAKE2b-256 |
4db2e8259626467a701a3281403d2e8560ca6e112725f319f9e39a8ceff10cea
|