@@ -174,6 +174,13 @@ class DocumentationOutput(BaseModelWithReasoning):
174174 json_schema_extra = {"voting_comparison" : {"strategy" : ComparisonStrategy .SEMANTIC , "threshold" : 0.7 }},
175175 )
176176
177+ # Required reasoning field from BaseModelWithReasoning
178+ reasoning : str = Field (
179+ default = "" ,
180+ description = "Reasoning behind the documentation assessment" ,
181+ json_schema_extra = {"voting_comparison" : {"strategy" : ComparisonStrategy .SEMANTIC , "threshold" : 0.7 }},
182+ )
183+
177184
178185class ProcessorInput (BaseModel ):
179186 """Input for documentation processing agents."""
@@ -421,55 +428,39 @@ def create_documentation_processor_workflow(
421428 config = config or DocumentationProcessorConfig ()
422429 db = SqliteDb (db_file = db_path )
423430
424- # Create agents for different perspectives
425- agents = [
426- DocumentationAgent (
427- id = "doc_architect" ,
428- model = model ,
429- db = db ,
430- perspective = "architect" ,
431- ),
432- DocumentationAgent (
433- id = "doc_developer" ,
434- model = model ,
435- db = db ,
436- perspective = "developer" ,
437- ),
438- DocumentationAgent (
439- id = "doc_reviewer" ,
440- model = model ,
441- db = db ,
442- perspective = "reviewer" ,
443- ),
444- ]
445-
446- # Create consensus manager with the response type
447- consensus_manager = ConsensusManager [DocumentationOutput ](
448- response_type = DocumentationOutput
431+ # Create a single agent for documentation processing
432+ doc_agent = DocumentationAgent (
433+ id = "doc_processor" ,
434+ model = model ,
435+ db = db ,
436+ perspective = "comprehensive" ,
449437 )
450438
451439 # Create workflow steps
452- def process_documentation (input_data : Dict [str , Any ]) -> Dict [str , Any ]:
453- """Process documentation using consensus."""
440+ def process_documentation (step_input : StepInput ) -> StepOutput :
441+ """Process documentation using the agent."""
442+ input_data = step_input .input
443+
444+ # Read the content if it's a file path
445+ content = None
446+ if isinstance (input_data , dict ):
447+ file_path = input_data .get ("path" , input_data .get ("module" ))
448+ else :
449+ file_path = str (input_data )
450+
451+ if file_path and Path (file_path ).exists ():
452+ with open (file_path , "r" , encoding = "utf-8" ) as f :
453+ content = f .read ()
454+
454455 processor_input = ProcessorInput (
455- mode = input_data .get ("mode" , config .mode ),
456- content = input_data . get ( " content" ) ,
457- target_module = input_data .get ("module" ),
458- requirements = input_data .get ("requirements" , []),
456+ mode = input_data .get ("mode" , config .mode ) if isinstance ( input_data , dict ) else config . mode ,
457+ content = content ,
458+ target_module = input_data .get ("module" ) if isinstance ( input_data , dict ) else str ( input_data ) ,
459+ requirements = input_data .get ("requirements" , []) if isinstance ( input_data , dict ) else [] ,
459460 )
460461
461- # Use agno_consensus method to create consensus with agents
462- consensus = consensus_manager .agno_consensus (
463- runner = agents [0 ], # Use first agent as base runner
464- ids = [agent .id for agent in agents ],
465- perspectives = [agent .perspective for agent in agents ],
466- weights = [1.0 ] * len (agents ),
467- runner_settings = [{"model" : model } for _ in agents ],
468- consensus_settings = config .consensus_settings .model_dump (),
469- )
470-
471- # Get consensus result
472- result = consensus .run (processor_input )
462+ # Get result from agent
463+ result = doc_agent .run_sync (processor_input )
473464
474465 # Save documentation to file
475466 if result .content :
@@ -484,19 +475,18 @@ def process_documentation(input_data: Dict[str, Any]) -> Dict[str, Any]:
484475
485476 logger .info (f"Documentation saved to { output_file } " )
486477
487- return {
488- "result" : result .model_dump (),
489- "content" : result .content ,
490- "summary" : result .summary ,
491- }
478+ return StepOutput (
479+ content = result .content ,
480+ success = True ,
481+ )
492482
493483 # Create workflow
494484 workflow = Workflow (
495485 name = "DocumentationProcessor" ,
496486 steps = [
497487 Step (
498488 name = "process" ,
499- function = process_documentation ,
489+ executor = process_documentation ,
500490 ),
501491 ],
502492 db = db ,
0 commit comments