Beamlet.Config (Beamlet v0.1.0)

Copy Markdown View Source

The :beamlet application config.

config :beamlet,
  data_dir: "/var/lib/beamlet",
  web: [endpoint: MyAppWeb.Endpoint],
  eval: [timeout: 60_000],
  mcp: [request_timeout: 90_000],
  http: [allow: ["homeassistant.local", "192.168.1.0/24"]]

The beamlet checks every key when it starts. A bad value stops the boot with a message naming the key. A change takes a restart.

Times are in milliseconds and sizes in bytes.

Keys

  • :data_dir - The directory where the beamlet keeps everything: its databases, the code agents define and the files they keep. Required. It must be an absolute path to a directory that already exists.
  • :policies - The policies a token can have besides default, as a keyword list of name to policy. None by default. Beamlet.Policy describes how to write one.
  • :eval - Limits on the eval tool. timeout is how long one evaluation may run (30 seconds). max_heap_bytes caps the memory it may use (128 MB), and max_output the output returned to the model (32 KB). Beamlet.MCP.Eval says what happens when each is reached.
  • :define - timeout is how long one define or patch may take to compile (30 seconds).
  • :mcp - request_timeout is how long the MCP server waits for a tool to answer before replying "Server unavailable" (65 seconds). It must be longer than the eval and define timeouts, so a slow tool reports its own error first.
  • :http - allow lists the hosts on private networks that agent code may reach through Host.HTTP, as names, IP addresses or CIDR blocks. A name must be listed as a name: allowing its address or block is not enough. Empty by default, so agent code reaches only the public internet.
  • :web - endpoint names the Phoenix endpoint that forwards to Beamlet.Router. Required. prefix is a path to serve the routes agents mount under, such as "/app", and cannot be under /beamlet. Empty by default, which serves them at the root.

Summary

Functions

The agent database file, used by Host.Repo.

The beamlet's own database file, used by Beamlet.Repo.

The directory holding the modules agents define, with their git history.

The data directory, an absolute path.

The directory holding both database files.

The :define settings, with the defaults filled in.

The :eval settings, with the defaults filled in.

The directory holding the files agent code keeps through Host.File.

The :http settings, with the defaults filled in.

The :mcp settings, with the defaults filled in.

The policies declared besides default.

Checks every key, raising ArgumentError for the first at fault.

The :web settings, with the defaults filled in.

Functions

agent_db_file()

@spec agent_db_file() :: Path.t()

The agent database file, used by Host.Repo.

beamlet_db_file()

@spec beamlet_db_file() :: Path.t()

The beamlet's own database file, used by Beamlet.Repo.

code_dir()

@spec code_dir() :: Path.t()

The directory holding the modules agents define, with their git history.

data_dir()

@spec data_dir() :: Path.t()

The data directory, an absolute path.

db_dir()

@spec db_dir() :: Path.t()

The directory holding both database files.

define()

@spec define() :: keyword()

The :define settings, with the defaults filled in.

eval()

@spec eval() :: keyword()

The :eval settings, with the defaults filled in.

files_dir()

@spec files_dir() :: Path.t()

The directory holding the files agent code keeps through Host.File.

http()

@spec http() :: keyword()

The :http settings, with the defaults filled in.

mcp()

@spec mcp() :: keyword()

The :mcp settings, with the defaults filled in.

policies()

@spec policies() :: keyword()

The policies declared besides default.

validate!()

@spec validate!() :: :ok

Checks every key, raising ArgumentError for the first at fault.

Beamlet calls it before starting anything. It does not check that an endpoint is set. A full boot checks that afterwards.

web()

@spec web() :: keyword()

The :web settings, with the defaults filled in.