Conversation
A one-file example of a AIChatAgent whose working directory is a Workspace backed by a Cloudflare Container. POST /prompt with a dish name and the agent finds a recipe on openstove.org with the webfetch tool, writes a markdown card through the workspace on the host, converts it with pandoc in the container, and the worker puts the resulting PDF in R2 and answers with a link to it. The point of the example is the shared filesystem: the write happens on the host and the pandoc run happens in the container, with no copying in between. The container image installs pandoc and typst rather than a LaTeX distribution, which keeps the PDF engine to a single 30 MB binary. The README contains a step-by-step guide to reproducing the application.
commit: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A one-file example of a AIChatAgent whose working directory is a Workspace backed by a Cloudflare Container. POST /prompt with a dish name and the agent finds a recipe on openstove.org with the webfetch tool, writes a markdown card through the workspace on the host, converts it with pandoc in the container, and the worker puts the resulting PDF in R2 and answers with a link to it.
The point of the example is the shared filesystem: the write happens on the host and the pandoc run happens in the container, with no copying in between. The container image installs pandoc and typst rather than a LaTeX distribution, which keeps the PDF engine to a single 30 MB binary.
The README contains a step-by-step guide to reproducing the application.