AI tools

get_artifact

Last updated on

Retrieve one artifact and its instructions from an Asterdoc registry

Retrieves one artifact from a registry. The tool reads registry.json, finds the edition and version you asked for, and fetches that file. Without an edition or a version, it uses the current edition and the latest version, as the registry states them. It refuses a file whose SHA-256 differs from the one in registry.json. By default it also returns the artifact's instructions and agentInstructions.

Input

FieldTypeRequiredDescription
registry_urlstring (URL)NoRegistry base URL. Falls back to defaultRegistryUrl in the config.
artifact_namestringYesArtifact name within the registry
editionstringNoEdition key, such as 2024-03. Omit it, or pass current, for the current edition. Only for an artifact that has editions.
versionstringNoVersion, such as 1.2.0. Omit it, or pass latest, for the latest version of the edition.
include_instructionsbooleanNoReturn the artifact's instructions. Default true.
include_agent_instructionsbooleanNoReturn the artifact's agentInstructions. Default true.

Output

FieldTypeDescription
artifactobjectThe artifact JSON (form, document, bundle, or checklist)
artifact_namestringThe requested name
editionstringKey of the edition that was read. Absent for an artifact that has no editions.
versionstringThe version that was read
releasesobjectEvery edition and version the registry lists for this artifact, in the same fields as a get_registry item
base_urlstringThe artifact's directory. Pass it as base_url in an artifact source so file-backed layers resolve.
instructionsInstructionContentThe artifact's instructions, when present and requested
agent_instructionsInstructionContentThe artifact's agent instructions, when present and requested
errorToolErrorSet when the artifact could not be fetched, for example artifact_not_found

InstructionContent has these fields:

FieldTypeDescription
kind"inline" | "file"Inline text or a file next to the artifact
mime_typestringFile MIME type (file only)
pathstringFile path relative to the artifact (file only)
contentstringThe instruction content
encoding"utf-8" | "base64"utf-8 for text, base64 for binary files

Direct usage

import { executeGetArtifact } from "@asterdoc/ai-tools"

const result = await executeGetArtifact({
  registry_url: "https://registry.acme.com",
  artifact_name: "pet-addendum",
})

Name one edition and version:

const result = await executeGetArtifact({
  registry_url: "https://forms.example.com",
  artifact_name: "w-9",
  edition: "2024-03",
  version: "1.0.0",
})

Example response

The artifact is shortened here. The real registry response also includes file-backed instructions and agent_instructions entries.

{
  "artifact": {
    "kind": "form",
    "name": "pet-addendum",
    "version": "1.0.0",
    "title": "Pet Addendum to Lease Agreement",
    "fields": { "petName": { "type": "text", "label": "Pet name", "required": true } }
  },
  "artifact_name": "pet-addendum",
  "version": "1.0.0",
  "releases": { "latest_version": "1.0.0", "versions": ["1.0.0"] },
  "base_url": "https://registry.acme.com/pet-addendum/1.0.0"
}

On this page