Swarmauri utility tool for generating QR codes and returning base64-encoded image bytes.
Project description
Swarmauri Tool QR Code Generator
swarmauri_tool_qrcodegenerator is a Swarmauri utility tool for generating QR
codes from text payloads and returning the resulting image bytes as a
base64-encoded string. It is useful for links, identifiers, tickets, device
pairing flows, and automation pipelines that need scannable data artifacts.
Why Use Swarmauri Tool QR Code Generator
- Turn text values into scannable QR artifacts inside Swarmauri workflows.
- Return image data inline as base64 for transport-friendly downstream use.
- Generate QR content for tickets, links, tokens, or device onboarding.
- Keep QR generation available as a standard Swarmauri tool interface.
FAQ
What input does the tool expect?
A single stringdatavalue to encode.
What does the tool return?
A dictionary with one key:image_b64.
Does the tool currently write files to disk?
No. It returns encoded image bytes in memory.
Can this be used in agent workflows?
Yes. The base64 string can be forwarded to other tools, APIs, or UI layers.
Features
- Swarmauri
ToolBaseimplementation registered asQrCodeGeneratorTool. - Generates QR codes from arbitrary text input.
- Returns base64-encoded image bytes for transport and storage.
- Useful for event, device, credential, and link-sharing workflows.
- Supports Python 3.10, 3.11, 3.12, 3.13, and 3.14.
Installation
uv add swarmauri_tool_qrcodegenerator
pip install swarmauri_tool_qrcodegenerator
Usage
from swarmauri_tool_qrcodegenerator import QrCodeGeneratorTool
tool = QrCodeGeneratorTool()
result = tool("https://docs.swarmauri.com")
print(result["image_b64"][:40])
Examples
Generate a QR code for a URL
from swarmauri_tool_qrcodegenerator import QrCodeGeneratorTool
tool = QrCodeGeneratorTool()
result = tool("https://example.com")
print(len(result["image_b64"]))
Encode an onboarding token
from swarmauri_tool_qrcodegenerator import QrCodeGeneratorTool
tool = QrCodeGeneratorTool()
token = "device:pairing:ABC123XYZ"
result = tool(token)
print(result.keys())
Register the tool in a Swarmauri collection
from swarmauri_standard.tools.ToolCollection import ToolCollection
from swarmauri_tool_qrcodegenerator import QrCodeGeneratorTool
tools = ToolCollection(tools=[QrCodeGeneratorTool()])
print(tools)
Related Packages
Swarmauri Foundations
More Documentation
Best Practices
- Keep encoded payloads short enough for compact QR generation.
- Validate how your downstream consumer expects to reconstruct the returned image bytes.
- Avoid embedding secrets directly unless the QR code lifecycle is controlled.
- Consider extending the tool if you need explicit PNG serialization options.
License
This project is licensed under the Apache-2.0 License.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file swarmauri_tool_qrcodegenerator-0.11.0.dev1.tar.gz.
File metadata
- Download URL: swarmauri_tool_qrcodegenerator-0.11.0.dev1.tar.gz
- Upload date:
- Size: 8.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
02bf31ea6879b0b8532925909a7530fdb0d88442daf4276c62cbc1b06eaddff9
|
|
| MD5 |
1d5d7532a04f7e84ff0d80a25ddb4063
|
|
| BLAKE2b-256 |
b86d35f7c8388b25627c1e6fa554eebcfde3e15947a85fde6a743682a7e2b850
|
File details
Details for the file swarmauri_tool_qrcodegenerator-0.11.0.dev1-py3-none-any.whl.
File metadata
- Download URL: swarmauri_tool_qrcodegenerator-0.11.0.dev1-py3-none-any.whl
- Upload date:
- Size: 9.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.11.26 {"installer":{"name":"uv","version":"0.11.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8ecb2b4cbbbf1da39f8230347b6c9af7f6bdde9800cb7d9e011092274e894483
|
|
| MD5 |
82c802b0fca8857957f1d998f5da5c19
|
|
| BLAKE2b-256 |
eb5745436eb3ea8e9bd23ba2934d476e459701090205aa5e794f00f2de071f40
|