/ examples / consolidated_params / advanced_workflow_full_features.py
advanced_workflow_full_features.py
 1  """Advanced Workflow with all consolidated params configured."""
 2  from praisonaiagents import Agent
 3  from praisonaiagents import AgentFlow, Task
 4  from praisonaiagents.workflows.workflow_configs import (
 5      WorkflowOutputConfig, WorkflowPlanningConfig, WorkflowMemoryConfig,
 6  )
 7  
 8  # Full-featured workflow with all consolidated params
 9  workflow = AgentFlow(
10      name="FullFeaturedWorkflow",
11      description="Demonstrates all agent-like consolidated params",
12      steps=[
13          Task(
14              name="researcher",
15              action="Research: {{input}}",
16              agent=Agent(instructions="You are a researcher."),
17              knowledge=["research_docs/"],  # Step-specific knowledge
18              web="duckduckgo",  # Use DuckDuckGo for this step
19          ),
20          Task(
21              name="analyzer",
22              action="Analyze the research",
23              agent=Agent(instructions="You are an analyst."),
24              reflection="thorough",  # Thorough reflection for analysis
25              guardrails="strict",  # Strict validation
26          ),
27          Task(
28              name="writer",
29              action="Write the final report",
30              agent=Agent(instructions="You are a writer."),
31              autonomy=True,  # Enable autonomy for writing
32          ),
33      ],
34      # Workflow-level consolidated params
35      output=WorkflowOutputConfig(output="verbose", stream=True),
36      planning=WorkflowPlanningConfig(enabled=True, reasoning=True),
37      memory=WorkflowMemoryConfig(backend="file"),
38      # Agent-like params
39      autonomy=True,
40      knowledge=["shared_docs/"],
41      guardrails=True,
42      web=True,
43      reflection=True,
44  )
45  
46  if __name__ == "__main__":
47      print(f"Workflow: {workflow.name}")
48      print(f"Output verbose: {workflow._verbose}")
49      print(f"Planning enabled: {workflow._planning_enabled}")
50      print(f"Memory config: {workflow._memory_config}")
51      print(f"Autonomy: {workflow.autonomy}")
52      print(f"Knowledge: {workflow.knowledge}")
53      print(f"Guardrails: {workflow.guardrails}")
54      print(f"Web: {workflow.web}")
55      print(f"Reflection: {workflow.reflection}")