# `PtcRunner.SubAgent.Namespace`
[🔗](https://github.com/andreasronge/ptc_runner/blob/main/lib/ptc_runner/sub_agent/namespace.ex#L1)

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)

# `render`

```elixir
@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> result = PtcRunner.SubAgent.Namespace.render(%{memory: %{total: 100}, has_println: false})
    iex> result =~ "No tools available"
    true
    iex> result =~ "integer, sample: 100"
    true
    iex> result =~ "untrusted_ptc_output"
    true

---

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