AgentSessionManager.Core.Manifest (AgentSessionManager v0.8.0)

Copy Markdown View Source

Represents an agent manifest that defines the agent's configuration and capabilities.

The manifest is a declarative description of an agent, including its name, version, provider, and the capabilities it supports.

Fields

  • name - The agent name
  • version - The manifest version (semver)
  • description - Optional description
  • provider - The AI provider (e.g., "anthropic", "openai")
  • capabilities - List of Capability structs
  • config - Agent-specific configuration
  • metadata - Arbitrary metadata

Usage

# Create a manifest
{:ok, manifest} = Manifest.new(%{
  name: "my-agent",
  version: "1.0.0",
  provider: "anthropic",
  capabilities: [
    %{name: "web_search", type: :tool}
  ]
})

# Add a capability
{:ok, updated} = Manifest.add_capability(manifest, %{
  name: "file_read",
  type: :file_access
})

# Get enabled capabilities
enabled = Manifest.enabled_capabilities(manifest)

Summary

Functions

Adds a capability to the manifest.

Returns only enabled capabilities.

Reconstructs a manifest from a map.

Gets a capability by name.

Creates a new manifest with the given attributes.

Removes a capability by name.

Converts a manifest to a map suitable for JSON serialization.

Types

t()

@type t() :: %AgentSessionManager.Core.Manifest{
  capabilities: [AgentSessionManager.Core.Capability.t()],
  config: map(),
  description: String.t() | nil,
  metadata: map(),
  name: String.t() | nil,
  provider: String.t() | nil,
  version: String.t() | nil
}

Functions

add_capability(manifest, capability)

@spec add_capability(t(), AgentSessionManager.Core.Capability.t() | map()) ::
  {:ok, t()} | {:error, AgentSessionManager.Core.Error.t()}

Adds a capability to the manifest.

Returns an error if a capability with the same name already exists.

enabled_capabilities(manifest)

@spec enabled_capabilities(t()) :: [AgentSessionManager.Core.Capability.t()]

Returns only enabled capabilities.

from_map(map)

@spec from_map(map()) :: {:ok, t()} | {:error, AgentSessionManager.Core.Error.t()}

Reconstructs a manifest from a map.

get_capability(manifest, name)

@spec get_capability(t(), String.t()) ::
  {:ok, AgentSessionManager.Core.Capability.t()}
  | {:error, AgentSessionManager.Core.Error.t()}

Gets a capability by name.

Returns an error if the capability is not found.

new(attrs)

@spec new(map()) :: {:ok, t()} | {:error, AgentSessionManager.Core.Error.t()}

Creates a new manifest with the given attributes.

Required

  • :name - The agent name
  • :version - The manifest version

Optional

  • :description - Description of the agent
  • :provider - The AI provider
  • :capabilities - List of capabilities (as Capability structs or maps)
  • :config - Agent configuration
  • :metadata - Arbitrary metadata

Examples

iex> Manifest.new(%{name: "my-agent", version: "1.0.0"})
{:ok, %Manifest{name: "my-agent", version: "1.0.0"}}

iex> Manifest.new(%{name: ""})
{:error, %Error{code: :validation_error}}

remove_capability(manifest, name)

@spec remove_capability(t(), String.t()) ::
  {:ok, t()} | {:error, AgentSessionManager.Core.Error.t()}

Removes a capability by name.

Returns an error if the capability is not found.

to_map(manifest)

@spec to_map(t()) :: map()

Converts a manifest to a map suitable for JSON serialization.