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.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

maximem_synap_smolagents-0.1.0.tar.gz (8.0 kB view details)

Uploaded Source

Built Distribution

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

maximem_synap_smolagents-0.1.0-py3-none-any.whl (8.3 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for maximem_synap_smolagents-0.1.0.tar.gz
Algorithm Hash digest
SHA256 fdeec44c959039dbcf0e7869eb34702c6ce7c9119a873aa0108c180ce45af23c
MD5 f779e11b9235322539ab50e87fa0fe49
BLAKE2b-256 8abfee1a6ff6586cacda1ece325b4c666c6189020481d1df80dbeba40dc1e771

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for maximem_synap_smolagents-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4e89e96526621ce28a0c9bad4f5661cdd06fcc1f13744ba400b2202a7066d0db
MD5 e1f1c20d2fc8ce0d48debd3b66e7c131
BLAKE2b-256 39dcdc2f412265871de668f70065a314b18a70130cc604dec18b65f725ab1b3e

See more details on using hashes here.

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