codecraftai-agent-kit 1.3.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (230) hide show
  1. ccai/agentkit/__init__.py +304 -0
  2. ccai/agentkit/addressresolver.py +177 -0
  3. ccai/agentkit/agent.py +2945 -0
  4. ccai/agentkit/agentaddress.py +187 -0
  5. ccai/agentkit/agentconfiguration.py +581 -0
  6. ccai/agentkit/agentidentity.py +152 -0
  7. ccai/agentkit/agentregistry.py +221 -0
  8. ccai/agentkit/agentstatemachine.py +134 -0
  9. ccai/agentkit/alternateproviderstrategy.py +36 -0
  10. ccai/agentkit/approvalgate.py +238 -0
  11. ccai/agentkit/approvalrequest.py +250 -0
  12. ccai/agentkit/asyncagent.py +187 -0
  13. ccai/agentkit/breakpoint.py +150 -0
  14. ccai/agentkit/builtinagentmetrics.py +114 -0
  15. ccai/agentkit/builtins/__init__.py +11 -0
  16. ccai/agentkit/builtins/filereadtool.py +90 -0
  17. ccai/agentkit/builtins/filewritetool.py +93 -0
  18. ccai/agentkit/builtins/httprequesttool.py +169 -0
  19. ccai/agentkit/builtins/shellcommandtool.py +190 -0
  20. ccai/agentkit/cachedresultstrategy.py +43 -0
  21. ccai/agentkit/checkpointmanager.py +219 -0
  22. ccai/agentkit/circuitbreaker.py +230 -0
  23. ccai/agentkit/circuitbreakerconfiguration.py +158 -0
  24. ccai/agentkit/circuitbreakerevent.py +158 -0
  25. ccai/agentkit/circuitbreakerhealthcheck.py +32 -0
  26. ccai/agentkit/circuitbreakerregistry.py +116 -0
  27. ccai/agentkit/circuitbreakerstate.py +44 -0
  28. ccai/agentkit/clearcacheaction.py +46 -0
  29. ccai/agentkit/concurrencybridge.py +143 -0
  30. ccai/agentkit/concurrencymodel.py +19 -0
  31. ccai/agentkit/conditionevaluator.py +594 -0
  32. ccai/agentkit/configurationchangeevent.py +179 -0
  33. ccai/agentkit/configurationerrors.py +152 -0
  34. ccai/agentkit/configurationlayer.py +160 -0
  35. ccai/agentkit/configurationlayersource.py +46 -0
  36. ccai/agentkit/configurationmanager.py +680 -0
  37. ccai/agentkit/configurationschema.py +224 -0
  38. ccai/agentkit/configurationschemafield.py +217 -0
  39. ccai/agentkit/configurationserializer.py +163 -0
  40. ccai/agentkit/configurationvalidationresult.py +118 -0
  41. ccai/agentkit/contextsummarizer.py +170 -0
  42. ccai/agentkit/contextwindow.py +264 -0
  43. ccai/agentkit/contextwindowstrategy.py +57 -0
  44. ccai/agentkit/correlationcontext.py +156 -0
  45. ccai/agentkit/costestimate.py +139 -0
  46. ccai/agentkit/costtracker.py +121 -0
  47. ccai/agentkit/deadletterentry.py +134 -0
  48. ccai/agentkit/deadletterquery.py +119 -0
  49. ccai/agentkit/deadletterqueue.py +123 -0
  50. ccai/agentkit/deadletterstore.py +86 -0
  51. ccai/agentkit/debuginspector.py +211 -0
  52. ccai/agentkit/debugsession.py +223 -0
  53. ccai/agentkit/defaultvaluestrategy.py +43 -0
  54. ccai/agentkit/degradationchangeevent.py +120 -0
  55. ccai/agentkit/degradationlevel.py +44 -0
  56. ccai/agentkit/degradationmanager.py +212 -0
  57. ccai/agentkit/degradationpolicy.py +130 -0
  58. ccai/agentkit/degradationstrategy.py +66 -0
  59. ccai/agentkit/embeddingprovider.py +106 -0
  60. ccai/agentkit/errors.py +95 -0
  61. ccai/agentkit/executionrecord.py +213 -0
  62. ccai/agentkit/executionrecorder.py +180 -0
  63. ccai/agentkit/executionrecording.py +230 -0
  64. ccai/agentkit/executionreplayer.py +187 -0
  65. ccai/agentkit/expirationpolicy.py +116 -0
  66. ccai/agentkit/fallbackchain.py +82 -0
  67. ccai/agentkit/featureflag.py +154 -0
  68. ccai/agentkit/featureflagevaluator.py +109 -0
  69. ccai/agentkit/featureflagregistry.py +258 -0
  70. ccai/agentkit/filedeadletterstore.py +112 -0
  71. ccai/agentkit/filememorystore.py +291 -0
  72. ccai/agentkit/healthcheck.py +46 -0
  73. ccai/agentkit/healthcheckregistry.py +51 -0
  74. ccai/agentkit/healthmonitor.py +258 -0
  75. ccai/agentkit/healthstatus.py +105 -0
  76. ccai/agentkit/hotreloadmonitor.py +214 -0
  77. ccai/agentkit/hotreloadpolicy.py +160 -0
  78. ccai/agentkit/inmemorydeadletterstore.py +61 -0
  79. ccai/agentkit/inmemorystore.py +173 -0
  80. ccai/agentkit/jsonmessageserializer.py +89 -0
  81. ccai/agentkit/jsonoutputparser.py +50 -0
  82. ccai/agentkit/lifecyclestate.py +22 -0
  83. ccai/agentkit/llmconversation.py +153 -0
  84. ccai/agentkit/llmerrors.py +193 -0
  85. ccai/agentkit/llmmessage.py +158 -0
  86. ccai/agentkit/llmprovider.py +158 -0
  87. ccai/agentkit/llmproviderregistry.py +200 -0
  88. ccai/agentkit/llmresponse.py +190 -0
  89. ccai/agentkit/llmstreamchunk.py +65 -0
  90. ccai/agentkit/llmstreamhandler.py +48 -0
  91. ccai/agentkit/llmtoolbridge.py +154 -0
  92. ccai/agentkit/logexporter.py +316 -0
  93. ccai/agentkit/logformatter.py +169 -0
  94. ccai/agentkit/memoryconfiguration.py +243 -0
  95. ccai/agentkit/memoryentry.py +254 -0
  96. ccai/agentkit/memoryerrors.py +135 -0
  97. ccai/agentkit/memoryindex.py +213 -0
  98. ccai/agentkit/memoryquery.py +248 -0
  99. ccai/agentkit/memoryqueryresult.py +86 -0
  100. ccai/agentkit/memoryscope.py +54 -0
  101. ccai/agentkit/memorystore.py +260 -0
  102. ccai/agentkit/memorystorehealthcheck.py +33 -0
  103. ccai/agentkit/memorystoreregistry.py +106 -0
  104. ccai/agentkit/message.py +310 -0
  105. ccai/agentkit/messageenvelope.py +144 -0
  106. ccai/agentkit/messagepattern.py +50 -0
  107. ccai/agentkit/messagerouter.py +290 -0
  108. ccai/agentkit/messageserializer.py +106 -0
  109. ccai/agentkit/messageserializerregistry.py +163 -0
  110. ccai/agentkit/messagingconfiguration.py +397 -0
  111. ccai/agentkit/messagingerrors.py +338 -0
  112. ccai/agentkit/metricdefinition.py +164 -0
  113. ccai/agentkit/metricmeasurement.py +178 -0
  114. ccai/agentkit/metricscollector.py +258 -0
  115. ccai/agentkit/metricsexporter.py +303 -0
  116. ccai/agentkit/metricsregistry.py +130 -0
  117. ccai/agentkit/metricssnapshot.py +155 -0
  118. ccai/agentkit/metrictype.py +51 -0
  119. ccai/agentkit/msgpackmessageserializer.py +97 -0
  120. ccai/agentkit/observabilityconfiguration.py +546 -0
  121. ccai/agentkit/observabilityerror.py +67 -0
  122. ccai/agentkit/observabilitypipeline.py +252 -0
  123. ccai/agentkit/outputparser.py +82 -0
  124. ccai/agentkit/outputschema.py +142 -0
  125. ccai/agentkit/parallelbranch.py +87 -0
  126. ccai/agentkit/platform/__init__.py +43 -0
  127. ccai/agentkit/platform/adapters/__init__.py +18 -0
  128. ccai/agentkit/platform/adapters/awsplatformadapter.py +1272 -0
  129. ccai/agentkit/platform/adapters/azureplatformadapter.py +1227 -0
  130. ccai/agentkit/platform/adapters/gcpplatformadapter.py +1257 -0
  131. ccai/agentkit/platform/adapters/localplatformadapter.py +956 -0
  132. ccai/agentkit/platform/adapters/platformadapter.py +139 -0
  133. ccai/agentkit/platform/deployment/__init__.py +15 -0
  134. ccai/agentkit/platform/deployment/deploymentdescriptor.py +234 -0
  135. ccai/agentkit/platform/deployment/deploymentdescriptorparser.py +178 -0
  136. ccai/agentkit/platform/deployment/deploymentdescriptorprinter.py +97 -0
  137. ccai/agentkit/platform/errors.py +224 -0
  138. ccai/agentkit/platform/platformconfiguration.py +412 -0
  139. ccai/agentkit/platform/platformdetector.py +125 -0
  140. ccai/agentkit/platform/platformruntime.py +331 -0
  141. ccai/agentkit/platform/platformserviceregistry.py +149 -0
  142. ccai/agentkit/platform/platformtype.py +60 -0
  143. ccai/agentkit/platform/services/__init__.py +19 -0
  144. ccai/agentkit/platform/services/computeservice.py +112 -0
  145. ccai/agentkit/platform/services/invocationresult.py +173 -0
  146. ccai/agentkit/platform/services/messagingservice.py +135 -0
  147. ccai/agentkit/platform/services/platformservice.py +111 -0
  148. ccai/agentkit/platform/services/queuemessage.py +193 -0
  149. ccai/agentkit/platform/services/storageobject.py +195 -0
  150. ccai/agentkit/platform/services/storageservice.py +159 -0
  151. ccai/agentkit/pluginconfiguration.py +241 -0
  152. ccai/agentkit/plugindependency.py +129 -0
  153. ccai/agentkit/plugindescriptor.py +225 -0
  154. ccai/agentkit/pluginlifecyclehook.py +41 -0
  155. ccai/agentkit/pluginmanager.py +360 -0
  156. ccai/agentkit/pluginstatus.py +47 -0
  157. ccai/agentkit/pooledagent.py +116 -0
  158. ccai/agentkit/prompttemplate.py +221 -0
  159. ccai/agentkit/prompttemplateregistry.py +145 -0
  160. ccai/agentkit/protobufmessageserializer.py +144 -0
  161. ccai/agentkit/pubsubbroker.py +311 -0
  162. ccai/agentkit/py.typed +0 -0
  163. ccai/agentkit/reconnecttransportaction.py +47 -0
  164. ccai/agentkit/regexoutputparser.py +68 -0
  165. ccai/agentkit/requestresponsehandler.py +274 -0
  166. ccai/agentkit/resetcircuitbreakeraction.py +48 -0
  167. ccai/agentkit/resilienceconfiguration.py +191 -0
  168. ccai/agentkit/resilienceerrors.py +103 -0
  169. ccai/agentkit/resiliencepipeline.py +201 -0
  170. ccai/agentkit/retryattempt.py +158 -0
  171. ccai/agentkit/retryexecutor.py +157 -0
  172. ccai/agentkit/retrypolicy.py +195 -0
  173. ccai/agentkit/retryresult.py +186 -0
  174. ccai/agentkit/selfhealingaction.py +42 -0
  175. ccai/agentkit/selfhealingpolicy.py +67 -0
  176. ccai/agentkit/selfhealingresult.py +130 -0
  177. ccai/agentkit/stepexecutionstatus.py +52 -0
  178. ccai/agentkit/stepresult.py +198 -0
  179. ccai/agentkit/steps/__init__.py +9 -0
  180. ccai/agentkit/steps/agentstep.py +247 -0
  181. ccai/agentkit/steps/approvalstep.py +276 -0
  182. ccai/agentkit/steps/llmstep.py +403 -0
  183. ccai/agentkit/steps/subworkflowstep.py +270 -0
  184. ccai/agentkit/steps/toolstep.py +265 -0
  185. ccai/agentkit/structuredlogentry.py +222 -0
  186. ccai/agentkit/structuredlogger.py +189 -0
  187. ccai/agentkit/subscription.py +141 -0
  188. ccai/agentkit/threadedagent.py +94 -0
  189. ccai/agentkit/tokenusage.py +136 -0
  190. ccai/agentkit/tool.py +203 -0
  191. ccai/agentkit/toolchain.py +268 -0
  192. ccai/agentkit/toolchainexecutor.py +134 -0
  193. ccai/agentkit/toolchainresult.py +166 -0
  194. ccai/agentkit/tooldescriptor.py +203 -0
  195. ccai/agentkit/toolerrors.py +160 -0
  196. ccai/agentkit/toolexecutor.py +168 -0
  197. ccai/agentkit/toolfactory.py +60 -0
  198. ccai/agentkit/toolregistry.py +184 -0
  199. ccai/agentkit/toolresult.py +142 -0
  200. ccai/agentkit/toolschema.py +197 -0
  201. ccai/agentkit/tracecontext.py +294 -0
  202. ccai/agentkit/traceevent.py +166 -0
  203. ccai/agentkit/traceexporter.py +305 -0
  204. ccai/agentkit/tracer.py +234 -0
  205. ccai/agentkit/tracespan.py +349 -0
  206. ccai/agentkit/transitionrecord.py +84 -0
  207. ccai/agentkit/transport.py +334 -0
  208. ccai/agentkit/transportconfiguration.py +436 -0
  209. ccai/agentkit/transporthealthcheck.py +36 -0
  210. ccai/agentkit/transportregistry.py +224 -0
  211. ccai/agentkit/transports/__init__.py +28 -0
  212. ccai/agentkit/transports/grpctransport.py +410 -0
  213. ccai/agentkit/transports/httptransport.py +423 -0
  214. ccai/agentkit/transports/messagequeuetransport.py +489 -0
  215. ccai/agentkit/transports/websockettransport.py +473 -0
  216. ccai/agentkit/workflowcheckpoint.py +208 -0
  217. ccai/agentkit/workflowconfiguration.py +295 -0
  218. ccai/agentkit/workflowcontext.py +249 -0
  219. ccai/agentkit/workflowdefinition.py +790 -0
  220. ccai/agentkit/workflowedge.py +128 -0
  221. ccai/agentkit/workflowerrors.py +295 -0
  222. ccai/agentkit/workflowexecutionstatus.py +48 -0
  223. ccai/agentkit/workflowexecutor.py +1121 -0
  224. ccai/agentkit/workflowregistry.py +185 -0
  225. ccai/agentkit/workflowresult.py +250 -0
  226. ccai/agentkit/workflowstep.py +195 -0
  227. codecraftai_agent_kit-1.3.0.dist-info/METADATA +99 -0
  228. codecraftai_agent_kit-1.3.0.dist-info/RECORD +230 -0
  229. codecraftai_agent_kit-1.3.0.dist-info/WHEEL +4 -0
  230. codecraftai_agent_kit-1.3.0.dist-info/licenses/LICENSE.md +204 -0
@@ -0,0 +1,304 @@
1
+ """
2
+ ccai.agentkit - Core agent framework for the codecraftai-agent-kit SDK.
3
+
4
+ Provides the foundational abstractions for building, configuring, and
5
+ managing agents including lifecycle management, identity, configuration,
6
+ state machine, registry, hooks, sub-agent composition, concurrency
7
+ model support, configuration management, feature flags, plugin system,
8
+ and tool capability system.
9
+ """
10
+
11
+ from ccai.agentkit.agent import Agent
12
+ from ccai.agentkit.agentconfiguration import AgentConfiguration
13
+ from ccai.agentkit.agentidentity import AgentIdentity
14
+ from ccai.agentkit.agentregistry import AgentRegistry
15
+ from ccai.agentkit.agentstatemachine import AgentStateMachine
16
+ from ccai.agentkit.asyncagent import AsyncAgent
17
+ from ccai.agentkit.builtins.filereadtool import FileReadTool
18
+ from ccai.agentkit.builtins.filewritetool import FileWriteTool
19
+ from ccai.agentkit.builtins.httprequesttool import HttpRequestTool
20
+ from ccai.agentkit.builtins.shellcommandtool import ShellCommandTool
21
+ from ccai.agentkit.concurrencybridge import ConcurrencyBridge
22
+ from ccai.agentkit.concurrencymodel import ConcurrencyModel
23
+ from ccai.agentkit.costestimate import CostEstimate
24
+ from ccai.agentkit.costtracker import CostTracker
25
+ from ccai.agentkit.configurationchangeevent import ConfigurationChangeEvent
26
+ from ccai.agentkit.configurationerrors import ConfigurationValidationError
27
+ from ccai.agentkit.configurationerrors import PluginLoadError
28
+ from ccai.agentkit.configurationlayer import ConfigurationLayer
29
+ from ccai.agentkit.configurationlayersource import ConfigurationLayerSource
30
+ from ccai.agentkit.configurationmanager import ConfigurationManager
31
+ from ccai.agentkit.configurationschema import ConfigurationSchema
32
+ from ccai.agentkit.configurationschemafield import ConfigurationSchemaField
33
+ from ccai.agentkit.configurationserializer import ConfigurationSerializer
34
+ from ccai.agentkit.configurationvalidationresult import ConfigurationValidationResult
35
+ from ccai.agentkit.contextsummarizer import ContextSummarizer
36
+ from ccai.agentkit.contextwindow import ContextWindow
37
+ from ccai.agentkit.contextwindowstrategy import ContextWindowStrategy
38
+ from ccai.agentkit.expirationpolicy import ExpirationPolicy
39
+ from ccai.agentkit.fallbackchain import FallbackChain
40
+ from ccai.agentkit.errors import AgentKitError
41
+ from ccai.agentkit.errors import ConfigurationError
42
+ from ccai.agentkit.errors import LifecycleError
43
+ from ccai.agentkit.errors import SemanticError
44
+ from ccai.agentkit.featureflag import FeatureFlag
45
+ from ccai.agentkit.featureflagevaluator import FeatureFlagEvaluator
46
+ from ccai.agentkit.featureflagregistry import FeatureFlagRegistry
47
+ from ccai.agentkit.hotreloadmonitor import HotReloadMonitor
48
+ from ccai.agentkit.hotreloadpolicy import HotReloadPolicy
49
+ from ccai.agentkit.jsonoutputparser import JsonOutputParser
50
+ from ccai.agentkit.lifecyclestate import LifecycleState
51
+ from ccai.agentkit.embeddingprovider import EmbeddingProvider
52
+ from ccai.agentkit.memoryerrors import ContextWindowError
53
+ from ccai.agentkit.memoryerrors import MemoryStoreError
54
+ from ccai.agentkit.memoryconfiguration import MemoryConfiguration
55
+ from ccai.agentkit.memoryentry import MemoryEntry
56
+ from ccai.agentkit.memoryindex import MemoryIndex
57
+ from ccai.agentkit.memoryquery import MemoryQuery
58
+ from ccai.agentkit.memoryqueryresult import MemoryQueryResult
59
+ from ccai.agentkit.memoryscope import MemoryScope
60
+ from ccai.agentkit.memorystore import MemoryStore
61
+ from ccai.agentkit.memorystoreregistry import MemoryStoreRegistry
62
+ from ccai.agentkit.inmemorystore import InMemoryStore
63
+ from ccai.agentkit.llmconversation import LLMConversation
64
+ from ccai.agentkit.llmerrors import LLMRequestError
65
+ from ccai.agentkit.llmerrors import LLMResponseParsingError
66
+ from ccai.agentkit.llmmessage import LLMMessage
67
+ from ccai.agentkit.llmprovider import LLMProvider
68
+ from ccai.agentkit.llmproviderregistry import LLMProviderRegistry
69
+ from ccai.agentkit.llmresponse import LLMResponse
70
+ from ccai.agentkit.llmstreamchunk import LLMStreamChunk
71
+ from ccai.agentkit.llmstreamhandler import LLMStreamHandler
72
+ from ccai.agentkit.llmtoolbridge import LLMToolBridge
73
+ from ccai.agentkit.outputparser import OutputParser
74
+ from ccai.agentkit.outputschema import OutputSchema
75
+ from ccai.agentkit.pluginconfiguration import PluginConfiguration
76
+ from ccai.agentkit.plugindependency import PluginDependency
77
+ from ccai.agentkit.plugindescriptor import PluginDescriptor
78
+ from ccai.agentkit.pluginlifecyclehook import PluginLifecycleHook
79
+ from ccai.agentkit.pluginmanager import PluginManager
80
+ from ccai.agentkit.pluginstatus import PluginStatus
81
+ from ccai.agentkit.pooledagent import PooledAgent
82
+ from ccai.agentkit.prompttemplate import PromptTemplate
83
+ from ccai.agentkit.prompttemplateregistry import PromptTemplateRegistry
84
+ from ccai.agentkit.regexoutputparser import RegexOutputParser
85
+ from ccai.agentkit.retrypolicy import RetryPolicy
86
+ from ccai.agentkit.threadedagent import ThreadedAgent
87
+ from ccai.agentkit.tokenusage import TokenUsage
88
+ from ccai.agentkit.tool import Tool
89
+ from ccai.agentkit.toolchain import ToolChain
90
+ from ccai.agentkit.toolchainexecutor import ToolChainExecutor
91
+ from ccai.agentkit.toolchainresult import ToolChainResult
92
+ from ccai.agentkit.tooldescriptor import ToolDescriptor
93
+ from ccai.agentkit.toolerrors import ToolExecutionError
94
+ from ccai.agentkit.toolerrors import ToolValidationError
95
+ from ccai.agentkit.toolexecutor import ToolExecutor
96
+ from ccai.agentkit.toolfactory import create_tool
97
+ from ccai.agentkit.toolregistry import ToolRegistry
98
+ from ccai.agentkit.toolresult import ToolResult
99
+ from ccai.agentkit.toolschema import ToolSchema
100
+ from ccai.agentkit.transitionrecord import TransitionRecord
101
+
102
+ from ccai.agentkit.approvalgate import ApprovalGate
103
+ from ccai.agentkit.approvalrequest import ApprovalRequest
104
+ from ccai.agentkit.checkpointmanager import CheckpointManager
105
+ from ccai.agentkit.conditionevaluator import ConditionEvaluator
106
+ from ccai.agentkit.parallelbranch import ParallelBranch
107
+ from ccai.agentkit.stepexecutionstatus import StepExecutionStatus
108
+ from ccai.agentkit.stepresult import StepResult
109
+ from ccai.agentkit.workflowcheckpoint import WorkflowCheckpoint
110
+ from ccai.agentkit.workflowconfiguration import WorkflowConfiguration
111
+ from ccai.agentkit.workflowcontext import WorkflowContext
112
+ from ccai.agentkit.workflowdefinition import WorkflowDefinition
113
+ from ccai.agentkit.workflowedge import WorkflowEdge
114
+ from ccai.agentkit.workflowerrors import ApprovalTimeoutError
115
+ from ccai.agentkit.workflowerrors import WorkflowCheckpointError
116
+ from ccai.agentkit.workflowerrors import WorkflowDefinitionError
117
+ from ccai.agentkit.workflowerrors import WorkflowExecutionError
118
+ from ccai.agentkit.workflowexecutionstatus import WorkflowExecutionStatus
119
+ from ccai.agentkit.workflowexecutor import WorkflowExecutor
120
+ from ccai.agentkit.workflowregistry import WorkflowRegistry
121
+ from ccai.agentkit.workflowresult import WorkflowResult
122
+ from ccai.agentkit.workflowstep import WorkflowStep
123
+
124
+ from ccai.agentkit.steps.agentstep import AgentStep
125
+ from ccai.agentkit.steps.approvalstep import ApprovalStep
126
+ from ccai.agentkit.steps.llmstep import LLMStep
127
+ from ccai.agentkit.steps.subworkflowstep import SubWorkflowStep
128
+ from ccai.agentkit.steps.toolstep import ToolStep
129
+
130
+ from ccai.agentkit.messagingerrors import TransportError
131
+ from ccai.agentkit.messagingerrors import MessageSerializationError
132
+ from ccai.agentkit.messagingerrors import MessageRoutingError
133
+ from ccai.agentkit.messagingerrors import MessageTimeoutError
134
+ from ccai.agentkit.messagingerrors import NoMessageAvailableError
135
+ from ccai.agentkit.messagepattern import MessagePattern
136
+ from ccai.agentkit.agentaddress import AgentAddress
137
+ from ccai.agentkit.message import Message
138
+ from ccai.agentkit.messageenvelope import MessageEnvelope
139
+ from ccai.agentkit.transportconfiguration import TransportConfiguration
140
+ from ccai.agentkit.transport import Transport
141
+ from ccai.agentkit.transportregistry import TransportRegistry
142
+ from ccai.agentkit.transporthealthcheck import TransportHealthCheck
143
+ from ccai.agentkit.messageserializer import MessageSerializer
144
+ from ccai.agentkit.messageserializerregistry import MessageSerializerRegistry
145
+ from ccai.agentkit.jsonmessageserializer import JsonMessageSerializer
146
+ from ccai.agentkit.msgpackmessageserializer import MsgpackMessageSerializer
147
+ from ccai.agentkit.protobufmessageserializer import ProtobufMessageSerializer
148
+ from ccai.agentkit.messagerouter import MessageRouter
149
+ from ccai.agentkit.addressresolver import AddressResolver
150
+ from ccai.agentkit.subscription import Subscription
151
+ from ccai.agentkit.pubsubbroker import PubSubBroker
152
+ from ccai.agentkit.requestresponsehandler import RequestResponseHandler
153
+ from ccai.agentkit.messagingconfiguration import MessagingConfiguration
154
+ from ccai.agentkit.transports.httptransport import HttpTransport
155
+ from ccai.agentkit.transports.websockettransport import WebSocketTransport
156
+ from ccai.agentkit.transports.grpctransport import GrpcTransport
157
+ from ccai.agentkit.transports.messagequeuetransport import MessageQueueTransport
158
+
159
+ __all__ = [
160
+ "Agent",
161
+ "AgentConfiguration",
162
+ "AgentIdentity",
163
+ "AgentRegistry",
164
+ "AgentStateMachine",
165
+ "AsyncAgent",
166
+ "ConcurrencyBridge",
167
+ "ConcurrencyModel",
168
+ "ConfigurationChangeEvent",
169
+ "ConfigurationLayer",
170
+ "ConfigurationLayerSource",
171
+ "ConfigurationManager",
172
+ "ConfigurationSchema",
173
+ "ConfigurationSchemaField",
174
+ "ConfigurationSerializer",
175
+ "ConfigurationValidationError",
176
+ "ConfigurationValidationResult",
177
+ "ContextSummarizer",
178
+ "ContextWindow",
179
+ "ContextWindowError",
180
+ "ContextWindowStrategy",
181
+ "CostEstimate",
182
+ "CostTracker",
183
+ "AgentKitError",
184
+ "ConfigurationError",
185
+ "EmbeddingProvider",
186
+ "ExpirationPolicy",
187
+ "FallbackChain",
188
+ "FeatureFlag",
189
+ "FeatureFlagEvaluator",
190
+ "FeatureFlagRegistry",
191
+ "FileReadTool",
192
+ "FileWriteTool",
193
+ "HotReloadMonitor",
194
+ "HotReloadPolicy",
195
+ "HttpRequestTool",
196
+ "JsonOutputParser",
197
+ "LifecycleError",
198
+ "LifecycleState",
199
+ "LLMConversation",
200
+ "LLMMessage",
201
+ "LLMProvider",
202
+ "LLMProviderRegistry",
203
+ "LLMRequestError",
204
+ "LLMResponse",
205
+ "LLMResponseParsingError",
206
+ "LLMStreamChunk",
207
+ "LLMStreamHandler",
208
+ "LLMToolBridge",
209
+ "MemoryConfiguration",
210
+ "MemoryEntry",
211
+ "MemoryIndex",
212
+ "MemoryQuery",
213
+ "MemoryQueryResult",
214
+ "MemoryScope",
215
+ "MemoryStore",
216
+ "MemoryStoreError",
217
+ "MemoryStoreRegistry",
218
+ "InMemoryStore",
219
+ "OutputParser",
220
+ "OutputSchema",
221
+ "PluginConfiguration",
222
+ "PluginDependency",
223
+ "PluginDescriptor",
224
+ "PluginLifecycleHook",
225
+ "PluginLoadError",
226
+ "PluginManager",
227
+ "PluginStatus",
228
+ "PooledAgent",
229
+ "PromptTemplate",
230
+ "PromptTemplateRegistry",
231
+ "RegexOutputParser",
232
+ "RetryPolicy",
233
+ "SemanticError",
234
+ "ShellCommandTool",
235
+ "ThreadedAgent",
236
+ "TokenUsage",
237
+ "Tool",
238
+ "ToolChain",
239
+ "ToolChainExecutor",
240
+ "ToolChainResult",
241
+ "ToolDescriptor",
242
+ "ToolExecutionError",
243
+ "ToolExecutor",
244
+ "ToolRegistry",
245
+ "ToolResult",
246
+ "ToolSchema",
247
+ "ToolValidationError",
248
+ "TransitionRecord",
249
+ "create_tool",
250
+ "AgentStep",
251
+ "ApprovalGate",
252
+ "ApprovalRequest",
253
+ "ApprovalStep",
254
+ "ApprovalTimeoutError",
255
+ "CheckpointManager",
256
+ "ConditionEvaluator",
257
+ "LLMStep",
258
+ "ParallelBranch",
259
+ "StepExecutionStatus",
260
+ "StepResult",
261
+ "SubWorkflowStep",
262
+ "ToolStep",
263
+ "WorkflowCheckpoint",
264
+ "WorkflowCheckpointError",
265
+ "WorkflowConfiguration",
266
+ "WorkflowContext",
267
+ "WorkflowDefinition",
268
+ "WorkflowDefinitionError",
269
+ "WorkflowEdge",
270
+ "WorkflowExecutionError",
271
+ "WorkflowExecutionStatus",
272
+ "WorkflowExecutor",
273
+ "WorkflowRegistry",
274
+ "WorkflowResult",
275
+ "WorkflowStep",
276
+ "AddressResolver",
277
+ "AgentAddress",
278
+ "GrpcTransport",
279
+ "HttpTransport",
280
+ "JsonMessageSerializer",
281
+ "Message",
282
+ "MessageEnvelope",
283
+ "MessagePattern",
284
+ "MessageQueueTransport",
285
+ "MessageRouter",
286
+ "MessageRoutingError",
287
+ "MessageSerializationError",
288
+ "MessageSerializer",
289
+ "MessageSerializerRegistry",
290
+ "MessageTimeoutError",
291
+ "MessagingConfiguration",
292
+ "MsgpackMessageSerializer",
293
+ "NoMessageAvailableError",
294
+ "ProtobufMessageSerializer",
295
+ "PubSubBroker",
296
+ "RequestResponseHandler",
297
+ "Subscription",
298
+ "Transport",
299
+ "TransportConfiguration",
300
+ "TransportError",
301
+ "TransportHealthCheck",
302
+ "TransportRegistry",
303
+ "WebSocketTransport",
304
+ ]
@@ -0,0 +1,177 @@
1
+ """
2
+ Defines the AddressResolver class for resolving agent identifiers
3
+ to AgentAddress instances using static mappings or dynamic
4
+ AgentRegistry lookup.
5
+
6
+ AddressResolver supports two resolution strategies: static address
7
+ resolution from a configured mapping dictionary, and dynamic
8
+ resolution by querying the AgentRegistry. Static resolution is
9
+ attempted first; if no static mapping is found, dynamic resolution
10
+ is attempted. If neither strategy resolves the address, a
11
+ MessageRoutingError is raised.
12
+
13
+ .. module:: ccai.agentkit.addressresolver
14
+ :platform: Darwin, Linux, Unix, Windows
15
+ :synopsis: Agent address resolution for message routing.
16
+
17
+ Requirements: 8.1-8.8
18
+ """
19
+
20
+ from typing import Dict
21
+ from typing import Optional
22
+ from typing import Tuple
23
+
24
+ from ccai.agentkit.agentaddress import AgentAddress
25
+ from ccai.agentkit.messagingerrors import MessageRoutingError
26
+
27
+
28
+ class AddressResolver:
29
+ """
30
+ Resolves agent identifiers to AgentAddress instances using static
31
+ mappings or dynamic AgentRegistry lookup.
32
+
33
+ Static address resolution uses a dictionary keyed by
34
+ (agent_identifier, transport_name) tuples. Dynamic resolution
35
+ queries the AgentRegistry for the agent and derives the
36
+ AgentAddress from the agent's registered transport configuration.
37
+
38
+ Static resolution is attempted first. If no static mapping is
39
+ found and an AgentRegistry is available, dynamic resolution is
40
+ attempted. If neither strategy resolves the address, a
41
+ MessageRoutingError is raised.
42
+
43
+ :param agent_registry: An optional AgentRegistry instance for
44
+ dynamic address resolution.
45
+ """
46
+
47
+ def __init__(self, agent_registry=None) -> None:
48
+ self._static_addresses: Dict[Tuple[str, str], AgentAddress] = {}
49
+ self._agent_registry = agent_registry
50
+ return
51
+
52
+ def resolve(self, agent_identifier: str, transport_name: str) -> AgentAddress:
53
+ """
54
+ Resolves an agent identifier and transport name to an AgentAddress.
55
+
56
+ Attempts static lookup first using the configured address mapping.
57
+ If no static mapping is found and an AgentRegistry is available,
58
+ attempts dynamic resolution by querying the registry.
59
+
60
+ :param agent_identifier: The agent identifier string.
61
+ :param transport_name: The transport name string.
62
+
63
+ :returns: The resolved AgentAddress.
64
+
65
+ :raises MessageRoutingError: If the agent identifier cannot be
66
+ resolved to an AgentAddress.
67
+ """
68
+ lookup_key = (agent_identifier, transport_name)
69
+ static_address = self._static_addresses.get(lookup_key, None)
70
+
71
+ if static_address is not None:
72
+ return static_address
73
+
74
+ if self._agent_registry is not None:
75
+ dynamic_address = self._resolve_dynamic(agent_identifier, transport_name)
76
+
77
+ if dynamic_address is not None:
78
+ return dynamic_address
79
+
80
+ raise MessageRoutingError(
81
+ target=agent_identifier,
82
+ detail="Cannot resolve agent '{}' for transport '{}'".format(
83
+ agent_identifier, transport_name
84
+ )
85
+ )
86
+
87
+ def _resolve_dynamic(self, agent_identifier: str, transport_name: str) -> Optional[AgentAddress]:
88
+ """
89
+ Attempts dynamic resolution by querying the AgentRegistry.
90
+
91
+ Looks up the agent by identifier in the registry and derives
92
+ an AgentAddress from the agent's registered information.
93
+
94
+ :param agent_identifier: The agent identifier string.
95
+ :param transport_name: The transport name string.
96
+
97
+ :returns: The resolved AgentAddress or None if not found.
98
+ """
99
+ agent = self._agent_registry.lookup_by_id(agent_identifier)
100
+
101
+ if agent is None:
102
+ return None
103
+
104
+ address = AgentAddress(
105
+ agent_identifier=agent_identifier,
106
+ transport_name=transport_name,
107
+ )
108
+ return address
109
+
110
+ def register_address(self, agent_identifier: str, transport_name: str,
111
+ endpoint: dict) -> None:
112
+ """
113
+ Stores a static address mapping.
114
+
115
+ Creates an AgentAddress from the provided parameters and
116
+ stores it in the static address mapping dictionary keyed
117
+ by (agent_identifier, transport_name).
118
+
119
+ :param agent_identifier: The agent identifier.
120
+ :param transport_name: The transport name.
121
+ :param endpoint: The endpoint dictionary.
122
+ """
123
+ address = AgentAddress(
124
+ agent_identifier=agent_identifier,
125
+ transport_name=transport_name,
126
+ endpoint=endpoint,
127
+ )
128
+
129
+ lookup_key = (agent_identifier, transport_name)
130
+ self._static_addresses[lookup_key] = address
131
+
132
+ return
133
+
134
+ def deregister_address(self, agent_identifier: str, transport_name: str) -> None:
135
+ """
136
+ Removes a static address mapping.
137
+
138
+ If the mapping does not exist, the operation is a no-op.
139
+
140
+ :param agent_identifier: The agent identifier.
141
+ :param transport_name: The transport name.
142
+ """
143
+ lookup_key = (agent_identifier, transport_name)
144
+ is_present = lookup_key in self._static_addresses
145
+
146
+ if is_present is True:
147
+ del self._static_addresses[lookup_key]
148
+
149
+ return
150
+
151
+ def __repr__(self) -> str:
152
+ """
153
+ Returns a detailed string representation including the
154
+ class name and the count of registered static addresses.
155
+
156
+ :returns: A repr string for debugging.
157
+ """
158
+ static_count = len(self._static_addresses)
159
+ repr_str = "{}(static_addresses={})".format(
160
+ self.__class__.__name__, static_count
161
+ )
162
+ return repr_str
163
+
164
+ def __str__(self) -> str:
165
+ """
166
+ Returns a human-readable summary including the count of
167
+ static addresses and whether dynamic resolution is enabled.
168
+
169
+ :returns: A human-readable string describing the resolver state.
170
+ """
171
+ static_count = len(self._static_addresses)
172
+ has_dynamic = self._agent_registry is not None
173
+
174
+ str_val = "AddressResolver: {} static address(es), dynamic_resolution={}".format(
175
+ static_count, has_dynamic
176
+ )
177
+ return str_val