Skip to content

Python and TypeScript SDKs: upload Flow Definition Graphs to the Dex Server - #1602

Merged
longquanzheng merged 13 commits into
mainfrom
feat/flow-definition-upload-py-ts
Nov 11, 2026
Merged

longquanzheng merged 13 commits into
mainfrom
feat/flow-definition-upload-py-ts

Conversation

@longquanzheng

Copy link
Copy Markdown
Contributor

Summary

  • Python (sdk-python/dex): WorkerOptions.flow_definition_paths and flow_definitions (FlowDefinitionDocument(flow_type, content, generated_at)), for Worker and AsyncWorker; Client/AsyncClient.upload_flow_definitions(documents, force=False); FlowDefinitionUploadOutcome (including UNSPECIFIED for values this SDK does not know) and FlowDefinitionUploadResult.
  • TypeScript (sdk-typescript): WorkerOptions.flowDefinitionPaths and flowDefinitions (FlowDefinitionDocument {flowType, content, generatedAt}); Client.uploadFlowDefinitions(documents, force); outcome and result types. Upload logs go to stderr (console.warn).
  • Both: configuration is read at Worker construction (invalid files, mismatched flow.name, and duplicate Flow types fail fast); at start, after SyncAttributeIndexes and before task streams, only registered Flow types are uploaded, in batches of at most 256 items or 16 MiB of content; nothing to upload sends no RPC; failures (UNIMPLEMENTED logged once) are warnings. Absolute source.path values are rewritten to a working-directory-relative path or the file name, preserving all other bytes.
  • Docs: Python and TypeScript worker and client reference, change logs (1.45).

Why

Dex Web features need Flow Definition Graph JSON, which today must sit in a directory next to Dex Web. With server-side storage (#1595), Workers upload the graphs at startup and every Dex Web reads them from the Dex Server. The in-memory option serves frameworks that render graphs at runtime, such as agent session Flows whose Flow type is only known at start. Depends on #1595 (its commits appear here until it merges).

Testing

  • Integration against server-zd built from this branch: sdk-python/tests/integ/test_flow_definition_upload_runtime.py (5, including AsyncWorker) and sdk-typescript/test/integ/flow-definition-upload.integration.test.ts (4): path and in-memory upload compared via GetFlowDefinitions, registered-only filtering, source.path rewrite, duplicate-source error, a rejected document still lets the Worker run a Flow, Client CREATED / UNCHANGED / KEPT_EXISTING / forced REPLACED.
  • Unit tests for batch splitting and unknown outcomes. Python: pytest (712), mypy, pyright, pre-commit, public docs check. TypeScript: build, docs check, unit (225).
  • cd docs && npm run check, make copyright-check.

Add UploadFlowDefinitions, ListFlowDefinitions, and GetFlowDefinitions to
FlowService. server-zd keeps one FlowDefinitionRecord object per Flow type
under registry/flow-definitions/<tenant_id>/types/, created with
If-None-Match and replaced with If-Match by the replace rule.
Document the three FlowService RPCs, the replace rule and force, the
flowDefinitions.maxDefinitionBytes key, the object layout under
registry/flow-definitions/, and the 0.1.26 change log entries. Add the
key to the example configuration and the dexzd-api README. Cover Flow
types that contain percent signs, dots, and slashes in the tests.
@longquanzheng
longquanzheng merged commit b1b62e6 into main Nov 11, 2026
47 checks passed
@longquanzheng
longquanzheng deleted the feat/flow-definition-upload-py-ts branch November 11, 2026 07:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type:feature New capability or API

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant