# `AgentBlueprintProtocol.Negotiation`
[🔗](https://github.com/baselabs/agent_blueprint_protocol/blob/v1.1.0/lib/agent_blueprint_protocol/negotiation.ex#L1)

This module checks an artifact against a consumer support posture.

Use it when checking revision, required core fields, and registered extensions.

This module does not authorize operations.

## Example

```elixir
{:ok, blueprint} =
  AgentBlueprintProtocol.Blueprint.decode(
    File.read!(Application.app_dir(:agent_blueprint_protocol, "priv/examples/echo-blueprint.json"))
  )
support = %AgentBlueprintProtocol.Negotiation.Support{revisions: MapSet.new([1]), core_fields: MapSet.new([])}
match?(
  {:ok, %AgentBlueprintProtocol.Negotiation.Outcome{}},
  AgentBlueprintProtocol.Negotiation.negotiate(blueprint, support)
)
```

# `negotiate`
*since 1.0.0* 

```elixir
@spec negotiate(
  AgentBlueprintProtocol.Blueprint.t()
  | AgentBlueprintProtocol.Deployment.t()
  | AgentBlueprintProtocol.Json.value(),
  AgentBlueprintProtocol.Negotiation.Support.t()
) ::
  {:ok, AgentBlueprintProtocol.Negotiation.Outcome.t()}
  | {:error, AgentBlueprintProtocol.Error.t()}
```

Checks an artifact against a consumer support posture.

## Example
    iex> with {:ok, blueprint} <- AgentBlueprintProtocol.Blueprint.decode(File.read!(Application.app_dir(:agent_blueprint_protocol, "priv/examples/echo-blueprint.json"))), support = %AgentBlueprintProtocol.Negotiation.Support{revisions: MapSet.new([1]), core_fields: MapSet.new([])}, do: match?({:ok, %AgentBlueprintProtocol.Negotiation.Outcome{}}, AgentBlueprintProtocol.Negotiation.negotiate(blueprint, support))
    true

---

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