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
@spec from_blueprint(AgentBlueprintProtocol.Blueprint.t()) :: {:ok, AgentBlueprintProtocol.BoundsAlgebra.BoundSet.t()} | {:error, AgentBlueprintProtocol.Error.t()}
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))
@spec from_deployment(AgentBlueprintProtocol.Deployment.t()) :: {:ok, AgentBlueprintProtocol.BoundsAlgebra.BoundSet.t()} | {:error, AgentBlueprintProtocol.Error.t()}
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))
@spec intersect(AgentBlueprintProtocol.BoundsAlgebra.Sources.t()) :: {:ok, AgentBlueprintProtocol.BoundsAlgebra.Result.t()} | {:error, AgentBlueprintProtocol.Error.t()}
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)
@spec widens?( AgentBlueprintProtocol.BoundsAlgebra.BoundSet.t(), AgentBlueprintProtocol.BoundsAlgebra.BoundSet.t() ) :: boolean()
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)