Wraps an orchestr AgentGraph's $invoke() call with automatic tracing.
Each node execution is captured as a child span named "node:{name}".
Requires the orchestr package.
Arguments
- graph
An orchestr
AgentGraphobject.- input
Named list of initial state passed to
graph$invoke().- ...
Additional arguments passed to
graph$invoke().- exporter
Optional exporter for the trace. If
NULL, uses the default exporter (if set viaset_default_exporter()).
Examples
if (FALSE) { # \dontrun{
# Requires orchestr package
gb <- orchestr::graph_builder()
gb$add_node("step", function(state, config) list(x = state$x + 1))
gb$add_edge("step", orchestr::END)
gb$set_entry_point("step")
graph <- gb$compile()
result <- trace_graph(graph, list(x = 1))
} # }