API reference¶
Graph¶
- class biocomposer.Graph¶
A pipeline: a set of nodes and the directed edges between them. Building a graph only describes the pipeline; nothing runs until
execute()is called.- add_input_node(**values)¶
Add an input node holding the values you supply, as keyword arguments (file paths and scalar parameters). Keys must match the input names declared by the downstream tool. Returns an
InputNode.
- add_node(tool_name, gpu=None, args_override=None, entrypoint_override=None)¶
Add a tool node for a tool from the registry. Returns a
Node.
- add_gather_node(tool_name, split_key, gpu=None, args_override=None, entrypoint_override=None)¶
Add a gather node, which runs a one-item-per-run tool once for each item of an upstream collection and gathers the outputs into lists. Returns a
GatherNode.- Parameters:
split_key (str) – name of the upstream output that holds the collection.
The remaining parameters are the same as for
add_node().
- add_decision_node(score_fn, conditions, modifier_tool)¶
Add a decision node, which re-runs its upstream tool until a scored condition holds. Returns a
DecisionNode.- Parameters:
score_fn – a Python function or the name of a registry tool that produces a numeric score from the upstream output.
conditions (list) – a list of
Condition; all must hold to stop.modifier_tool – a Python function or the name of a registry tool that produces the upstream’s adjusted inputs for the next iteration.
- add_edge(*edges)¶
Wire nodes together. Each edge is a
(upstream, downstream)tuple; several may be passed in one call. Either endpoint may be a node or aSubGraph.
- set_output_node(node)¶
Mark
nodeas an output of the graph. May be called more than once to declare several outputs. See Output nodes.
- execute()¶
Run the graph and return a list with one result per output node, in the order the output nodes were set. See Execution.
- set_llm(provider, model, api_key)¶
Choose the LLM provider and model used to generate connectors.
provideris one of"anthropic","openai"or"google". See Running a pipeline.
Nodes¶
Nodes are created through the Graph.add_* methods above rather than directly.
- class biocomposer.Node¶
A tool node. See Tool nodes.
- class biocomposer.InputNode¶
An input node. See Input nodes.
- set_input(**values)¶
Set or replace the values held by this input node.
- class biocomposer.GatherNode¶
A gather node. See Gather nodes.
- class biocomposer.DecisionNode¶
A decision node. See Decision nodes.
- class biocomposer.OutputNode¶
See Output nodes.
SubGraph¶
- class biocomposer.SubGraph¶
A pipeline with exactly one input node and one output node that behaves as a single node in an outer graph. It is built with the same
add_input_node,add_node,add_edgeandset_output_nodemethods as aGraph. See Subgraphs.- run(inputs)¶
Execute the subgraph directly with a dict of fresh input values.