Skip to content

[AAASM-4592] 🐛 (python-sdk-docs): Fix truncated smolagents quick-start snippet#256

Merged
Chisanan232 merged 2 commits into
masterfrom
v0.1.0/AAASM-4592/fix/smolagents_truncation
Jul 15, 2026
Merged

[AAASM-4592] 🐛 (python-sdk-docs): Fix truncated smolagents quick-start snippet#256
Chisanan232 merged 2 commits into
masterfrom
v0.1.0/AAASM-4592/fix/smolagents_truncation

Conversation

@Chisanan232

@Chisanan232 Chisanan232 commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

Description

quickstart_snippets/smolagents-tool-policy.py ended with a dangling with init_assembly(...) as ctx: and zero body lines — syntactically incomplete Python (ast.parse raised IndentationError). docs/quick-start.md's "smolagents" tab (generated from it) carried the same truncation.

Re-vendored the snippet from the upstream examples repo (examples/python/smolagents-tool-policy/src/main.py), adding the standard Agent/Gateway/Mode print block + policy-rules print block as the with body — mirroring the cutoff style AAASM-4585 (PR #253) used to fix the same defect class for the Google ADK, Pydantic AI, and Microsoft Agent Framework tabs (a complete-but-short stopping point after the standard header block, matching the AutoGen tab's precedent of stopping on a valid statement rather than vendoring the entire example). Regenerated docs/quick-start.md via scripts/generate_quickstart_tabs.py so the rendered doc picks up the fix.

No other content in either file changes.

Type of Change

  • ✨ New feature
  • 🔧 Bug fix
  • ♻️ Refactoring
  • 🍀 Performance improvement
  • 📚 Documentation update
  • 🚀 Release

Breaking Changes

  • No
  • Yes (please describe below)

Related Issues

Testing

  • Unit tests added/updated
  • Integration tests added/updated
  • Manual testing performed
  • No additional automated tests required (docs-only content fix; validated via the existing drift-check generator + ast.parse + a rendered-page check below)

Verification performed:

  • python3 -c "import ast; ast.parse(open('quickstart_snippets/smolagents-tool-policy.py').read())" passes (previously a SyntaxError/IndentationError).
  • python scripts/generate_quickstart_tabs.py --check passes (doc matches the vendored snippet — this is also what .github/workflows/quickstart-tabs-check.yml runs on this PR).
  • uv sync --group docs && uv run mkdocs build --strict passes.
  • Rendered the built site locally (mkdocs serve) and confirmed via an isolated Playwright check that the smolagents tab now shows the complete, syntax-highlighted with body (previously truncated at ) as ctx:), with §2's hand-authored "Local-mode transports" note unaffected.

Checklist

  • Code follows project style guidelines
  • Self-review completed
  • Comments added for complex logic
  • Documentation updated if needed
  • All tests passing

quickstart_snippets/smolagents-tool-policy.py ended at a dangling
`with init_assembly(...) as ctx:` with zero body lines, failing
ast.parse (IndentationError). Re-vendor the standard Agent/Gateway/Mode
+ policy-rules print block from the upstream examples repo source
(examples/python/smolagents-tool-policy/src/main.py), mirroring the
cutoff style AAASM-4585 used for the Google ADK/Pydantic AI/Microsoft
Agent Framework tabs.

Refs AAASM-4592
Rebuild the generated framework-tabs region via
scripts/generate_quickstart_tabs.py so the rendered smolagents tab
picks up the completed with-body from the previous commit.

Refs AAASM-4592
@Chisanan232

Copy link
Copy Markdown
Contributor Author

Review: AAASM-4592 — smolagents quick-start truncation fix

CI: All 5 checks passing, 0 failing.

Scope completeness:

  • python3 -c "import ast; ast.parse(...)" on quickstart_snippets/smolagents-tool-policy.py succeeds — the file is now syntactically complete.
  • Diffed the added body against upstream examples/python/smolagents-tool-policy/src/main.py — the 8 added print(...) lines inside the with init_assembly(...) as ctx: block are a verbatim match of that block in the real example (same f-strings, same policy-rules text, same blank-line spacing). Faithful excerpt, nothing invented.
  • python scripts/generate_quickstart_tabs.py --checkUp to date: quick-start.md already matches the vendored snippets. Zero drift.
  • Confirmed the diff does not touch the "Local-mode transports" note area (~line 72-79) — git diff remote/master...HEAD --stat shows exactly 2 files changed, 18 insertions total, and both hunks land at the smolagents ctx: block (docs/quick-start.md line ~608, snippet line ~15). AAASM-4623/PR#255 territory is untouched.

Regression check: Full diff of docs/quick-start.md is a single hunk of 9 added lines right after the ) as ctx: line, immediately before the pre-existing "Version compatibility" note. No other tab or content in the file changed.

Playwright validation: Built docs with uv sync --group docs && uv run mkdocs serve, navigated to Quick Start, clicked the smolagents tab. Screenshot confirms the code block now renders the complete snippet — imports, policy setup, the with init_assembly(...) as ctx: block, the Agent/Gateway/Mode print lines, and the policy-rules print block — ending cleanly on a standalone print() statement. No mid-statement truncation.

Verdict: READY — scope is complete and faithful to the ticket, no regressions, docs build and render correctly, CI green.

— Claude Code

@Chisanan232 Chisanan232 merged commit 206d89b into master Jul 15, 2026
8 checks passed
@Chisanan232 Chisanan232 deleted the v0.1.0/AAASM-4592/fix/smolagents_truncation branch July 15, 2026 02:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant