AgentBlueprintProtocol.BoundsAlgebra (Agent Blueprint Protocol v1.1.0)

Copy Markdown View Source

This module intersects Blueprint, Deployment, and host bound sets.

Use it when an application needs effective bounds and records of any narrowing.

This module does not authorize operations.

Example

base = %{
  approval_trait: :none,
  authority_trait: :none,
  classification_ceiling: %{ordinal: :internal, markers: MapSet.new([])},
  disclosure_ceiling: :summary,
  effect_impact_ceiling: :ordinary,
  max_attempts: 3,
  max_concurrency: 2,
  max_cost: %{amount: 1000, currency: "USD"},
  max_depth: 8,
  max_descendants: 64,
  max_elapsed_ms: 60_000,
  max_fan_out: 4,
  max_tokens: 100_000
}
{:ok, bounds} = AgentBlueprintProtocol.BoundsAlgebra.BoundSet.new(base)
sources = %AgentBlueprintProtocol.BoundsAlgebra.Sources{blueprint: bounds, deployment: bounds, host: bounds}
match?({:ok, %AgentBlueprintProtocol.BoundsAlgebra.Result{}}, AgentBlueprintProtocol.BoundsAlgebra.intersect(sources))

Summary

Functions

Builds a bound set from a Blueprint.

Builds a bound set from a Deployment.

Intersects the Blueprint, Deployment, and host bound sources.

Reports whether one bound set is wider than another.

Functions

from_blueprint(arg1)

(since 1.0.0)

Builds a bound set from a Blueprint.

Example

{:ok, blueprint} =
  AgentBlueprintProtocol.Blueprint.decode(
    File.read!(Application.app_dir(:agent_blueprint_protocol, "priv/examples/echo-blueprint.json"))
  )

match?({:ok, %AgentBlueprintProtocol.BoundsAlgebra.BoundSet{}}, AgentBlueprintProtocol.BoundsAlgebra.from_blueprint(blueprint))

from_deployment(arg1)

(since 1.0.0)

Builds a bound set from a Deployment.

Example

{:ok, deployment} =
  AgentBlueprintProtocol.Deployment.decode(
    File.read!(Application.app_dir(:agent_blueprint_protocol, "priv/examples/echo-deployment.json"))
  )

match?({:ok, %AgentBlueprintProtocol.BoundsAlgebra.BoundSet{}}, AgentBlueprintProtocol.BoundsAlgebra.from_deployment(deployment))

intersect(sources)

(since 1.0.0)

Intersects the Blueprint, Deployment, and host bound sources.

Example

base = %{
  approval_trait: :none,
  authority_trait: :none,
  classification_ceiling: %{ordinal: :internal, markers: MapSet.new([])},
  disclosure_ceiling: :summary,
  effect_impact_ceiling: :ordinary,
  max_attempts: 3,
  max_concurrency: 2,
  max_cost: %{amount: 1000, currency: "USD"},
  max_depth: 8,
  max_descendants: 64,
  max_elapsed_ms: 60_000,
  max_fan_out: 4,
  max_tokens: 100_000
}

{:ok, bounds} = AgentBlueprintProtocol.BoundsAlgebra.BoundSet.new(base)
sources = %AgentBlueprintProtocol.BoundsAlgebra.Sources{
  blueprint: bounds,
  deployment: bounds,
  host: bounds
}
AgentBlueprintProtocol.BoundsAlgebra.intersect(sources)

widens?(arg1, arg2)

(since 1.0.0)

Reports whether one bound set is wider than another.

Example

base = %{
  approval_trait: :none,
  authority_trait: :none,
  classification_ceiling: %{ordinal: :internal, markers: MapSet.new([])},
  disclosure_ceiling: :summary,
  effect_impact_ceiling: :ordinary,
  max_attempts: 3,
  max_concurrency: 2,
  max_cost: %{amount: 1000, currency: "USD"},
  max_depth: 8,
  max_descendants: 64,
  max_elapsed_ms: 60_000,
  max_fan_out: 4,
  max_tokens: 100_000
}

{:ok, bounds} = AgentBlueprintProtocol.BoundsAlgebra.BoundSet.new(base)
AgentBlueprintProtocol.BoundsAlgebra.widens?(bounds, bounds)