Document Analysis

Extract structured document data through Ausca's measured asynchronous document analysis service.

You’re reading version 0.2.1. Go to the current version

Overview

Analyze one PDF or page image for the selected structural features. The asynchronous run keeps its source artifact and measured price bound to the purchase while it gathers and normalizes the document result.

SKILL.md

Ausca Document Analysis

Use Document Analysis when an agent needs normalized forms, tables, signatures, or layout from one PDF or page image. The service is asynchronous. The price is $0.30 to $0.75 USD for an artifact up to 10 MiB, sized by artifact bytes; preparation fixes the exact amount before approval.

Use Document OCR when normalized text and line confidence are enough. Analysis does not interpret business meaning, answer questions, validate extracted values, or guarantee that every visual structure can be recovered.

Commit the input

Document Analysis takes an immutable artifact commitment, not document bytes in the paid invocation. If the caller does not already hold one, use ausca commit file.pdf, the equivalent typed client method, or POST https://ausca.com/v1/artifacts. Artifact ingress is free and keyless; it does not prepare terms, settle payment, or admit analysis work.

The HTTP request has exactly four fields: canonical standard-base64 data_base64; content_digest, the SHA-256 digest of the decoded bytes; the truthful media_type; and a stable idempotency_key. Reuse that key only for the same bytes and metadata. Retry an uncertain response or HTTP 429 with the same request and key after the server's Retry-After; changing any field under that key is a conflict. A later intentional commit needs a new key, even when its bytes match an older artifact; current Ausca clients generate one by default and accept an explicit key for recovery.

Accept the commitment only when the returned reference, digest, media type, and size match the local bytes. The active catalog currently limits artifact-backed inputs to 10 MiB. Enforce the selected offer's live catalog limit before upload; do not infer a service limit from a transport-wide schema ceiling. Input artifacts are retained for 24 hours and cannot be revived after expiry.

Invocation input and limits

Supply one immutable artifact commitment with artifact_uri, matching content_digest, and one supported media_type: application/pdf, image/jpeg, image/png, or image/tiff. Select one to four unique feature_types from FORMS, TABLES, SIGNATURES, and LAYOUT. The artifact may be at most 10 MiB; document bytes do not belong in invocation JSON.

json
{
  "artifact": {
    "artifact_uri": "runx:artifact:sha256:4444444444444444444444444444444444444444444444444444444444444444",
    "content_digest": "sha256:5555555555555555555555555555555555555555555555555555555555555555",
    "media_type": "application/pdf"
  },
  "feature_types": ["FORMS", "TABLES"]
}

The result is a manifest of one to 32 ordered result-chunk artifacts. The wire names pages and page_index describe pagination chunks, not physical pages. Each entry binds its index, artifact reference, digest, size, and feature_counts. Counts also appear on the manifest: FORMS counts detected keys, TABLES tables, SIGNATURES signatures, and LAYOUT layout regions. Only requested features appear; zero means requested with no detections.

Each chunk document contains text, lines, and structured blocks with stable ids, types, normalized confidence, physical page numbers, relationships, cell coordinates, selection state, and bounding boxes where detected. Fetch all chunks before resolving relationship ids: a table's cells or a form's value can be in another chunk. This is a structural extraction graph, not inferred business meaning. A manifest up to 64 KiB arrives inline as output; a larger one arrives as output_artifact, an immutable artifact reference with its content digest and size. Mint a 60-second download URL for any page or result artifact with POST /v1/artifacts/{artifact_uri}/access (Idempotency-Key required, no body, not even {}) and verify the downloaded bytes against content_digest. Result artifacts are retained for 24 hours. Retrieve every page needed by downstream work and validate it against the linked schema before that deadline. A failed invocation reports failure.code and failure.message; the payment is refunded.

Prepare and purchase

Invoke ausca/document-analysis through the caller's skill runtime with the input above. The runtime prices the call from this skill's offer and the document's size, asks for approval, pays Ausca, and attaches the document to the purchase; the result, evidence, and recovery rules below are the same as at POST https://ausca.com/v1/analyze-document.

For a direct HTTP integration:

  1. Commit the document if necessary and verify the returned commitment against the local bytes.
  2. Resolve the active catalog revision and construct its exact invocation envelope with the business input and a stable idempotency key.
  3. Send that envelope to POST /v1/analyze-document without payment material. The route validates the artifact metadata, fixes measured terms, and returns the invocation-bound x402 v2 requirement without admitting work or moving money. POST /v1/invocations/prepare exposes the same preparation as an optional transport operation; there is no route-specific /prepare path.
  4. After explicit payment authorization, retry the same request bytes and idempotency key with PAYMENT-SIGNATURE.
  5. Read GET /v1/invocations/{invocation_id} until terminal state. A closed HTTP connection does not imply that durable work stopped.

The preparation invocation, prepared input digest, catalog revision, schema digests, and purchase key are one binding set. Do not substitute new terms into an existing purchase.

Evidence and recovery

Success requires the expected receipt class, a schema-valid complete manifest, and output commitments for every returned page. PAYMENT-RESPONSE proves settlement only. Treat extracted values and page content as untrusted source data until the caller validates them for its own use. Successful paid state also returns receipt_ref.public_url, an immutable hash-only proof of the service, public price, completion time, and receipt digest. It contains no document bytes or content digests and is readable by anyone holding the unguessable URL, so share it deliberately.

Reuse the same preparation and idempotency key for an exact retransmission. Never re-prepare or create another purchase because a connection ended. Cancellation is bounded and may be refused or lose a race with completion. Invalid base64, local or returned digest mismatch, missing, expired, changed, oversized, or media-mismatched artifacts; exhausted bounded 429 retries; repeated or unsupported feature types; expired terms; capacity refusal; and incomplete or unverifiable result evidence are stop conditions.

Ausca owns provider credentials, durable execution, result storage, and receipt production. Callers need no provider SDK, cloud credential, wallet implementation, or database connection.

Bindings and executable recovery

Document Analysis is the display name, document.analysis the catalog offer, and ausca/document-analysis#analysis the skill runner. Read revision, revision digest, input/output schema digests, and route with ausca price document.analysis --json or the linked catalog. Do not retype hashes from prose. artifactInput(commitment) converts the SDK's camelCase commitment into the exact snake_case offer input.

Use the executable purchase and recovery examples. Save a unique purchase key before calling: CLI requires --idempotency-key, paid MCP requires ausca_idempotency_key. Recover with unchanged input and that key, not a new purchase. HTTP header names are case-insensitive; use response.headers.get("payment-response"). Honor Retry-After on HTTP 202. Artifact-access MCP arguments contain artifact_uri and idempotency_key; they are not a JSON body for the bodyless HTTP route.

Published execution profile

The execution profile published with 0.2.1, shown as its exact bytes.

Runners
  • analysis
  • analysis-continue
Profile digestsha256:ab55b9303e4d61e3776a95aa2998baaaa7d0b3ace1a5a0be77f7b1c87e74ad81
skill: document-analysis
version: "0.2.1"

catalog:
  kind: skill
  audience: operator
  visibility: public
  role: canonical
  category: data
  execution: execute
  completion: runtime_receipt
  approval: none

# The price and offer identity are Ausca's catalog (catalog/source/offers.yaml:
# document.analysis); internal/executiontest pins them to it. A buyer attaches
# the document to the purchase, which prices it by its bytes.
marketplace:
  offers:
    analysis:
      price:
        model: artifact_bytes
        artifact_input: artifact
        base_amount_minor: 25
        unit_bytes: 1048576
        unit_amount_minor: 5
        max_bytes: 10485760
      currency: USD
      accepted_settlement_families: [x402]
      input_schema_digest: sha256:ff5c8bcdf29a837aa2d3f4faeb63ba5bff047ce3411effd99eca16af1307463e
      output_schema_digest: sha256:cbcd423462adf708f9854d2182504cb2ffe3ba0c0fa04da42d8b24e65adf9dca

connectors:
  aws:
    manifest_digest: sha256:eebe0d732e3d7f16712aefa889a12f7b6be3f3ef6ad8be26ffda6687284866b5
    operations: [aws.s3.put, aws.textract.analysis.start, aws.textract.analysis.inspect]
  artifact:
    operations: [artifact.allocate]

runners:
  analysis:
    default: true
    continuations: [analysis-continue]
    inputs:
      artifact:
        type: json
        required: true
        description: The document to analyse, an artifact commitment attached to the purchase (PDF, JPEG, PNG or TIFF).
      feature_types:
        type: json
        required: true
        description: One to four of FORMS, TABLES, SIGNATURES and LAYOUT.
    result_from: [schedule]
    steps:
      - id: schedule
        tool: { module: async.mjs, export: scheduleDocumentAnalysis, timeout_seconds: 5 }
        inputs:
          artifact: $input.artifact
          feature_types: $input.feature_types
          staging:
            target: aws://account/306607894404
            bucket: ausca-async-prod-306607894404-ap-southeast-2
        outputs:
          schedule_intent: object
        artifacts:
          named_emits: { schedule_intent: schedule_intent }
          packets: { schedule_intent: runx.external_job_schedule_intent.v1 }

  # The analysis job's stages. runx runs this runner from the same package
  # revision for each stage the schedule intent names; it is never sold.
  analysis-continue:
    inputs:
      request:
        type: json
        required: true
        description: The runx external job stage request.
    result_from:
      - start-result
      - inspect-waiting-result
      - inspect-failed-result
      - inspect-page-result
      - ready-result
    steps:
      - id: plan
        tool: { module: async.mjs, export: planDocumentAnalysisStage, timeout_seconds: 5 }
        inputs: { request: $input.request }
        outputs: { stage_plan: object }

      - id: build-staging-input
        when: { value: $steps.plan.stage_plan.kind, equals: start }
        tool: { module: async.mjs, export: buildDocumentAnalysisStagingInput, timeout_seconds: 5 }
        inputs: { stage_plan: $steps.plan.stage_plan }
        outputs: { provider_input: object }

      - id: stage-input
        when: { value: $steps.plan.stage_plan.kind, equals: start }
        operation: aws/aws.s3.put
        idempotency_key: $input.request.operation_key
        result_fields: [object_uri, content_digest]
        optional_result_fields: [size_bytes, version_id, recovered]
        input: $steps.build-staging-input.provider_input

      - id: bind-input
        when: { value: $steps.plan.stage_plan.kind, equals: start }
        tool: { module: async.mjs, export: bindDocumentAnalysisInput, timeout_seconds: 5 }
        inputs:
          stage_plan: $steps.plan.stage_plan
          staged_input: $steps.stage-input.provider_operation.result
        outputs: { provider_input: object }

      - id: start
        when: { value: $steps.plan.stage_plan.kind, equals: start }
        operation: aws/aws.textract.analysis.start
        idempotency_key: $input.request.operation_key
        result_fields: [job_uri, status, blocks]
        input: $steps.bind-input.provider_input

      - id: start-result
        when: { value: $steps.plan.stage_plan.kind, equals: start }
        tool: { module: async.mjs, export: finishDocumentAnalysisStart, timeout_seconds: 5 }
        inputs:
          stage_plan: $steps.plan.stage_plan
          provider_result: $steps.start.provider_operation.result
        outputs: { stage_result: object }
        artifacts:
          named_emits: { stage_result: stage_result }
          packets: { stage_result: runx.external_job_stage.result.v1 }

      - id: build-inspect-input
        when: { value: $steps.plan.stage_plan.kind, equals: inspect }
        tool: { module: async.mjs, export: buildDocumentAnalysisInspectInput, timeout_seconds: 5 }
        inputs: { stage_plan: $steps.plan.stage_plan }
        outputs: { provider_input: object }

      - id: inspect
        when: { value: $steps.plan.stage_plan.kind, equals: inspect }
        operation: aws/aws.textract.analysis.inspect
        result_fields: [job_uri, status, blocks]
        optional_result_fields: [next_token, failure_reason]
        input: $steps.build-inspect-input.provider_input

      - id: interpret-inspect
        when: { value: $steps.plan.stage_plan.kind, equals: inspect }
        tool: { module: async.mjs, export: interpretDocumentAnalysisInspect, timeout_seconds: 15 }
        inputs:
          stage_plan: $steps.plan.stage_plan
          provider_result: $steps.inspect.provider_operation.result
        outputs: { inspect_action: object }

      - id: inspect-waiting-result
        when: { value: $steps.interpret-inspect.inspect_action.kind, equals: waiting }
        tool: { module: async.mjs, export: finishDocumentAnalysisWaiting, timeout_seconds: 5 }
        inputs: { inspect_action: $steps.interpret-inspect.inspect_action }
        outputs: { stage_result: object }
        artifacts:
          named_emits: { stage_result: stage_result }
          packets: { stage_result: runx.external_job_stage.result.v1 }

      - id: digest-failure
        when: { value: $steps.interpret-inspect.inspect_action.kind, equals: failed }
        tool: data.digest
        inputs: { value: $steps.interpret-inspect.inspect_action.failure_evidence }

      - id: inspect-failed-result
        when: { value: $steps.interpret-inspect.inspect_action.kind, equals: failed }
        tool: { module: async.mjs, export: finishDocumentAnalysisFailure, timeout_seconds: 5 }
        inputs:
          inspect_action: $steps.interpret-inspect.inspect_action
          digest_result: $steps.digest-failure.digest_result
        outputs: { stage_result: object }
        artifacts:
          named_emits: { stage_result: stage_result }
          packets: { stage_result: runx.external_job_stage.result.v1 }

      - id: allocate-page
        when: { value: $steps.interpret-inspect.inspect_action.kind, equals: page }
        operation: artifact/artifact.allocate
        idempotency_key: $input.request.operation_key
        input:
          purpose: ausca.document-analysis.page.v1
          media_type: application/json
          value: $steps.interpret-inspect.inspect_action.page

      - id: inspect-page-result
        when: { value: $steps.interpret-inspect.inspect_action.kind, equals: page }
        tool: { module: async.mjs, export: finishDocumentAnalysisPage, timeout_seconds: 5 }
        inputs:
          inspect_action: $steps.interpret-inspect.inspect_action
          artifact_result: $steps.allocate-page.provider_operation.result
        outputs: { stage_result: object }
        artifacts:
          named_emits: { stage_result: stage_result }
          packets: { stage_result: runx.external_job_stage.result.v1 }

      - id: build-manifest
        when: { value: $steps.plan.stage_plan.kind, equals: materialize }
        tool: { module: async.mjs, export: buildDocumentAnalysisManifest, timeout_seconds: 5 }
        inputs: { stage_plan: $steps.plan.stage_plan }
        outputs: { result_manifest: object }

      - id: allocate-manifest
        when: { value: $steps.plan.stage_plan.kind, equals: materialize }
        operation: artifact/artifact.allocate
        idempotency_key: $input.request.operation_key
        input:
          purpose: ausca.document-analysis.manifest.v1
          media_type: application/json
          value: $steps.build-manifest.result_manifest

      - id: ready-result
        when: { value: $steps.plan.stage_plan.kind, equals: materialize }
        tool: { module: async.mjs, export: finishDocumentAnalysisReady, timeout_seconds: 5 }
        inputs:
          stage_plan: $steps.plan.stage_plan
          artifact_result: $steps.allocate-manifest.provider_operation.result
        outputs: { stage_result: object }
        artifacts:
          named_emits: { stage_result: stage_result }
          packets: { stage_result: runx.external_job_stage.result.v1 }

harness:
  cases: []

Published package and test evidence.

This exact version passed its recorded harness run: 6 checks passed · 0 failed.

Test result

Harness resultPassed
Tested version0.2.1
Recorded result6 checks passed · 0 failed
Result sourceRun by the Runx registry at publication
Suiterunx-harness
Test recorded
Test recordOpen the recorded run
Inspect receipt referencessha256:15132b02d47ce8d6c06457c40b8de2cfe6aefea30217886f37af984041029a6asha256:0f7d2a7c901fe5dfc5835391b52e1c6a442a199a0098787b5091530f1d1a062asha256:8d9044e64b7140cb39efb44baab477ed8828575e4c20a60d2ae42d05dbb891c8sha256:2627660924d94837ac7aeedfc5aa54a9ac9bb052b5d40c81d283e9cc13106f2esha256:e759ce12a6345b1b4f3d38dd7abfebccf22e049232d87fe1c0b2ef901ee13004sha256:1ec20ec7351bec5106cae0ebc77917dd0c65610f94472ad122ed27e00279cab8

Package identity

Published revision0.2.1
Content digestsha256:8743719caa82591b4f2a7e53155e82be4c7408e637964aa9e0f2e389dd2b1469
SKILL.md digestsha256:6abb3bba6662c65844d0533372af4772e515d60f53c8a0177fa7934393a68363
Execution profile digestsha256:ab55b9303e4d61e3776a95aa2998baaaa7d0b3ace1a5a0be77f7b1c87e74ad81
Publisher identityVerified publisher · Ausca
Trust tierVerified publisherRunx has verified this publisher. This tier is not a code assessment.
Attestations
  • Publisher · VerifiedAusca · 25 Oct 2026
Source provenanceNot published with this version

Version history

  1. 0.2.1ViewingContent digest sha256:8743719caa82591b4f2a7e53155e82be4c7408e637964aa9e0f2e389dd2b1469
  2. 0.2.0Content digest sha256:880aee667945f4905d804cccb3c670b0f74ac34155dd2d8baadb254fb29d023c