OpenForm
AITools

getArtifact

Last updated on

Fetch artifact JSON from a registry by name

Fetches the full artifact JSON from a registry. First fetches registry.json to find the artifact path, then fetches the artifact itself.

Parameters

ParameterTypeRequiredDescription
registryUrlstringYesRegistry base URL (e.g. https://public.open-form.dev)
artifactNamestringYesArtifact name within the registry

Response

FieldTypeDescription
artifactobjectThe full artifact JSON (form, document, bundle, or checklist)
artifactNamestringThe artifact name
errorstringError message if the fetch failed

Direct usage

import { executeGetArtifact } from "@open-form/ai-tools"

const result = await executeGetArtifact({
  registryUrl: "https://public.open-form.dev",
  artifactName: "pet-addendum",
})
// {
//   artifact: { kind: "form", name: "pet-addendum", fields: { ... }, ... },
//   artifactName: "pet-addendum"
// }

Example response

{
  "artifact": {
    "kind": "form",
    "name": "pet-addendum",
    "fields": {
      "petName": { "type": "text", "label": "Pet Name", "required": true },
      "species": { "type": "enum", "label": "Species" },
      "weight": { "type": "number", "label": "Weight (lbs)" },
      "isVaccinated": { "type": "boolean", "label": "Vaccinated" }
    }
  },
  "artifactName": "pet-addendum"
}

Error response

When the artifact is not found in the registry:

{
  "error": "Artifact \"does-not-exist\" not found in registry. Available: pet-addendum, w-9"
}

On this page