Fix five issues found running the agent examples - #495
Open
ambiorix2099 wants to merge 6 commits into
Open
Conversation
ambiorix2099
marked this pull request as ready for review
August 14, 2026 21:58
- settings.py docstring claimed the default model was anthropic/claude-sonnet-4-6; the code defaults to openai/gpt-4o (#485). - Add langchain-anthropic to the langchain and agents extras, so langgraph/43_react_agent_multi_model.py runs after the documented install. It requires anthropic >=0.120 and langchain-core >=1.5.4, which the lock file now reflects (#486). - Wrap the body of langgraph/46_crash_and_resume.py in a __main__ guard. Without it, spawned workers re-imported the module and re-ran the whole demo. The tools and graph stay at module level so workers can still rebuild them (#489). - Replace anthropic/claude-sonnet-4-20250514, which the API answers with 404 not_found_error, with anthropic/claude-sonnet-5, the replacement #494 verified against a live server (#480). - 74_cli_error_output.py asserted against result.output, which is a dict, so the substring check tested keys and the example could never pass. Use str(result.output), as the other examples that need a string do (#481). - Point run_examples.sh at examples/agents. It globbed examples/, where no numbered examples live, so it collected nothing and always passed (#484). Because that glob matched nothing, the script's skip list had never been exercised. Add the examples that must not run unattended: seven that act on real third-party accounts, and eight that block on stdin with no canned response. --all still runs them. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
ambiorix2099
force-pushed
the
python-sdk-examples-sweep
branch
from
August 14, 2026 22:32
08bcb8e to
ad5c805
Compare
kowser-orkes
requested changes
Aug 14, 2026
Contributor
There was a problem hiding this comment.
Lets not change these on this PR
Contributor
There was a problem hiding this comment.
Lets not change these on this PR
Contributor
|
PR description is hard to read with all those colorful link and explanation. I think 3/4 bullet point is enough IMHO |
Replacing the retired model id in the previous commit left these three
failing on a different error: 400 "thinking.type.enabled" is not
supported for this model. Use "thinking.type.adaptive" and
"output_config.effort" to control thinking behavior.
All three set thinking_budget_tokens, which the SDK serializes as
{"enabled": true, "budgetTokens": N} in config_serializer.py:218 and
run_settings.py:52. No Claude 4.7+ model accepts that shape, and the SDK
exposes no way to emit the adaptive form the API asks for, so the
parameter cannot be kept on a current model. Remove it from the eight
agents that set it, and drop the docstring line in 59 that advertised
the feature.
59_coding_agent.py then completes against Conductor OSS 3.32.0 in 302s.
60 and 60a are the same deletion but were not run: both act on a real
GitHub repository. thinking_budget_tokens is still exercised by
50_thinking_config.py and kitchen_sink.py, which take their model from
settings.llm_model.
Completes #480. The SDK limitation is filed separately.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Restores pyproject.toml and poetry.lock to their state on main, per review feedback that they should not change on this PR. The fix itself still stands: the .[agents] and .[langchain] extras omit langchain-anthropic, so langgraph/43_react_agent_multi_model.py cannot run after the documented install. That lands separately as #486; this PR no longer carries it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The retired id in the docstring was replaced with claude-sonnet-5, but 50_thinking_config.py and kitchen_sink.py take their model from settings.llm_model and set thinking_budget_tokens, and 70_ce_support_agent.py sets temperature. Claude 4.7+ models reject both parameters, so following the documented export broke the one example whose subject is thinking config: 400 "thinking.type.enabled" is not supported for this model. Suggest anthropic/claude-sonnet-4-6 instead, which accepts both. 50_thinking_config.py goes from failing in 16s to passing in 17s against OSS 3.32.0 and Orkes 5.5.0. The line about the default is unchanged and still fixes #485: the code defaults to openai/gpt-4o, not to the model the docstring named. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Reverts the previous commit's removal of thinking_budget_tokens and picks
a model that accepts it instead.
These three set thinking_budget_tokens, which the SDK serializes as
{"enabled": true, "budgetTokens": N}. Claude 4.7+ models reject that
shape, and the SDK has no way to emit the adaptive form the API asks for:
reasoning_effort is set on the agent config but never reaches the
LLM_CHAT_COMPLETE task, so it is silently dropped rather than acting as a
substitute. Dropping thinking to stay on claude-sonnet-5 therefore traded
away a demonstrated feature for no gain.
claude-sonnet-4-6 accepts thinking_budget_tokens and still fixes the 404
from the retired id, which is what #480 is about. It is also registered
on more deployments: 59_coding_agent.py now passes against both Conductor
OSS 3.32.0 (302s) and Orkes 5.5.0 (301s), where under claude-sonnet-5 the
Orkes leg failed outright.
The rule this leaves: examples that set thinking_budget_tokens pin
claude-sonnet-4-6; everything else stays on claude-sonnet-5, matching
#494. 60 and 60a were not run, as both act on a real GitHub repository.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
run_examples.sh calls `timeout`, which is GNU coreutils. macOS ships neither `timeout` nor `gtimeout` unless coreutils is installed, so every example failed there with "timeout: command not found". This is not new — `timeout` is on main — but it was unreachable until the glob fix in this PR. While the script collected zero examples it always exited 0 without invoking anything, so the dependency never fired. Now that it collects 142, a default run on a Mac fails every one of them for a reason that has nothing to do with the examples. Prefer `timeout`, fall back to `gtimeout`, and run unbounded with a warning if neither exists, rather than failing everything. The banner reports which of the two applies instead of always claiming a limit. Verified both branches against Conductor OSS 3.32.0, with 74 as the example: with no timeout binary, the warning prints and 74 passes in 6s; with coreutils installed, the banner reports the 300s limit and 74 passes in 5s. The skip list is honoured either way -- `run_examples.sh 60` reports "No examples to run." rather than touching the GitHub examples. Note the script also needs bash 4+ for `declare -A`, which stock macOS bash 3.2 does not provide. That is left alone here. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
kowser-orkes
approved these changes
Aug 15, 2026
kowser-orkes
requested changes
Aug 15, 2026
kowser-orkes
left a comment
Contributor
There was a problem hiding this comment.
Please create new pr for dependency changes
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.
Five fixes, one per issue; the commits have the detail.
settings.pydocstring names a different default model than the code #485)46_crash_and_resume.pyhas no__main__guard, so resumed workers re-run the whole script #489)74_cli_error_output.pyasserts against a dict and can never pass #481)scripts/run_examples.shmatches zero files and exits successfully #484)#484 changes default behaviour: the glob now matches, so I skipped 15 examples that act on real accounts or block on stdin. --all still runs them. Actually running examples for the first time also exposed a pre-existing dependency on GNU timeout, which macOS lacks; the script now falls back to gtimeout, or runs unbounded with a warning, instead of failing every example.
Packaging change (#486) split out of this PR per review.