pub struct BuiltGraph { /* private fields */ }Expand description
A graph that passed every build check, ready to run many times.
Cheap to clone and safe to share across tasks; in-memory checkpoints
are dropped after each run.
Implementations§
Source§impl BuiltGraph
impl BuiltGraph
Sourcepub async fn start(&self, input: impl Into<String>) -> Result<RunId, KitError>
pub async fn start(&self, input: impl Into<String>) -> Result<RunId, KitError>
Starts a graph run on input: saves the first checkpoint and
returns the run id, with no node run yet. Continue it with
resume or resume_for. Needs durable storage.
Sourcepub async fn resume_for(
&self,
run_id: RunId,
budget: Duration,
) -> Result<Progress, KitError>
pub async fn resume_for( &self, run_id: RunId, budget: Duration, ) -> Result<Progress, KitError>
Continues graph run run_id for about budget on the io clock,
saving after every step. A node in flight finishes, so leave one
model call of slack. Returns the last node’s output as text when
done, whatever the budget; a retry wait that would pass the budget
is Pending.
Sourcepub async fn stream(
&self,
input: impl Into<String>,
) -> Result<RunStream<GraphReport>, KitError>
pub async fn stream( &self, input: impl Into<String>, ) -> Result<RunStream<GraphReport>, KitError>
Starts a graph run on input and returns the stream of its events
and its agent nodes’ events, with the default buffer. Fails at the
call on a bad setup. Needs no durable storage.
Sourcepub async fn stream_with(
&self,
input: impl Into<String>,
settings: StreamSettings,
) -> Result<RunStream<GraphReport>, KitError>
pub async fn stream_with( &self, input: impl Into<String>, settings: StreamSettings, ) -> Result<RunStream<GraphReport>, KitError>
Starts a streamed graph run on input with settings. Events also
reach the graph’s own .events(..) sink. Fails with Config when
the capacity is out of range, else as stream.
Source§impl BuiltGraph
impl BuiltGraph
Sourcepub fn trace_path(&self) -> Option<&Path>
pub fn trace_path(&self) -> Option<&Path>
Returns the trace file this graph writes, one root span per run.
None when tracing is off or goes to a custom sink.
The file is created at build.
Sourcepub async fn run(&self, input: impl Into<String>) -> Result<Value, KitError>
pub async fn run(&self, input: impl Into<String>) -> Result<Value, KitError>
Runs the graph once on input and returns the last node’s output.
Fails with Failed or Paused when the run ends without one.
Transient failures are retried by the graph engine.
Sourcepub async fn run_with(
&self,
input: impl Into<String>,
) -> Result<GraphReport, KitError>
pub async fn run_with( &self, input: impl Into<String>, ) -> Result<GraphReport, KitError>
Runs the graph once on input and returns the full report.
Same failures as run.
The run id in the report works with resume.
Sourcepub async fn resume(&self, run_id: RunId) -> Result<Value, KitError>
pub async fn resume(&self, run_id: RunId) -> Result<Value, KitError>
Continues graph run run_id from its latest checkpoint and returns
the last node’s output; a finished run returns it again. Needs
durable storage and a run this same workflow started. Limits become
the stricter of the run’s and this graph’s.