Skip to main content

maximem-synap-smolagents

Synap memory integration for Smolagents — give a CodeAgent / ToolCallingAgent persistent memory through Synap.

pip install maximem-synap-smolagents smolagents

Surfaces

Smolagents keeps its own fixed step log (no pluggable memory backend), so Synap plugs into the two extension points it does expose, plus static instructions:

Surface Smolagents extension point Purpose
create_synap_tools @tool Explicit search_memory / store_memory the model can call
create_synap_recorder step_callbacks={ActionStep: ...} Record each completed action into Synap
synap_st_instructions CodeAgent(instructions=...) Fold Synap short-term context into the agent's instructions

Example

from smolagents import CodeAgent, InferenceClientModel
from smolagents.memory import ActionStep
from maximem_synap import MaximemSynapSDK
from synap_smolagents import create_synap_tools, create_synap_recorder, synap_st_instructions

sdk = MaximemSynapSDK(api_key="sk-...")

agent = CodeAgent(
    model=InferenceClientModel(),
    tools=create_synap_tools(sdk, user_id="alice", customer_id="acme"),
    instructions=synap_st_instructions(
        sdk, conversation_id="conv_abc",
        instructions="You are a concise, friendly assistant.",
    ),
    step_callbacks={
        ActionStep: create_synap_recorder(
            sdk, user_id="alice", conversation_id="conv_abc", customer_id="acme"
        )
    },
)
agent.run("Remind me what plan I'm on and my open ticket.")

Because CodeAgent calls tools as plain Python, search_memory / store_memory compose naturally into agent-written code.

Notes

  • Synchronous framework. Smolagents runs synchronously and its tools do not support async, so every surface bridges to the async Synap SDK internally. Run the agent on its own thread if your app is otherwise async.
  • Error policy. The search_memory tool degrades (returns a not-found message); store_memory raises SynapIntegrationError; the recorder logs and never raises — it runs inside the agent loop, where a raising callback would abort the run.
  • Per-step documents. The recorder writes each ActionStep to its own Synap document, so multi-step runs are captured in full.

Requires Python 3.11+ and smolagents>=1.26.

Release files for maximem-synap-smolagents 0.1.0

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

Source distribution (sdist)

Source distribution for maximem-synap-smolagents 0.1.0
File Size Uploaded
maximem_synap_smolagents-0.1.0.tar.gz 8.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for maximem-synap-smolagents 0.1.0
File Interpreter ABI Platform
maximem_synap_smolagents-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 16.2 kB

Release files / maximem_synap_smolagents-0.1.0.tar.gz

Download URL maximem_synap_smolagents-0.1.0.tar.gz
Size 8.0 kB
Tags Source
SHA-256 checksum
How to use checksums
fdeec44c959039dbcf0e7869eb34702c6ce7c9119a873aa0108c180ce45af23c
BLAKE2b-256 checksum
How to use checksums
8abfee1a6ff6586cacda1ece325b4c666c6189020481d1df80dbeba40dc1e771
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.2

Release files / maximem_synap_smolagents-0.1.0-py3-none-any.whl

Download URL maximem_synap_smolagents-0.1.0-py3-none-any.whl
Size 8.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4e89e96526621ce28a0c9bad4f5661cdd06fcc1f13744ba400b2202a7066d0db
BLAKE2b-256 checksum
How to use checksums
39dcdc2f412265871de668f70065a314b18a70130cc604dec18b65f725ab1b3e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.14.2

Release history Release notifications | RSS feed

This release

0.1.0 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