Coverage for src/refinire/agents/__init__.py: 100%

10 statements  

« prev     ^ index     » next       coverage.py v7.9.1, created at 2025-06-16 15:27 +0900

1""" 

2Refinire Agents - Comprehensive AI agent and workflow framework 

3 

4This module provides the complete agent framework including: 

5- Workflow orchestration (Flow, Step, Context) 

6- Agent functionality (RefinireAgent, InteractiveAgent) 

7- Specialized agent implementations for specific tasks 

8 

9Components are organized into: 

10- Flow: Workflow orchestration engine and step implementations 

11- Pipeline: Agent and execution frameworks 

12- Specialized Agents: Task-specific agent implementations 

13""" 

14 

15# Import flow and pipeline functionality 

16from .flow import ( 

17 Flow, 

18 FlowExecutionError, 

19 Step, 

20 FunctionStep, 

21 ConditionStep, 

22 ParallelStep, 

23 UserInputStep, 

24 DebugStep, 

25 ForkStep, 

26 JoinStep, 

27 Context, 

28 Message, 

29 create_simple_flow, 

30 create_conditional_flow, 

31 create_simple_condition, 

32 create_lambda_step 

33) 

34 

35from .pipeline import ( 

36 RefinireAgent, 

37 LLMResult, 

38 InteractiveAgent, 

39 InteractionResult, 

40 InteractionQuestion, 

41 create_simple_agent, 

42 create_evaluated_agent, 

43 create_tool_enabled_agent, 

44 create_simple_interactive_agent, 

45 create_evaluated_interactive_agent, 

46 # Backward compatibility aliases 

47 LLMPipeline, 

48 InteractivePipeline, 

49 create_simple_llm_pipeline, 

50 create_evaluated_llm_pipeline, 

51 create_tool_enabled_llm_pipeline, 

52 create_simple_interactive_pipeline, 

53 create_evaluated_interactive_pipeline 

54) 

55 

56# Import implemented agents 

57from .gen_agent import ( 

58 GenAgent, 

59 create_simple_gen_agent, 

60 create_evaluated_gen_agent 

61) 

62 

63from .clarify_agent import ( 

64 ClarifyAgent, 

65 ClarificationResult, 

66 ClarificationQuestion, 

67 ClarifyBase, 

68 Clarify, 

69 create_simple_clarify_agent, 

70 create_evaluated_clarify_agent 

71) 

72 

73from .extractor import ( 

74 ExtractorAgent, 

75 ExtractorConfig, 

76 ExtractionRule, 

77 ExtractionResult, 

78 RegexExtractionRule, 

79 EmailExtractionRule, 

80 PhoneExtractionRule, 

81 URLExtractionRule, 

82 DateExtractionRule, 

83 HTMLExtractionRule, 

84 JSONExtractionRule, 

85 LLMExtractionRule, 

86 CustomFunctionExtractionRule, 

87 create_contact_extractor, 

88 create_html_extractor, 

89 create_json_extractor, 

90) 

91 

92from .validator import ( 

93 ValidatorAgent, 

94 ValidatorConfig, 

95 ValidationRule, 

96 ValidationResult, 

97 RequiredRule, 

98 EmailFormatRule, 

99 LengthRule, 

100 RangeRule, 

101 RegexRule, 

102 CustomFunctionRule, 

103 create_email_validator, 

104 create_required_validator, 

105 create_length_validator, 

106 create_custom_validator, 

107) 

108 

109from .router import ( 

110 RouterAgent, 

111 RouterConfig, 

112 RouteClassifier, 

113 LLMClassifier, 

114 RuleBasedClassifier, 

115 create_intent_router, 

116 create_content_type_router 

117) 

118 

119from .notification import ( 

120 NotificationAgent, 

121 NotificationConfig, 

122 NotificationChannel, 

123 NotificationResult, 

124 LogChannel, 

125 EmailChannel, 

126 WebhookChannel, 

127 SlackChannel, 

128 TeamsChannel, 

129 FileChannel, 

130 create_log_notifier, 

131 create_file_notifier, 

132 create_webhook_notifier, 

133 create_slack_notifier, 

134 create_teams_notifier, 

135 create_multi_channel_notifier, 

136) 

137 

138# Version information 

139__version__ = "0.2.2" 

140 

141# Public API 

142__all__ = [ 

143 # Workflow orchestration 

144 "Flow", 

145 "FlowExecutionError", 

146 "Step", 

147 "FunctionStep", 

148 "ConditionStep", 

149 "ParallelStep", 

150 "UserInputStep", 

151 "DebugStep", 

152 "ForkStep", 

153 "JoinStep", 

154 "Context", 

155 "Message", 

156 "create_simple_flow", 

157 "create_conditional_flow", 

158 "create_simple_condition", 

159 "create_lambda_step", 

160 

161 # Agent functionality 

162 "RefinireAgent", 

163 "LLMResult", 

164 "InteractiveAgent", 

165 "InteractionResult", 

166 "InteractionQuestion", 

167 "create_simple_agent", 

168 "create_evaluated_agent", 

169 "create_tool_enabled_agent", 

170 "create_simple_interactive_agent", 

171 "create_evaluated_interactive_agent", 

172 # Backward compatibility aliases 

173 "LLMPipeline", 

174 "InteractivePipeline", 

175 "create_simple_llm_pipeline", 

176 "create_evaluated_llm_pipeline", 

177 "create_tool_enabled_llm_pipeline", 

178 "create_simple_interactive_pipeline", 

179 "create_evaluated_interactive_pipeline", 

180 

181 # Generation Agents 

182 "GenAgent", 

183 "create_simple_gen_agent", 

184 "create_evaluated_gen_agent", 

185 

186 # Clarification Agents 

187 "ClarifyAgent", 

188 "ClarificationResult", 

189 "ClarificationQuestion", 

190 "ClarifyBase", 

191 "Clarify", 

192 "create_simple_clarify_agent", 

193 "create_evaluated_clarify_agent", 

194 

195 # Processing Agents 

196 "ExtractorAgent", 

197 "ExtractorConfig", 

198 "ExtractionRule", 

199 "ExtractionResult", 

200 "RegexExtractionRule", 

201 "EmailExtractionRule", 

202 "PhoneExtractionRule", 

203 "URLExtractionRule", 

204 "DateExtractionRule", 

205 "HTMLExtractionRule", 

206 "JSONExtractionRule", 

207 "LLMExtractionRule", 

208 "CustomFunctionExtractionRule", 

209 "create_contact_extractor", 

210 "create_html_extractor", 

211 "create_json_extractor", 

212 

213 "ValidatorAgent", 

214 "ValidatorConfig", 

215 "ValidationRule", 

216 "ValidationResult", 

217 "RequiredRule", 

218 "EmailFormatRule", 

219 "LengthRule", 

220 "RangeRule", 

221 "RegexRule", 

222 "CustomFunctionRule", 

223 "create_email_validator", 

224 "create_required_validator", 

225 "create_length_validator", 

226 "create_custom_validator", 

227 

228 # Decision Agents 

229 "RouterAgent", 

230 "RouterConfig", 

231 "RouteClassifier", 

232 "LLMClassifier", 

233 "RuleBasedClassifier", 

234 "create_intent_router", 

235 "create_content_type_router", 

236 

237 # Communication Agents 

238 "NotificationAgent", 

239 "NotificationConfig", 

240 "NotificationChannel", 

241 "NotificationResult", 

242 "LogChannel", 

243 "EmailChannel", 

244 "WebhookChannel", 

245 "SlackChannel", 

246 "TeamsChannel", 

247 "FileChannel", 

248 "create_log_notifier", 

249 "create_file_notifier", 

250 "create_webhook_notifier", 

251 "create_slack_notifier", 

252 "create_teams_notifier", 

253 "create_multi_channel_notifier", 

254]