---
url: >-
  https://adk.nht.io/api/@nhtio/adk/batteries/tools/_shared/functions/resolveArtifact.md
---

# Function: resolveArtifact()

```ts
function resolveArtifact(
  resolver: ArtifactResolver,
  onInvalid: (reason: string) => never,
): Promise<() => SpooledArtifactCtor>;
```

Defined in: [batteries/tools/\_shared/index.ts:103](https://github.com/NHTIO/ADK/blob/v1.20260609.1/src/batteries/tools/_shared/index.ts#L103)

Resolve an [ArtifactResolver](../type-aliases/ArtifactResolver.md) to the **sync** `() => SpooledArtifactCtor` that
`Tool.artifactConstructor` requires (the wrap-site and the construction-time validator both
invoke it synchronously, so an async resolver cannot be passed straight through).

## Parameters

| Parameter   | Type                                                      | Description                                                                                                                                                           |
| ----------- | --------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `resolver`  | [`ArtifactResolver`](../type-aliases/ArtifactResolver.md) | The artifact configuration. When `undefined`, callers should fall back to their own default (this function rejects `undefined` so the default lives with the caller). |
| `onInvalid` | (`reason`: `string`) => `never`                           | Throws a battery-scoped error; receives a human-readable reason.                                                                                                      |

## Returns

`Promise`<() => [`SpooledArtifactCtor`](../type-aliases/SpooledArtifactCtor.md)>

A sync `() => SpooledArtifactCtor` suitable for `Tool.artifactConstructor`.

## Remarks

A bare constructor is itself a function, so it is distinguished from a resolver via
`SpooledArtifact.isSpooledArtifactConstructor` (the same duck-typed guard the core validator
uses) rather than by arity. Async because a dynamic-import resolver must be awaited here.
