# Instruction

sealed interface Instruction

A unit of instruction provided to an LlmAgent.

Use one of the variants:

- Text for a single literal string (most common).

- Structured for a pre-built, possibly multimodal Content.

- Provider for instructions that must be resolved per turn from a ReadonlyContext.

Convenience factories on the companion object allow the call sites `Instruction("text")`, `Instruction(content)`, and `Instruction { ctx -> ... }`.

#### Inheritors

Text
Structured
Provider

## Types

Companion
Link copied to clipboard
object Companion
Provider
Link copied to clipboard
fun interface Provider : Instruction

A function that produces the instruction Content at turn time, given a ReadonlyContext.

Structured
Link copied to clipboard
value class Structured(val content: Content) : Instruction

A pre-built structured instruction, e.g. multimodal content.

Text
Link copied to clipboard
value class Text(val text: String) : Instruction

A literal text instruction. Wrapped into a single Part at runtime.