Stored conversations
Inject
Netresearch
when each message should include the session's previous turns. It provides
start and send; persisted agent lifecycle operations belong
to Persisted agent runtime.
Open and continue a session
use Netresearch\NrLlm\Domain\ValueObject\AiActorContext;
$actor = AiActorContext::fromBackendUser($backendUser);
$session = $conversations->startSession(
$actor,
'Article review',
$configuration,
);
$reply = $conversations->send(
$actor,
$session->uuid,
'Suggest a shorter introduction.',
);
Resolve $configuration through the guarded resolver shown in
Step 5: Select a database configuration. Construct the actor from authenticated server
state, never from user-supplied identity or permission fields.
Method contracts
`start
Binds the session to a configuration. Omitting it resolves and binds the
actor's usable default at creation time. Changing the installation's
default later does not switch this session. Throws
:AccessDeniedException for an unauthenticated actor or
:ConfigurationNotFoundException` when no usable default exists.
`send
Replays the stored history, sends the new message and stores the user and
assistant turns. Throws :InvalidArgumentException for an unknown
UUID and :AccessDeniedException` when the actor lacks access or the
bound configuration is no longer usable.
Knowing a session UUID grants no access. Every call checks the actor against the session owner. CLI and queue callers use an explicitly scoped service account rather than assuming user zero or inheriting a global backend user.
Conversations persist message content. Apply the session retention policy and schedule deletion as described in Data retention & purge.