Skip to content

Add workflow payload compression encoder#526

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

Add workflow payload compression encoder#526
lucasmrdt wants to merge 4 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.

@lucasmrdt lucasmrdt force-pushed the vibe/workflow-payload-compression-a9710d branch from db1cf64 to a466079 Compare May 19, 2026 16:42

class CompressedPayloadData(BaseModel):
algorithm_config: AlgorithmConfig
b64data: str
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

That is adding quite a lot of bytes on your compressed data.
Keeping the config in the compressed payload is necessary as we saw in the other PR to allow any consumer to decode the payload, but we should find a better encoding mechanism than base64 which is inflating the final payload size.

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.

Agreed. I moved the compression config into encoding_metadata and now keep the compressed bytes directly as the payload, so we avoid the JSON/base64 envelope overhead while preserving config-independent decoding.

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