feat(bash-py): add OpenAI and LangChain examples#15
Open
mvanhorn wants to merge 1 commit into
Open
Conversation
The TypeScript bash package ships three runtime examples (anthropic-sdk, openai-sdk, vercel-ai-sdk). The Python bash-py package only had anthropic_agent.py. This adds two more so the Python surface matches. - bash-py/examples/openai_agent.py: AsyncOpenAI tool-use loop, max 8 turns - bash-py/examples/langchain_agent.py: langchain create_agent + tool wrapper Both default CONTAINER_TAG=user_42 to match the TS examples, take MODEL and PROMPT from env, and add no install requirements (deps are user-side via uv run --with).
Member
|
@vorflux review this PR |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The TypeScript
@supermemory/bashpackage ships three example agents (anthropic-sdk.ts,openai-sdk.ts,vercel-ai-sdk.ts). The Pythonsupermemory_bashpackage only shippedanthropic_agent.py. This adds two more so the Python coverage matches the TypeScript coverage.Demo
Why this matters
bash-pyexports the same surface asbash(Shell,SupermemoryVolume,TOOL_DESCRIPTION,PathIndex,SessionCache). The asymmetry was in the example directory, not the API. A Python developer surveying the repo today would reasonably conclude Anthropic is the supported path, even thoughcreate_bashis provider-agnostic.Reference points in the repo at HEAD:
bash/examples/openai-sdk.ts,bash/examples/anthropic-sdk.ts,bash/examples/vercel-ai-sdk.ts— three TS examplesbash-py/examples/anthropic_agent.py— single Python examplebash-py/supermemory_bash/__init__.py— exports match the TSindex.tsChanges
bash-py/examples/openai_agent.py(105 lines):AsyncOpenAItool-use loop, max 8 turns. Mirrorsbash/examples/openai-sdk.ts— same model default (gpt-4o), same prompt seed, samebashtool name.bash-py/examples/langchain_agent.py(72 lines): LangChaincreate_agent+@toolwrapper. LangChain is the closest Python analogue to Vercel AI SDK (ergonomic agent framework wrapper).Both default
CONTAINER_TAG=user_42to match the TS examples, takeOPENAI_MODELandPROMPTfrom env so they're reconfigurable without code edits, and add no entries topyproject.toml—openaiandlangchainare user-installed viauv run --with, same pattern as the existinganthropic_agent.py.Testing
python3 -m py_compile bash-py/examples/openai_agent.py bash-py/examples/langchain_agent.py— both compileruff format --check bash-py/examples/— cleanruff check bash-py/examples/— clean (I001 import-sort applied during the implementation pass)The examples themselves aren't run end-to-end here; that requires a
SUPERMEMORY_API_KEY+OPENAI_API_KEYpair the local environment doesn't have. The structure mirrors the workinganthropic_agent.py.AI was used for assistance.