PtcRunner.SubAgent.Namespace (PtcRunner v0.9.0)

Copy Markdown View Source

Renders namespaces for the USER message (REPL with Prelude model).

Coordinates rendering of:

  • tool/ : Available tools (from agent config, stable)
  • data/ : Input data (from agent config, stable)
  • user/ : LLM definitions (prelude, grows each turn)

Summary

Functions

Render all namespaces as a single string.

Functions

render(config)

@spec render(map()) :: String.t()

Render all namespaces as a single string.

Config keys

  • tools - Map of tool name to tool struct (for tool/ namespace)
  • data - Map of input data (for data/ namespace)
  • field_descriptions - Map of field names to description strings (for data/)
  • context_signature - Parsed signature for type information (for data/)
  • memory - Map of LLM definitions (for user/ namespace)
  • has_println - Boolean, controls sample display in user/ namespace

Always includes the tools section (showing available tools or "No tools available").

Examples

iex> PtcRunner.SubAgent.Namespace.render(%{})
";; No tools available"

iex> tool = %PtcRunner.Tool{name: "search", signature: "(query :string) -> :string"}
iex> PtcRunner.SubAgent.Namespace.render(%{tools: %{"search" => tool}})
";; === tools ===\ntool/search(query string) -> string\n;; Example: (tool/search {:query ...})"

iex> PtcRunner.SubAgent.Namespace.render(%{data: %{count: 42}})
";; No tools available\n\n;; === data/ ===\ndata/count                    ; integer, sample: 42"

iex> PtcRunner.SubAgent.Namespace.render(%{memory: %{total: 100}, has_println: false})
";; No tools available\n\n;; === user/ (your prelude) ===\ntotal                         ; = integer, sample: 100"