Skip to content

Add workflow payload compression encoder#526

Open
lucasmrdt wants to merge 16 commits into
mainfrom
vibe/workflow-payload-compression-a9710d
Open

Add workflow payload compression encoder#526
lucasmrdt wants to merge 16 commits into
mainfrom
vibe/workflow-payload-compression-a9710d

Conversation

@lucasmrdt
Copy link
Copy Markdown

@lucasmrdt lucasmrdt commented May 12, 2026

Summary

  • Add workflow payload compression config and zstd compressor support to the client workflow payload encoder.
  • Carry compression decode metadata through NetworkEncodedInput/Result and EncodedPayload.
  • Add workflow-payload-compression optional extra.

Checks

  • uv run python -m pytest src/mistralai/extra/tests/test_workflow_encoding.py -q
  • uv run ruff check src/mistralai/extra/workflows/encoding/models.py src/mistralai/extra/workflows/encoding/payload_encoder.py src/mistralai/extra/tests/test_workflow_encoding.py
  • uv run ruff format --check src/mistralai/extra/workflows/encoding/models.py src/mistralai/extra/workflows/encoding/payload_encoder.py src/mistralai/extra/tests/test_workflow_encoding.py

CI note

  • This PR does not change .github/workflows/run_example_scripts.yaml.
  • Earlier run_examples failures on this PR showed MISTRAL_API_KEY: empty in the job environment, followed by httpx.LocalProtocolError: Illegal header value b'Bearer '. That points to examples running without the CI API-key secret, not to the workflow compression code.
  • Recent main run_examples runs pass with MISTRAL_API_KEY: *** present; an older main failure on 2026-05-06 had the secret present and failed later for a different example issue.

@lucasmrdt lucasmrdt closed this May 19, 2026
@lucasmrdt lucasmrdt reopened this May 19, 2026
@lucasmrdt lucasmrdt force-pushed the vibe/workflow-payload-compression-a9710d branch from 4e2aad7 to 54fb520 Compare May 19, 2026 14:37
Comment thread src/mistralai/extra/workflows/encoding/config.py Outdated
Comment thread src/mistralai/extra/workflows/encoding/payload_encoder.py
Comment thread src/mistralai/extra/workflows/encoding/payload_encoder.py Outdated
@lucasmrdt lucasmrdt force-pushed the vibe/workflow-payload-compression-a9710d branch 2 times, most recently from d202362 to d391c9f Compare May 19, 2026 15:17
@lucasmrdt lucasmrdt marked this pull request as ready for review May 19, 2026 15:48
@lucasmrdt lucasmrdt force-pushed the vibe/workflow-payload-compression-a9710d branch from d391c9f to f1d8248 Compare May 19, 2026 15:57
Comment thread src/mistralai/extra/workflows/encoding/models.py Outdated
@lucasmrdt lucasmrdt force-pushed the vibe/workflow-payload-compression-a9710d branch from f1d8248 to db1cf64 Compare May 19, 2026 16:38
return data, encoding_options
return data, encoding_options, encoding_metadata

async def encode_event_payload_content(
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is only used in tests as far as I can tell, what is this for?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch — this helper was only used by the test. I removed it and the test, and cleaned up a couple of nearby compression-only leftovers.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's about event encoding, it's not YET used but will be very soon so please don't delete that

@lucasmrdt lucasmrdt force-pushed the vibe/workflow-payload-compression-a9710d branch from db1cf64 to a466079 Compare May 19, 2026 16:42
Comment thread src/mistralai/extra/workflows/encoding/models.py Outdated
lucasmrdt and others added 9 commits May 20, 2026 18:51
* Wrap compressed workflow payloads

* Clean up workflow compression tests

* Use compressed payload helper in tests

---------

Co-authored-by: Vibe Nuage Agent <vibe@mistral.ai>
TEMPORARY: enable PayloadCompressionConfig by default in
WorkflowEncodingConfig so compression is active without env var
wiring. Revert once validated and proper WorkerConfig plumbing is in.
* Use msgpack for compressed workflow payloads

* Merge _require_msgpack with _require_zstandard pattern

- Move _require_msgpack from payload_encoder.py to payload_compressor.py
- Use import_module from importlib instead of __import__
- Return ModuleType instead of Any for consistency
- Keep compression-related imports together in one place

This consolidates the module import helpers for compression libraries
(zstandard and msgpack) in a single location for better maintainability.

* Make msgpack a core dependency

---------

Co-authored-by: Vibe Nuage Agent <vibe@mistral.ai>
Comment thread src/mistralai/extra/workflows/encoding/config.py Outdated
Comment thread src/mistralai/extra/workflows/encoding/payload_encoder.py Outdated
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.

4 participants