# `A2UIAgent.Express.Prompt`
[🔗](https://github.com/a2ui-elixir/a2ui/blob/v0.1.1/umbrella/apps/a2ui_agent/lib/a2ui_agent/express/prompt.ex#L1)

The system prompt snippet of the Express format.

The snippet has three parts, separated by blank lines:

  1. `## Workflow Description:` and the grammar rules (`base_rules/2`),
     with the rules for several catalogs when there are several;
  2. the positional signatures of each catalog's components and
     functions, and the catalog's own instructions, whose JSON
     examples are rewritten as Express (`catalog_instructions/2`);
  3. `### Examples:` and each example turn as an Express block
     (`examples/1`), when there are examples.

An allowlist of message types (`:allowed_messages`) leaves out the
rules for the statements that write other messages.

# `base_rules`
*since 0.1.0* 

```elixir
@spec base_rules(A2UIAgent.Express.Catalogs.t(), [String.t()] | nil) :: String.t()
```

The grammar rules. With an allowlist, the rules for statements that
write other messages are left out and the rest renumbered. Rule 15's
`root = ...` example names a component of the catalogs: the first one
holding a single child reference, else the first one. With several
catalogs, and components or data allowed, the rules for several
catalogs follow.

# `catalog_instructions`
*since 0.1.0* 

```elixir
@spec catalog_instructions(A2UIAgent.Express.Catalogs.t(), String.t() | nil) ::
  String.t()
```

The signatures and instructions of one catalog (given by id), or of
all of them: with several catalogs, each under a `# Catalog` heading.

# `examples`
*since 0.1.0* 

```elixir
@spec examples(A2UIAgent.Express.Catalogs.t(), [[map()]] | nil) ::
  {:ok, String.t()} | {:error, A2UICore.Error.t()}
```

The example turns as Express blocks, separated by blank lines. An
example the catalogs cannot express is an error.

# `generate`
*since 0.1.0* 

```elixir
@spec generate(A2UIAgent.Express.Catalogs.t(), keyword()) ::
  {:ok, String.t()} | {:error, A2UICore.Error.t()}
```

Assembles the prompt snippet for `catalogs`. Options: `:examples` (a
list of turns, each a list of messages) and `:allowed_messages`.

# `rules`
*since 0.1.0* 

```elixir
@spec rules() :: String.t()
```

The grammar rules, exactly as the reference writes them when every
message type is allowed.

---

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