Skip to main content

Spectron agent memory as tools for the Strands Agents SDK.

Project description

spectron-strands-agents

Spectron agent memory as tools for the Strands Agents SDK.

Spectron is SurrealDB's provenance-first, tri-temporal memory and knowledge layer for AI agents. This package exposes Spectron's memory operations as Strands tools, so any Strands agent can store and retrieve long-term memory with a single line of setup:

from strands import Agent
from spectron_strands import spectron_tools

agent = Agent(tools=spectron_tools())

agent("Remember that we signed a contract with Meditech Solutions for 1.2M GBP.")
print(agent("What is the value of the Meditech Solutions contract?"))

Installation

pip install spectron-strands-agents
pip install "spectron-strands-agents[bedrock]"

Requires Python 3.10 or newer.

Configuration

The tools need a Spectron client. Provide the connection details as environment variables:

export SPECTRON_ENDPOINT="https://api.spectron.example"
export SPECTRON_API_KEY="your-bearer-token"
export SPECTRON_CONTEXT="acme-prod"

With those set, spectron_tools() builds the client for you. You can also pass the values directly, or hand in a client you already have:

from surrealdb import Spectron
from spectron_strands import spectron_tools

# From explicit arguments.
tools = spectron_tools(
    endpoint="https://api.spectron.example",
    api_key="your-bearer-token",
    context="acme-prod",
)

# Or reuse an existing client.
client = Spectron(context="acme-prod", endpoint="...", api_key="...")
tools = spectron_tools(client=client)

Tools

spectron_tools() returns seven tools by default, one per Spectron operation:

Tool Purpose
spectron_remember Store a fact or observation for later recall.
spectron_recall Search memory and return the most relevant stored information.
spectron_context Assemble a working-memory context block for a query.
spectron_reflect Run a synthesis pass that consolidates and connects memories.
spectron_forget Delete memories that match a query.
spectron_upload Ingest a document so its contents become recallable.
spectron_inspect Browse the substrate as queryable data for debugging or audit.

Choose a subset with include or exclude:

# Only the everyday read/write pair.
tools = spectron_tools(include=["remember", "recall"])

# Everything except deletion and inspection.
tools = spectron_tools(exclude=["forget", "inspect"])

Scopes

Spectron scopes isolate memory by principal, tenant or session. A scope is a path string such as "org/acme/user/alice", or a list of paths. Set a default scope for all tools, and let the agent override it per call when needed:

tools = spectron_tools(scope="org/acme/user/alice")

Every tool also accepts a scope argument, so a multi-user agent can direct a single memory operation at a specific principal.

How it works

Each tool is a thin wrapper over one method on the synchronous surrealdb.Spectron client. Because that client is synchronous, the tools call it directly. There is no background event loop or async shim to manage.

Spectron is in early preview. The remember, recall and context tools follow the documented client signatures. The reflect, forget, upload and inspect tools cover operations whose keyword arguments are still settling. If a method name or argument differs in the version of surrealdb you have installed, the fix is a single call inside the matching factory in src/spectron_strands/tools.py.

Examples

Runnable examples live in examples/. They use Amazon Bedrock, which is Strands' default model provider. See examples/README.md for what each one shows and how to run it.

Roadmap

  • Async tools built on AsyncSpectron.
  • Streaming chat and the grouped resources (sessions, entities, and others).

License

Apache License 2.0. See LICENSE.

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

spectron_strands_agents-0.1.0.tar.gz (16.1 kB view details)

Uploaded Source

Built Distribution

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

spectron_strands_agents-0.1.0-py3-none-any.whl (13.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: spectron_strands_agents-0.1.0.tar.gz
  • Upload date:
  • Size: 16.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.13

File hashes

Hashes for spectron_strands_agents-0.1.0.tar.gz
Algorithm Hash digest
SHA256 9d399259c2a81f09ef3b126f575e2d1f988cc50b9c6ce6ee841546482c3d0b26
MD5 b61b070da99fbe690a115fb7a768c4f8
BLAKE2b-256 5f0489bd73d3a945bee5398f0054ddc77dc3ada2757597a7116fff337b8959f0

See more details on using hashes here.

Provenance

The following attestation bundles were made for spectron_strands_agents-0.1.0.tar.gz:

Publisher: release.yml on surrealdb/spectron-strands-agents

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

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

File metadata

File hashes

Hashes for spectron_strands_agents-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a0d166eb18ce4b5373392e6284354ed7d29f490ca863a02569c7826a01e2b56f
MD5 8ba0ce3950a9eeb026fede1c8a16be8a
BLAKE2b-256 9b4a7826d5f54886365f2d602a9adc5b4d46d370817d45c97e681e9f142ea622

See more details on using hashes here.

Provenance

The following attestation bundles were made for spectron_strands_agents-0.1.0-py3-none-any.whl:

Publisher: release.yml on surrealdb/spectron-strands-agents

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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