ontocast.stategraph.unit_pipeline¶
Simplified single-unit agentic pipeline.
This module provides :func:run_unit_pipeline, a lightweight wrapper around
:func:~ontocast.stategraph.atomic.ontology_loop and
:func:~ontocast.stategraph.atomic.facts_loop that processes the entire input
as one content unit without chunking, normalization, or the full LangGraph
workflow.
The pipeline is self-contained: it accepts a raw AgentState (with
raw_input populated) and handles document conversion internally, mirroring
the CONVERT_TO_MD first-node contract of the full
:func:~ontocast.stategraph.create.create_agent_graph workflow.
The loops run sequentially:
- Conversion: raw bytes in
raw_inputare converted to text via :func:~ontocast.agent.convert_document.convert_document. - Ontology loop (if
render_modeincludes ontology): extracts / improves ontology from the input text. The initial ontology context is guided byagent_state.ontology_context_modevia the standard :func:~ontocast.stategraph.context_resolver.resolve_unit_ontology_contextcall inside the loop. - Facts loop (if
render_modeincludes facts): extracts facts from the input text. When the ontology loop ran, itscurrent_ontologyis passed as pre-resolved context so facts reuse that output instead of re-querying the catalog or triple store.
DocumentConversionError
¶
Bases: Exception
Raised by :func:run_unit_pipeline when document conversion fails.
Source code in ontocast/stategraph/unit_pipeline.py
run_unit_pipeline(agent_state, tools)
async
¶
Run conversion, ontology, and facts loops for a single content unit.
Accepts a raw AgentState with raw_input set and handles document
conversion internally as its first step, matching the contract of the full
:func:~ontocast.stategraph.create.create_agent_graph workflow.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
agent_state
|
AgentState
|
Fully configured agent state with |
required |
tools
|
ToolBox
|
Configured tool-box. |
required |
Returns:
| Type | Description |
|---|---|
UnitOntologyState | None
|
A |
UnitFactsState | None
|
when the corresponding loop was skipped based on |
Raises:
| Type | Description |
|---|---|
DocumentConversionError
|
If document conversion fails. |
Source code in ontocast/stategraph/unit_pipeline.py
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 | |