Coverage for src / agent_contracts / __init__.py: 100%

14 statements  

« prev     ^ index     » next       coverage.py v7.13.1, created at 2026-01-09 00:42 +0900

1"""agent_contracts - Modular node architecture for LangGraph agents. 

2 

3This package provides: 

4- NodeContract: Declarative I/O contracts for nodes 

5- ModularNode: Base class for LangGraph nodes 

6- InteractiveNode: Base class for conversational nodes 

7- NodeRegistry: Registration and routing 

8- GenericSupervisor: LLM-driven routing with rule hints 

9- GraphBuilder: Automatic LangGraph construction 

10""" 

11 

12from agent_contracts.contracts import ( 

13 NodeContract, 

14 TriggerCondition, 

15 NodeInputs, 

16 NodeOutputs, 

17) 

18from agent_contracts.node import ModularNode, InteractiveNode 

19from agent_contracts.registry import NodeRegistry, get_node_registry, reset_registry 

20from agent_contracts.supervisor import ( 

21 GenericSupervisor, 

22 SupervisorDecision, 

23) 

24from agent_contracts.routing import ( 

25 RoutingDecision, 

26 RoutingReason, 

27 MatchedRule, 

28) 

29from agent_contracts.graph_builder import GraphBuilder, build_graph_from_registry 

30from agent_contracts.state import ( 

31 BaseAgentState, 

32 BaseRequestSlice, 

33 BaseResponseSlice, 

34 BaseInternalSlice, 

35 get_slice, 

36 merge_slice_updates, 

37) 

38from agent_contracts.state_accessors import ( 

39 StateAccessor, 

40 Internal, 

41 Request, 

42 Response, 

43 reset_response, 

44 increment_turn, 

45 set_error, 

46 clear_error, 

47) 

48from agent_contracts.router import BaseActionRouter 

49from agent_contracts.visualizer import ContractVisualizer 

50from agent_contracts.validator import ContractValidator, ValidationResult 

51from agent_contracts.runtime import ( 

52 RequestContext, 

53 ExecutionResult, 

54 RuntimeHooks, 

55 DefaultHooks, 

56 SessionStore, 

57 InMemorySessionStore, 

58 AgentRuntime, 

59) 

60 

61__version__ = "0.2.0" 

62 

63__all__ = [ 

64 # Version 

65 "__version__", 

66 # Contracts 

67 "NodeContract", 

68 "TriggerCondition", 

69 "NodeInputs", 

70 "NodeOutputs", 

71 # Nodes 

72 "ModularNode", 

73 "InteractiveNode", 

74 # Registry 

75 "NodeRegistry", 

76 "get_node_registry", 

77 "reset_registry", 

78 # Supervisor 

79 "GenericSupervisor", 

80 "SupervisorDecision", 

81 # Routing (Traceable) 

82 "RoutingDecision", 

83 "RoutingReason", 

84 "MatchedRule", 

85 # Graph 

86 "GraphBuilder", 

87 "build_graph_from_registry", 

88 # State 

89 "BaseAgentState", 

90 "BaseRequestSlice", 

91 "BaseResponseSlice", 

92 "BaseInternalSlice", 

93 "get_slice", 

94 "merge_slice_updates", 

95 # State Accessors 

96 "StateAccessor", 

97 "Internal", 

98 "Request", 

99 "Response", 

100 "reset_response", 

101 "increment_turn", 

102 "set_error", 

103 "clear_error", 

104 # Router 

105 "BaseActionRouter", 

106 # Visualizer 

107 "ContractVisualizer", 

108 # Validator 

109 "ContractValidator", 

110 "ValidationResult", 

111 # Runtime 

112 "RequestContext", 

113 "ExecutionResult", 

114 "RuntimeHooks", 

115 "DefaultHooks", 

116 "SessionStore", 

117 "InMemorySessionStore", 

118 "AgentRuntime", 

119]