# `AgentSessionManager.Core.Manifest`
[🔗](https://github.com/nshkrdotcom/agent_session_manager/blob/v0.8.0/lib/agent_session_manager/core/manifest.ex#L1)

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)

# `t`

```elixir
@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
}
```

# `add_capability`

```elixir
@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`

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

Returns only enabled capabilities.

# `from_map`

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

Reconstructs a manifest from a map.

# `get_capability`

```elixir
@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`

```elixir
@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`

```elixir
@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`

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

Converts a manifest to a map suitable for JSON serialization.

---

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