Repository navigation
fix(examples): exit non-zero when credentials are missing or nothing is listed - #258
Merged
Merged
Conversation
…is listed CLAUDE.md says each example must fail loudly rather than succeed with an empty catalog. Four examples printed "Set X" and returned, exiting 0, and none checked for an empty tool list. They now raise SystemExit, as openai_integration.py already does, and langchain_integration.py reports StackOne errors like the other examples instead of a traceback. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Guillaume Lebedel <10488548+glebedel@users.noreply.github.com>
… env guards pydantic_ai_integration.py renamed the fetched tools to `listed` only so it could rebind `tools` to the converted list; converting inline at the Agent call keeps a single name, as the other examples do. The LangChain and LangGraph guards now leave the same blank line before reading the account id as the Pydantic AI one, so the three env checks read identically. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Guillaume Lebedel <10488548+glebedel@users.noreply.github.com>
The search and execute half of the Pydantic AI example and the first two auth_management sections carried on with no tools. The Pydantic AI example had no StackOne error handling, the LangChain and LangGraph handlers missed ToolArgumentsError and labelled listing failures as rejected tool calls, and an unknown tool name in a LangChain tool call was skipped without a word. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Guillaume Lebedel <10488548+glebedel@users.noreply.github.com>
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.
What
CLAUDE.md says each example "must fail loudly rather than succeed with an empty catalog". Four examples printed "Set X to run this example." and returned, so they exited 0, and only
auth_management.pychecked for an empty tool list, in one of its three sections. They now behave likeopenai_integration.pyalready does.langchain_integration.pyraise SystemExit__main__like the other exampleslanggraph_integration.pyraise SystemExitpydantic_ai_integration.pyraise SystemExit__main__like the other examplesauth_management.pyraise SystemExitaccount_idis now read withos.environ[...]after the check, so ty sees astr.How verified
Each example run with no credentials, before and after:
With only
STACKONE_ACCOUNT_IDmissing, all four exit 1 naming that variable.ruff check,ruff format --checkandty check stackone_ai examplespass. The empty-catalog guards were not exercised against a live key.Gates (head 31f4c6e)
__main__handlers each standalone example needs, same count as before the review fixes)response_body. Resolved in 31f4c6e, which printsstr(exc); clean on 31f4c6e (job b2f55e81)StackOneError(soToolArgumentsErroris covered) and no longer call a listing failure a rejected tool call, and an unknown tool name in a LangChain tool call exits instead of being skipped. Declined 2: the env guard and empty-catalog message are repeated per file on purpose, since each example runs on its ownRequested by guillaume@stackone.com in Slack (repo audit thread).
🤖 Generated with Claude Code
Summary by cubic
Makes the example scripts fail loudly when credentials are missing or the account serves no tools, instead of exiting 0 with a printed message.
langchain_integration.py,langgraph_integration.py,pydantic_ai_integration.py, andauth_management.pynow raiseSystemExitfrom credential checks.langchain_integration.py,langgraph_integration.py, and the individual-tools path ofpydantic_ai_integration.py.langchain_integration.pynow catches StackOne API and toolset errors in__main__instead of letting them traceback.Written for commit 9fb20a8. Summary will update on new commits.