Coverage for app / agents / __init__.py: 100%

10 statements  

« prev     ^ index     » next       coverage.py v7.13.4, created at 2026-10-31 11:23 +0000

1""" 

2Dynamic agentic execution system using LangChain & LangGraph. 

3 

4Core components 

5--------------- 

6WorkerAgent Base class — subclass this for custom agents 

7AgentRole Unified role enum (replaces the old AgentType) 

8AgentCapability Declares a named capability 

9AgentState Per-agent runtime state 

10 

11Role-specific agents (extend WorkerAgent) 

12----------------------------------------- 

13PlannerAgent Decomposes goals → ExecutionPlan 

14AnalyzerAgent Extracts insights → AnalysisResult 

15ValidatorAgent Quality-checks outputs → ValidationResult 

16ResearchAgent Gathers information → ResearchResult 

17RouterAgent Conditional routing → next node ID 

18 

19Graph layer 

20----------- 

21AgentGraphBuilder Fluent graph construction API 

22GraphState Shared state flowing through the graph 

23GraphNode Internal node descriptor 

24 

25Factory 

26------- 

27AgentFactory Creates agents and pre-built graph patterns 

28SimpleWorkerAgent Generic pass-through worker 

29 

30Quick start:: 

31 

32 from app.agents.factory import AgentFactory 

33 

34 builder = AgentFactory.create_analysis_graph() 

35 graph = builder.build() 

36 result = await graph.ainvoke(GraphState(input="Your task here")) 

37""" 

38 

39from app.agents.enums import AgentRole, AgentType 

40 

41from app.agents.base import WorkerAgent, AgentCapability, AgentState 

42 

43from app.agents.planner import PlannerAgent, ExecutionPlan, PlanStep 

44from app.agents.analyzer import AnalyzerAgent, AnalysisResult 

45from app.agents.validator import ValidatorAgent, ValidationResult 

46from app.agents.researcher import ResearchAgent, ResearchResult 

47from app.agents.router import RouterAgent, RoutingDecision 

48 

49from app.agents.graph import ( 

50 AgentGraphBuilder, 

51 GraphState, 

52 GraphNode, 

53 NodePlan, 

54 PLANNING_NODE_ID, 

55 RETRIEVAL_NODE_ID, 

56 SYNTHESIS_NODE_ID, 

57) 

58 

59from app.agents.factory import AgentFactory, SimpleWorkerAgent 

60 

61 

62__all__ = [ 

63 # Enums 

64 "AgentRole", 

65 "AgentType", 

66 # Base 

67 "WorkerAgent", 

68 "AgentCapability", 

69 "AgentState", 

70 # Role agents + result models 

71 "PlannerAgent", 

72 "ExecutionPlan", 

73 "PlanStep", 

74 "AnalyzerAgent", 

75 "AnalysisResult", 

76 "ValidatorAgent", 

77 "ValidationResult", 

78 "ResearchAgent", 

79 "ResearchResult", 

80 "RouterAgent", 

81 "RoutingDecision", 

82 # Graph 

83 "AgentGraphBuilder", 

84 "GraphState", 

85 "GraphNode", 

86 "NodePlan", 

87 "PLANNING_NODE_ID", 

88 "RETRIEVAL_NODE_ID", 

89 "SYNTHESIS_NODE_ID", 

90 # Factory 

91 "AgentFactory", 

92 "SimpleWorkerAgent", 

93]