API Reference — Drivers¶
Drivers generate prompts for agent interaction. They decide what to send; the execution strategy handles the session, evaluation, and result.
drivers
¶
Driver implementations.
StaticDriver
¶
Sends a fixed sequence of prompts.
Derives its position from the history length — no mutable state. Safe to reuse across tests.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
prompts
|
list[str] | list[Request]
|
The prompts to send in order. Strings are wrapped in Request objects automatically. |
required |
Initialize with a list of prompts or Request objects.
Source code in rampart/drivers/static.py
next_prompt_async
async
¶
Return the next prompt in sequence, or None when exhausted.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
history
|
list[Turn]
|
All turns so far (empty on first call). |
required |
Returns:
| Type | Description |
|---|---|
PromptDecision | None
|
PromptDecision | None: The next decision, or None when all prompts have been sent. |
Source code in rampart/drivers/static.py
LLMDriver
¶
LLM-backed prompt driver.
Wraps a PyRIT PromptChatTarget to generate the next user prompt on each turn. The LLM responds with plain text — its response is the next prompt to send to the target agent.
The driver maintains two related conversations:
-
The driver-side conversation with the driving LLM, stored in PyRIT's CentralMemory keyed by
self._conversation_id. -
The agent-side conversation with the agent under test, represented by
history: list[Turn]passed intonext_prompt_async.
Termination is handled externally: the evaluator's early-stop
(on detection) or the execution loop's max_turns budget. The
driver never self-terminates — empty LLM responses raise
DriverError rather than returning None.
One driver instance = one driver-side conversation. Construct a
new driver per test. Use from_target for custom targets.
Initialize with LLM config or pre-configured target.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
persona
|
Persona
|
System-prompt identity for the LLM. |
required |
llm
|
LLMConfig | None
|
LLM configuration. Required unless |
None
|
target
|
PromptChatTarget | None
|
Pre-configured PromptChatTarget. Mutually exclusive
with |
None
|
objective
|
str | None
|
Per-test goal as a natural-language string. |
None
|
injections
|
list[Payload] | None
|
Payloads placed in the agent's data sources. |
None
|
Raises:
| Type | Description |
|---|---|
TypeError
|
If both or neither of |
Source code in rampart/drivers/llm.py
from_target
classmethod
¶
Construct an LLMDriver from a pre-configured PromptChatTarget.
Use this when you need a target type not covered by
create_prompt_target (custom subclass, non-OpenAI provider,
test double). The system prompt is still assembled from
persona/objective/injections and set on the given target at
first use, so do not call set_system_prompt on the target
yourself before passing it in.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
target
|
PromptChatTarget
|
A pre-configured PromptChatTarget. CentralMemory
must be initialized before the driver's first
|
required |
persona
|
Persona
|
System-prompt identity. |
required |
objective
|
str | None
|
Optional per-test goal. |
None
|
injections
|
list[Payload] | None
|
Optional injection metadata for the system prompt. |
None
|
Source code in rampart/drivers/llm.py
next_prompt_async
async
¶
Generate the next prompt decision based on conversation history.
Sends the latest agent-side turn data to the driving LLM and returns its plain-text response as the next prompt.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
history
|
list[Turn]
|
All agent-side turns so far (empty on first call). |
required |
Returns:
| Type | Description |
|---|---|
PromptDecision | None
|
The next prompt decision. |
Raises:
| Type | Description |
|---|---|
DriverError
|
If the LLM call fails or returns an empty response. |