View Source Agens.Resource (agens v0.2.0)

Represents a resource attached to an Agens.Job.Node and made available to a Serving prior to inference.

A Resource pairs an external :uri with a human-readable :name/:description and optional inline :content. Resources are typically loaded by a Serving (see Agens.Serving.load_resource/3) and rendered into the LM prompt via Agens.Prompt.

Fields

  • :uri - The identifier or location of the resource (e.g. a URL, file path, or MCP resource URI). Required.
  • :name - A short, human-readable name for the resource. Required.
  • :description - An optional description of the resource.
  • :content - Optional inline content for the resource, typically populated after load_resource/3 resolves it.

Summary

Functions

Builds an Agens.Resource from a decoded map (e.g. the output of Jason.decode!/1).

Types

@type t() :: %Agens.Resource{
  content: String.t() | nil,
  description: String.t() | nil,
  name: String.t(),
  uri: String.t()
}

Functions

@spec from_map(map()) :: t()

Builds an Agens.Resource from a decoded map (e.g. the output of Jason.decode!/1).

String keys are expected.