Starts the queued input of an idle session (built with .run = FALSE, or given a follow-up
with gptr_steer()) and pumps it until turns model turns have ended or the run settles. A
running session is advanced the same way; a waiting background session is left as it is
(gptr_wait() continues it, see gptr-background).
Value
s, invisibly. A run that settles in status error, blocked, budget or
max_turns signals the condition documented in peter().
Details
.run = FALSE builds a session without making its model request; gptr_step() or
gptr_wait() starts it. Supply an explicit workspace with envir = when results must
remain available outside the function that creates the session.
A session left running after its turns is not paused: its run continues, tool calls
included, during any later blocking gptr call at top level, such as another peter() call,
gptr_source(), or gptr_wait() or gptr_step() on another session. In mode "auto" such a
call can thus run the session's R code and write its files. Call gptr_wait() on the session
to finish its run first, or gptr_cancel() to stop it.
Examples
session = peter("Plan the analysis", model = gptr_fake_provider(list("Plan: ...")),
.run = FALSE)
gptr_step(session)
#> gptr: thinking
#> gptr: done · fake-1 · 1 request · 1.6k tokens · 99% context left
session$turns
#> [1] 1