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
synap_step_callbacks step_callbacks={MemoryStep: ...} Report the whole turn on Synap's live stream and 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 maximem_synap import MaximemSynapSDK
from synap_smolagents import create_synap_tools, synap_step_callbacks, 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=synap_step_callbacks(
        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.
  • Live stream. With sdk.instance.listen() running, the recorder also reports the turn as it happens: the user's task, the assistant's final answer, every tool call and its result, and the model's plan and step output as reasoning. Without a stream every one of those is a no-op, so nothing changes for callers who have not opted in.
  • Register against MemoryStep. synap_step_callbacks does this for you. Registering the recorder against ActionStep alone (what earlier versions of this README showed) never delivers the final answer, and the assistant turn is the one event anticipation acts on.
  • Two gaps, on purpose. Smolagents never passes its TaskStep to a callback, so the user turn is read from agent.task and reported at the end of the first step rather than before it (report_user_task=False turns it off). And a step with several parallel tool calls merges their outputs into one observations string, so that result is reported with no tool_call_id rather than being attributed to a guessed call.

Requires Python 3.11+ and smolagents>=1.26.

Metadata

Release files for maximem-synap-smolagents 0.1.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 maximem-synap-smolagents 0.1.1
File Size Uploaded Provenance Actions
maximem_synap_smolagents-0.1.1.tar.gz 14.2 kB Without provenance Details for maximem_synap_smolagents-0.1.1.tar.gz

Built distribution (wheel)

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

Total release size: 26.2 kB

Release files / maximem_synap_smolagents-0.1.1.tar.gz

Download URL maximem_synap_smolagents-0.1.1.tar.gz
Size 14.2 kB
Tags Source
SHA-256 checksum
How to use checksums
263455f60f78d14f3b2eea049f3f8dbdaa3381ac5111f4a804cff63885fdbc1c
BLAKE2b-256 checksum
How to use checksums
23f9430fc44983fc3ecb6f67254e2f8962c637b2d1383ed133501174c7d10dd3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.16

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

Download URL maximem_synap_smolagents-0.1.1-py3-none-any.whl
Size 12.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
18d5abcbcaabc69dd4cb4c2e01b993d472375f6003071540a8957755c0975cb1
BLAKE2b-256 checksum
How to use checksums
6520de27c66bbf867298d7abd206d8eda0c9919d39111f9cbc8a90906df3fc1e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.16

Security for maximem-synap-smolagents 0.1.1

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.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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