You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@burr.apache.org by "KiritoXDone (via GitHub)" <gi...@apache.org> on 2026/10/20 09:33:13 UTC
[PR] Add Cloudflare Python Workers deployment example with D1 persistence [burr]
KiritoXDone opened a new pull request, #988:
URL: https://github.com/apache/burr/pull/988
Add a runnable Cloudflare deployment example that executes Burr inside Python Workers and persists action checkpoints through a D1 binding. A conversation can pause before a model call and resume from D1 after a process restart or cloud redeployment.
Closes #987. Related to the deployment umbrella issue #390.
## Changes
- Add `examples/deployment/cloudflare-workers/` with a two-action chat application, an example-local `AsyncBaseStatePersister` adapter, and D1 schema. Burr core is unchanged.
- Restore pending and completed conversation state between requests. Use request IDs for completed-turn deduplication and D1 leases to serialize writes to a session.
- Require a bearer token for chat/session routes; keep provider credentials outside Burr State. The model endpoint and model name are configurable.
- Document local setup, failure recovery, cloud deployment with secrets, and the optional local network proxy.
- Add a path-filtered CI workflow that runs real workerd and local D1 against a mock model HTTP endpoint, without cloud credentials or paid model calls.
## How I tested this
- **Worker regression test:** 38 checks pass, including forced process termination and recovery, conversation history, completed-request replay, simulated provider failure/retry, concurrent duplicate submissions, input validation, and access-token handling. [Fork CI](https://github.com/KiritoXDone/burr/actions/runs/39401334175).
```bash
cd examples/deployment/cloudflare-workers
npm ci
uv run pywrangler sync
python scripts/test_worker.py
```
- **Hosted Cloudflare smoke test (2026-10-20):** 20 checks pass with a real model endpoint and remote D1. Saved a pending action, redeployed, resumed it, redeployed again, and asked the model to recall a code from the first message. The code was recalled correctly. A direct remote D1 query confirmed four completed checkpoints, sequence IDs 0–3, alternating `receive_message` and `generate_reply`, with message counts 1–4. Completed-request replay returned a cached response. This used two real model calls. Cloud testing ran at `e24bffb`; the subsequent commit only expands docstrings.
- **Existing Python suite (Python 3.12):** 704 passed, 2 skipped, using the main CI test selection:
```bash
python -m pytest tests --ignore=tests/integrations/persisters --ignore=tests/integrations/test_bip0042_bedrock.py
```
- **Example validation:** 46 passed (`python -m pytest validate_examples.py` from `examples/`).
- **Pre-commit:** all hooks pass on every file changed by this PR. The full-repository run encounters two existing Black formatting failures in `examples/image-telephone/application.py` and `examples/integrations/hamilton/image-telephone/application.py`. Those files are unchanged from `main`; the base commit's [pre-commit job also fails](https://github.com/apache/burr/actions/runs/39230340090/job/117986499793).
## Notes
- This example pins the published `apache-burr==0.43.0` package. It demonstrates the async persistence API; it does not introduce a supported core D1 integration or include the tracking server/UI.
- The shared access token permits access to all sessions. Per-user authorization and history retention are left to a production application.
- A model request and its D1 checkpoint are separate operations. A crash between them can cause a repeated provider call; the example does not promise exactly-once billing. An abandoned session lease expires after 180 seconds.
- Tooling disclosure: code, documentation, tests, and submission text were prepared with OpenAI Codex assistance. The validation results above were obtained by running the tests and deployment.
@andreahlert, could you review whether this example's scope and placement fit the deployment examples requested in #390?
## Checklist
- [x] PR has an informative and human-readable title (this will be pulled into the release notes)
- [x] Changes are limited to a single goal (no scope creep)
- [x] Code passed the pre-commit check & code is left cleaner/nicer than when first encountered. (Changed files pass; the existing full-repository failures are documented above.)
- [x] Any _change_ in functionality is tested
- [x] New functions are documented (with a description, list of inputs, and expected output)
- [x] Placeholder code is flagged / future TODOs are captured in comments
- [x] Project documentation has been updated if adding/changing functionality.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@burr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] docs(deployments): add Cloudflare Workers deployment guide [burr]
Posted by "KiritoXDone (via GitHub)" <gi...@apache.org>.
KiritoXDone closed pull request #988: docs(deployments): add Cloudflare Workers deployment guide
URL: https://github.com/apache/burr/pull/988
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@burr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org