Skip to main content

Function

Tool identifier qrcode_generate. qrcode_generate encodes text or a URL into a PNG QR code image. For agent calls the image is saved as a conversation artifact; direct calls write it to the system temporary directory and return the path. The tool only creates QR codes; it cannot read or decode them. The tool is an async function (async def). Generation happens locally and accesses no external services. Import path: from veadk.tools.builtin_tools.qrcode_generate import qrcode_generate

Prerequisites

Environment variables:
  • MODEL_AGENT_API_KEY: API key for the agent’s reasoning model (the qrcode_generate tool itself needs no extra credentials and accesses no external services)

Usage

examples/tools/qrcode_generate/agent.py
Direct calls:

Parameters

Success returns {"filename", "format", "width", "height", "size_bytes", "mime_type", "artifact_saved", "path"}, with format always png. On failure it returns {"error": ...}.

Notes

  • QR codes use error-correction level M, which tolerates roughly 15% damage; use a dedicated QR library when stronger correction or higher-version features are required.
  • Longer content produces more modules; for a fixed print size, increase box_size accordingly so the code stays scannable.
Last modified on November 24, 2026