# `Jidoka.Import`
[🔗](https://github.com/agentjido/jidoka/blob/v0.9.0/lib/jidoka/import.ex#L1)

JSON/YAML import runtime for data-authored Jidoka agents.

Imports compile into the same `Jidoka.Agent.Spec` contract as the Spark DSL.
JSON/YAML cannot safely encode executable Elixir values, so action modules and
context schemas are resolved through caller-provided registries.

# `format`

```elixir
@type format() :: :json | :yaml
```

# `option`

```elixir
@type option() ::
  {:format, format()}
  | {:max_import_bytes, pos_integer()}
  | {:max_import_depth, pos_integer()}
  | {:max_import_nodes, pos_integer()}
  | {:yaml_merge_anchors, boolean()}
  | {:discover_mcp?, boolean()}
  | {:registries, registry()}
  | {:actions, registry()}
  | {:action_registry, registry()}
  | {:ash_resources, registry()}
  | {:ash_resource_registry, registry()}
  | {:controls, registry()}
  | {:control_registry, registry()}
  | {:catalogs, registry()}
  | {:catalog_registry, registry()}
  | {:context_schemas, registry()}
  | {:context_schema_registry, registry()}
  | {:result_schemas, registry()}
  | {:result_schema_registry, registry()}
```

# `registry`

```elixir
@type registry() :: keyword() | map()
```

# `import`

```elixir
@spec import(String.t(), [option()]) ::
  {:ok, Jidoka.Agent.Spec.t()} | {:error, term()}
```

Imports a JSON or YAML agent document string.

Pass `format: :json` or `format: :yaml` to force a parser. Without a format,
strings beginning with `{` or `[` are treated as JSON; all others are treated
as YAML.

# `import!`

```elixir
@spec import!(String.t(), [option()]) :: Jidoka.Agent.Spec.t()
```

Imports a JSON or YAML agent document string and raises on failure.

# `load`

```elixir
@spec load(map(), [option()]) :: {:ok, Jidoka.Agent.Spec.t()} | {:error, term()}
```

Compiles decoded import data into `Jidoka.Agent.Spec`.

# `load!`

```elixir
@spec load!(map(), [option()]) :: Jidoka.Agent.Spec.t()
```

Compiles decoded import data and raises on failure.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
