Skip to content

Fix SDK usage and align examples with documented patterns - #4

Merged
Borets merged 1 commit into
mainfrom
rt/review
Mar 2, 2026
Merged

Fix SDK usage and align examples with documented patterns#4
Borets merged 1 commit into
mainfrom
rt/review

Conversation

@R4ph-t

@R4ph-t R4ph-t commented Mar 2, 2026

Copy link
Copy Markdown
Contributor

Summary

This PR fixes a runtime bug in the file-analyzer API service and aligns all examples with documented patterns.

Changes

  • Fix: file-analyzer API service uses wrong SDK client — The API service used the synchronous Render client inside async FastAPI handlers with await, which would cause a TypeError at runtime. Switched to RenderAsync and replaced the broken double-await run_task pattern with the correct start_task + await pattern per the SDK docs.

  • Fix: app.start() missing if __name__ == "__main__": guard — All six workflow services called app.start() at module level. Without it, app.start() fires on import, which breaks the Workflows.from_workflows() pattern and the render ea tasks dev CLI workflow.

  • Fix: root README incorrectly claims workflows are "Python-only" — Render Workflows support both Python and TypeScript. Updated to clarify this repo contains Python examples.

  • Fix: hello-world double() has unnecessary dict input handling — The SDK automatically maps dict inputs to function parameters (e.g., {"x": 5}x=5). The manual isinstance(x, dict) check was redundant and suggested the SDK doesn't handle this, which is misleading for a beginner example.

Files changed

File Change
file-analyzer/api-service/main.py RenderRenderAsync, run_taskstart_task + await
hello-world/main.py Remove dict handling from double(), add __main__ guard
etl-job/main.py Add __main__ guard
data-pipeline/main.py Add __main__ guard
file-processing/main.py Add __main__ guard
openai-agent/main.py Add __main__ guard
file-analyzer/workflow-service/main.py Add __main__ guard
README.md Fix "Python-only" claim

- Fix file-analyzer API service: use RenderAsync (async) instead of
  Render (sync) in async FastAPI handlers, and switch from broken
  double-await run_task to start_task + await pattern
- Add `if __name__ == "__main__":` guard to app.start() in all
  workflow services to match SDK docs and support CLI dev workflow
- Fix root README incorrectly claiming workflows are Python-only
  (TypeScript is also supported)
- Remove unnecessary dict input handling from hello-world double()
  task (the SDK handles argument mapping automatically)
@R4ph-t
R4ph-t marked this pull request as ready for review March 2, 2026 14:07
@R4ph-t
R4ph-t requested a review from Borets March 2, 2026 14:16
@Borets
Borets merged commit 3a6bce3 into main Mar 2, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants