From e9fe7a913da06c075af7c6557c9f7027f9a01fe2 Mon Sep 17 00:00:00 2001 From: Dhravya <63950637+Dhravya@users.noreply.github.com> Date: Tue, 28 Apr 2026 00:13:11 +0000 Subject: [PATCH] docs(smfs): apply review feedback to bash-tool-python MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Wrap quickstart and memory snippets in asyncio.run(main()) so they run as standalone scripts (top-level await is a SyntaxError). - Drop `volume` from CreateBashResult listing (not used in any snippet) and match the more direct phrasing used in the TS doc. - Use `bash = result.bash` consistently in the Memory section to match the Quickstart style. - Drop `messages: list[dict]` annotations — type is obvious from context. --- apps/docs/smfs/bash-tool-python.mdx | 34 +++++++++++++++++------------ 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/apps/docs/smfs/bash-tool-python.mdx b/apps/docs/smfs/bash-tool-python.mdx index b7cbc4a6..61092813 100644 --- a/apps/docs/smfs/bash-tool-python.mdx +++ b/apps/docs/smfs/bash-tool-python.mdx @@ -24,25 +24,30 @@ uv add supermemory-bash ## Quickstart ```python +import asyncio import os from supermemory_bash import create_bash -result = await create_bash( - api_key=os.environ["SUPERMEMORY_API_KEY"], - container_tag="user_42", -) -bash = result.bash -r = await bash.exec("ls /") -print(r.stdout) + +async def main() -> None: + result = await create_bash( + api_key=os.environ["SUPERMEMORY_API_KEY"], + container_tag="user_42", + ) + bash = result.bash + r = await bash.exec("ls /") + print(r.stdout) + + +asyncio.run(main()) ``` `create_bash` returns a `CreateBashResult` with: - `bash`: a `Shell` instance with `.exec(cmd)` -- `volume`: the underlying `SupermemoryVolume` -- `tool_description`: a pre-written tool description (`str`) ready to hand to the model -- `configure_memory_paths(paths)`: async callable to scope which paths get extracted into Supermemory -- `refresh()`: async callable to re-prime the path index after external writes +- `tool_description`: a pre-written tool description ready to hand to the model +- `configure_memory_paths(paths)`: scope which paths get extracted into Supermemory +- `refresh()`: re-prime the path index after external writes ## Use it as a model tool @@ -80,7 +85,7 @@ async def run_agent(user_message: str) -> str: } ] - messages: list[dict] = [{"role": "user", "content": user_message}] + messages = [{"role": "user", "content": user_message}] for _ in range(10): response = client.messages.create( @@ -158,7 +163,7 @@ async def run_agent(user_message: str) -> str: } ] - messages: list[dict] = [{"role": "user", "content": user_message}] + messages = [{"role": "user", "content": user_message}] for _ in range(10): response = client.chat.completions.create( @@ -206,6 +211,7 @@ The Bash Tool inherits SMFS memory semantics. By default, files named `user.md` ```python result = await create_bash(api_key=api_key, container_tag=container_tag) +bash = result.bash await result.configure_memory_paths(["/notes/", "/journal.md"]) ``` @@ -214,7 +220,7 @@ Trailing `/` matches recursively. No slash matches an exact file. Pass `[]` to d The container also exposes a virtual `profile.md` at the root: a live digest of everything in the container. Read it once at the start of a session to give the model context without walking every file. ```python -r = await result.bash.exec("cat /profile.md") +r = await bash.exec("cat /profile.md") print(r.stdout) ```