jaf-py 2.5.10__py3-none-any.whl → 2.5.12__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.
- jaf/__init__.py +154 -57
- jaf/a2a/__init__.py +42 -21
- jaf/a2a/agent.py +79 -126
- jaf/a2a/agent_card.py +87 -78
- jaf/a2a/client.py +30 -66
- jaf/a2a/examples/client_example.py +12 -12
- jaf/a2a/examples/integration_example.py +38 -47
- jaf/a2a/examples/server_example.py +56 -53
- jaf/a2a/memory/__init__.py +0 -4
- jaf/a2a/memory/cleanup.py +28 -21
- jaf/a2a/memory/factory.py +155 -133
- jaf/a2a/memory/providers/composite.py +21 -26
- jaf/a2a/memory/providers/in_memory.py +89 -83
- jaf/a2a/memory/providers/postgres.py +117 -115
- jaf/a2a/memory/providers/redis.py +128 -121
- jaf/a2a/memory/serialization.py +77 -87
- jaf/a2a/memory/tests/run_comprehensive_tests.py +112 -83
- jaf/a2a/memory/tests/test_cleanup.py +211 -94
- jaf/a2a/memory/tests/test_serialization.py +73 -68
- jaf/a2a/memory/tests/test_stress_concurrency.py +186 -133
- jaf/a2a/memory/tests/test_task_lifecycle.py +138 -120
- jaf/a2a/memory/types.py +91 -53
- jaf/a2a/protocol.py +95 -125
- jaf/a2a/server.py +90 -118
- jaf/a2a/standalone_client.py +30 -43
- jaf/a2a/tests/__init__.py +16 -33
- jaf/a2a/tests/run_tests.py +17 -53
- jaf/a2a/tests/test_agent.py +40 -140
- jaf/a2a/tests/test_client.py +54 -117
- jaf/a2a/tests/test_integration.py +28 -82
- jaf/a2a/tests/test_protocol.py +54 -139
- jaf/a2a/tests/test_types.py +50 -136
- jaf/a2a/types.py +58 -34
- jaf/cli.py +21 -41
- jaf/core/__init__.py +7 -1
- jaf/core/agent_tool.py +93 -72
- jaf/core/analytics.py +257 -207
- jaf/core/checkpoint.py +223 -0
- jaf/core/composition.py +249 -235
- jaf/core/engine.py +817 -519
- jaf/core/errors.py +55 -42
- jaf/core/guardrails.py +276 -202
- jaf/core/handoff.py +47 -31
- jaf/core/parallel_agents.py +69 -75
- jaf/core/performance.py +75 -73
- jaf/core/proxy.py +43 -44
- jaf/core/proxy_helpers.py +24 -27
- jaf/core/regeneration.py +220 -129
- jaf/core/state.py +68 -66
- jaf/core/streaming.py +115 -108
- jaf/core/tool_results.py +111 -101
- jaf/core/tools.py +114 -116
- jaf/core/tracing.py +310 -210
- jaf/core/types.py +403 -151
- jaf/core/workflows.py +209 -168
- jaf/exceptions.py +46 -38
- jaf/memory/__init__.py +1 -6
- jaf/memory/approval_storage.py +54 -77
- jaf/memory/factory.py +4 -4
- jaf/memory/providers/in_memory.py +216 -180
- jaf/memory/providers/postgres.py +216 -146
- jaf/memory/providers/redis.py +173 -116
- jaf/memory/types.py +70 -51
- jaf/memory/utils.py +36 -34
- jaf/plugins/__init__.py +12 -12
- jaf/plugins/base.py +105 -96
- jaf/policies/__init__.py +0 -1
- jaf/policies/handoff.py +37 -46
- jaf/policies/validation.py +76 -52
- jaf/providers/__init__.py +6 -3
- jaf/providers/mcp.py +97 -51
- jaf/providers/model.py +475 -283
- jaf/server/__init__.py +1 -1
- jaf/server/main.py +7 -11
- jaf/server/server.py +514 -359
- jaf/server/types.py +208 -52
- jaf/utils/__init__.py +17 -18
- jaf/utils/attachments.py +111 -116
- jaf/utils/document_processor.py +175 -174
- jaf/visualization/__init__.py +1 -1
- jaf/visualization/example.py +111 -110
- jaf/visualization/functional_core.py +46 -71
- jaf/visualization/graphviz.py +154 -189
- jaf/visualization/imperative_shell.py +7 -16
- jaf/visualization/types.py +8 -4
- {jaf_py-2.5.10.dist-info → jaf_py-2.5.12.dist-info}/METADATA +2 -2
- jaf_py-2.5.12.dist-info/RECORD +97 -0
- jaf_py-2.5.10.dist-info/RECORD +0 -96
- {jaf_py-2.5.10.dist-info → jaf_py-2.5.12.dist-info}/WHEEL +0 -0
- {jaf_py-2.5.10.dist-info → jaf_py-2.5.12.dist-info}/entry_points.txt +0 -0
- {jaf_py-2.5.10.dist-info → jaf_py-2.5.12.dist-info}/licenses/LICENSE +0 -0
- {jaf_py-2.5.10.dist-info → jaf_py-2.5.12.dist-info}/top_level.txt +0 -0
jaf/__init__.py
CHANGED
|
@@ -16,6 +16,7 @@ from .core.tools import (
|
|
|
16
16
|
)
|
|
17
17
|
from .core.tracing import ConsoleTraceCollector, TraceCollector
|
|
18
18
|
from .core.types import *
|
|
19
|
+
|
|
19
20
|
# Import attachment utilities for convenience
|
|
20
21
|
from .utils.attachments import (
|
|
21
22
|
make_image_attachment,
|
|
@@ -83,6 +84,7 @@ try:
|
|
|
83
84
|
monitor_performance,
|
|
84
85
|
get_performance_summary,
|
|
85
86
|
)
|
|
87
|
+
|
|
86
88
|
_PERFORMANCE_AVAILABLE = True
|
|
87
89
|
except ImportError:
|
|
88
90
|
_PERFORMANCE_AVAILABLE = False
|
|
@@ -96,6 +98,7 @@ try:
|
|
|
96
98
|
create_sse_response,
|
|
97
99
|
stream_to_websocket,
|
|
98
100
|
)
|
|
101
|
+
|
|
99
102
|
_STREAMING_AVAILABLE = True
|
|
100
103
|
except ImportError:
|
|
101
104
|
_STREAMING_AVAILABLE = False
|
|
@@ -110,6 +113,7 @@ try:
|
|
|
110
113
|
with_timeout,
|
|
111
114
|
compose,
|
|
112
115
|
)
|
|
116
|
+
|
|
113
117
|
_COMPOSITION_AVAILABLE = True
|
|
114
118
|
except ImportError:
|
|
115
119
|
_COMPOSITION_AVAILABLE = False
|
|
@@ -122,6 +126,7 @@ try:
|
|
|
122
126
|
PluginRegistry,
|
|
123
127
|
get_plugin_registry,
|
|
124
128
|
)
|
|
129
|
+
|
|
125
130
|
_PLUGINS_AVAILABLE = True
|
|
126
131
|
except ImportError:
|
|
127
132
|
_PLUGINS_AVAILABLE = False
|
|
@@ -135,6 +140,7 @@ try:
|
|
|
135
140
|
get_analytics_report,
|
|
136
141
|
analyze_conversation_quality,
|
|
137
142
|
)
|
|
143
|
+
|
|
138
144
|
_ANALYTICS_AVAILABLE = True
|
|
139
145
|
except ImportError:
|
|
140
146
|
_ANALYTICS_AVAILABLE = False
|
|
@@ -159,6 +165,7 @@ try:
|
|
|
159
165
|
create_parallel_workflow,
|
|
160
166
|
execute_workflow_stream,
|
|
161
167
|
)
|
|
168
|
+
|
|
162
169
|
_WORKFLOWS_AVAILABLE = True
|
|
163
170
|
except ImportError:
|
|
164
171
|
_WORKFLOWS_AVAILABLE = False
|
|
@@ -174,6 +181,7 @@ try:
|
|
|
174
181
|
get_graph_dot,
|
|
175
182
|
validate_graph_options,
|
|
176
183
|
)
|
|
184
|
+
|
|
177
185
|
_VISUALIZATION_AVAILABLE = True
|
|
178
186
|
except ImportError:
|
|
179
187
|
_VISUALIZATION_AVAILABLE = False
|
|
@@ -187,47 +195,89 @@ def generate_trace_id() -> TraceId:
|
|
|
187
195
|
"""Generate a new trace ID."""
|
|
188
196
|
return create_trace_id(str(uuid.uuid4()))
|
|
189
197
|
|
|
198
|
+
|
|
190
199
|
def generate_run_id() -> RunId:
|
|
191
200
|
"""Generate a new run ID."""
|
|
192
201
|
return create_run_id(str(uuid.uuid4()))
|
|
193
202
|
|
|
194
|
-
|
|
203
|
+
|
|
204
|
+
__version__ = "2.5.12"
|
|
195
205
|
__all__ = [
|
|
196
206
|
# Core types and functions
|
|
197
|
-
"TraceId",
|
|
198
|
-
"
|
|
199
|
-
"
|
|
200
|
-
"
|
|
201
|
-
|
|
207
|
+
"TraceId",
|
|
208
|
+
"RunId",
|
|
209
|
+
"ValidationResult",
|
|
210
|
+
"Message",
|
|
211
|
+
"ModelConfig",
|
|
212
|
+
"Tool",
|
|
213
|
+
"Agent",
|
|
214
|
+
"Guardrail",
|
|
215
|
+
"RunState",
|
|
216
|
+
"JAFError",
|
|
217
|
+
"RunResult",
|
|
218
|
+
"TraceEvent",
|
|
219
|
+
"ModelProvider",
|
|
220
|
+
"RunConfig",
|
|
221
|
+
"create_trace_id",
|
|
222
|
+
"create_run_id",
|
|
223
|
+
"generate_trace_id",
|
|
224
|
+
"generate_run_id",
|
|
202
225
|
# Enums for type safety
|
|
203
|
-
"Model",
|
|
204
|
-
|
|
226
|
+
"Model",
|
|
227
|
+
"ToolParameterType",
|
|
228
|
+
"ToolSource",
|
|
229
|
+
"ContentRole",
|
|
230
|
+
"PartType",
|
|
205
231
|
# Tool factory functions
|
|
206
|
-
"create_function_tool",
|
|
207
|
-
"
|
|
208
|
-
"
|
|
209
|
-
|
|
232
|
+
"create_function_tool",
|
|
233
|
+
"create_function_tool_legacy",
|
|
234
|
+
"create_async_function_tool",
|
|
235
|
+
"create_async_function_tool_legacy",
|
|
236
|
+
"FunctionToolConfig",
|
|
237
|
+
"ToolExecuteFunction",
|
|
238
|
+
"function_tool",
|
|
210
239
|
# Exception classes
|
|
211
|
-
"JAFException",
|
|
212
|
-
"
|
|
213
|
-
"
|
|
214
|
-
"
|
|
215
|
-
"
|
|
216
|
-
"
|
|
217
|
-
"
|
|
218
|
-
"
|
|
219
|
-
"
|
|
220
|
-
|
|
240
|
+
"JAFException",
|
|
241
|
+
"AgentException",
|
|
242
|
+
"AgentNotFoundError",
|
|
243
|
+
"HandoffError",
|
|
244
|
+
"ToolException",
|
|
245
|
+
"ToolExecutionError",
|
|
246
|
+
"ToolValidationError",
|
|
247
|
+
"ModelException",
|
|
248
|
+
"ModelProviderError",
|
|
249
|
+
"ModelResponseError",
|
|
250
|
+
"ValidationException",
|
|
251
|
+
"GuardrailViolationError",
|
|
252
|
+
"InputValidationError",
|
|
253
|
+
"MemoryException",
|
|
254
|
+
"MemoryConnectionError",
|
|
255
|
+
"MemoryStorageError",
|
|
256
|
+
"SessionException",
|
|
257
|
+
"SessionStateError",
|
|
258
|
+
"MaxTurnsExceededError",
|
|
259
|
+
"A2AException",
|
|
260
|
+
"A2AProtocolError",
|
|
261
|
+
"A2ATaskError",
|
|
262
|
+
"ConfigurationException",
|
|
263
|
+
"InvalidConfigurationError",
|
|
264
|
+
"create_agent_error",
|
|
265
|
+
"create_tool_error",
|
|
266
|
+
"create_session_error",
|
|
267
|
+
"create_memory_error",
|
|
221
268
|
# Engine
|
|
222
269
|
"run",
|
|
223
|
-
|
|
224
270
|
# Tracing
|
|
225
|
-
"TraceCollector",
|
|
226
|
-
|
|
271
|
+
"TraceCollector",
|
|
272
|
+
"ConsoleTraceCollector",
|
|
227
273
|
# Tool results
|
|
228
|
-
"ToolResult",
|
|
229
|
-
"
|
|
230
|
-
|
|
274
|
+
"ToolResult",
|
|
275
|
+
"ToolResultStatus",
|
|
276
|
+
"ToolResponse",
|
|
277
|
+
"ToolErrorCodes",
|
|
278
|
+
"with_error_handling",
|
|
279
|
+
"require_permissions",
|
|
280
|
+
"tool_result_to_string",
|
|
231
281
|
# Providers
|
|
232
282
|
"make_litellm_provider",
|
|
233
283
|
"FastMCPTool",
|
|
@@ -235,45 +285,92 @@ __all__ = [
|
|
|
235
285
|
"create_mcp_stdio_tools",
|
|
236
286
|
"create_mcp_sse_tools",
|
|
237
287
|
"create_mcp_http_tools",
|
|
238
|
-
|
|
239
288
|
# Memory system
|
|
240
|
-
"ConversationMemory",
|
|
241
|
-
"
|
|
242
|
-
"
|
|
243
|
-
"
|
|
244
|
-
"
|
|
245
|
-
"
|
|
246
|
-
|
|
289
|
+
"ConversationMemory",
|
|
290
|
+
"MemoryProvider",
|
|
291
|
+
"MemoryQuery",
|
|
292
|
+
"MemoryConfig",
|
|
293
|
+
"Result",
|
|
294
|
+
"Success",
|
|
295
|
+
"Failure",
|
|
296
|
+
"InMemoryConfig",
|
|
297
|
+
"RedisConfig",
|
|
298
|
+
"PostgresConfig",
|
|
299
|
+
"MemoryProviderConfig",
|
|
300
|
+
"MemoryError",
|
|
301
|
+
"MemoryConnectionError",
|
|
302
|
+
"MemoryNotFoundError",
|
|
303
|
+
"MemoryStorageError",
|
|
304
|
+
"create_memory_provider_from_env",
|
|
305
|
+
"get_memory_provider_info",
|
|
306
|
+
"test_memory_provider_connection",
|
|
307
|
+
"create_in_memory_provider",
|
|
308
|
+
"create_redis_provider",
|
|
309
|
+
"create_postgres_provider",
|
|
247
310
|
# Server
|
|
248
311
|
"run_server",
|
|
249
|
-
|
|
250
312
|
# Performance monitoring (NEW)
|
|
251
|
-
"PerformanceMonitor",
|
|
252
|
-
|
|
313
|
+
"PerformanceMonitor",
|
|
314
|
+
"PerformanceMetrics",
|
|
315
|
+
"monitor_performance",
|
|
316
|
+
"get_performance_summary",
|
|
253
317
|
# Streaming support (NEW)
|
|
254
|
-
"run_streaming",
|
|
255
|
-
"
|
|
256
|
-
|
|
318
|
+
"run_streaming",
|
|
319
|
+
"StreamingEvent",
|
|
320
|
+
"StreamingEventType",
|
|
321
|
+
"StreamingCollector",
|
|
322
|
+
"create_sse_response",
|
|
323
|
+
"stream_to_websocket",
|
|
257
324
|
# Tool composition (NEW)
|
|
258
|
-
"create_tool_pipeline",
|
|
259
|
-
"
|
|
260
|
-
|
|
325
|
+
"create_tool_pipeline",
|
|
326
|
+
"create_parallel_tools",
|
|
327
|
+
"create_conditional_tool",
|
|
328
|
+
"with_retry",
|
|
329
|
+
"with_cache",
|
|
330
|
+
"with_timeout",
|
|
331
|
+
"compose",
|
|
261
332
|
# Plugin system (NEW)
|
|
262
|
-
"JAFPlugin",
|
|
263
|
-
|
|
333
|
+
"JAFPlugin",
|
|
334
|
+
"PluginMetadata",
|
|
335
|
+
"PluginStatus",
|
|
336
|
+
"PluginRegistry",
|
|
337
|
+
"get_plugin_registry",
|
|
264
338
|
# Analytics system (NEW)
|
|
265
|
-
"ConversationAnalytics",
|
|
266
|
-
"
|
|
267
|
-
|
|
339
|
+
"ConversationAnalytics",
|
|
340
|
+
"AgentAnalytics",
|
|
341
|
+
"SystemAnalytics",
|
|
342
|
+
"AnalyticsEngine",
|
|
343
|
+
"get_analytics_report",
|
|
344
|
+
"analyze_conversation_quality",
|
|
268
345
|
# Workflow orchestration (NEW)
|
|
269
|
-
"Workflow",
|
|
270
|
-
"
|
|
271
|
-
"
|
|
272
|
-
"
|
|
346
|
+
"Workflow",
|
|
347
|
+
"WorkflowStep",
|
|
348
|
+
"WorkflowContext",
|
|
349
|
+
"WorkflowResult",
|
|
350
|
+
"StepResult",
|
|
351
|
+
"WorkflowStatus",
|
|
352
|
+
"StepStatus",
|
|
353
|
+
"AgentStep",
|
|
354
|
+
"ToolStep",
|
|
355
|
+
"ConditionalStep",
|
|
356
|
+
"ParallelStep",
|
|
357
|
+
"LoopStep",
|
|
358
|
+
"WorkflowBuilder",
|
|
359
|
+
"create_workflow",
|
|
360
|
+
"create_sequential_workflow",
|
|
361
|
+
"create_parallel_workflow",
|
|
362
|
+
"execute_workflow_stream",
|
|
273
363
|
] + (
|
|
274
364
|
# Visualization (conditional)
|
|
275
365
|
[
|
|
276
|
-
"generate_agent_graph",
|
|
277
|
-
"
|
|
278
|
-
|
|
366
|
+
"generate_agent_graph",
|
|
367
|
+
"generate_tool_graph",
|
|
368
|
+
"generate_runner_graph",
|
|
369
|
+
"GraphOptions",
|
|
370
|
+
"GraphResult",
|
|
371
|
+
"get_graph_dot",
|
|
372
|
+
"validate_graph_options",
|
|
373
|
+
]
|
|
374
|
+
if _VISUALIZATION_AVAILABLE
|
|
375
|
+
else []
|
|
279
376
|
)
|
jaf/a2a/__init__.py
CHANGED
|
@@ -195,28 +195,49 @@ from .types import (
|
|
|
195
195
|
# Main exports for easy access
|
|
196
196
|
__all__ = [
|
|
197
197
|
# Types
|
|
198
|
-
"A2AMessage",
|
|
199
|
-
"
|
|
200
|
-
"
|
|
201
|
-
"
|
|
202
|
-
"
|
|
203
|
-
|
|
198
|
+
"A2AMessage",
|
|
199
|
+
"A2ATask",
|
|
200
|
+
"A2AAgent",
|
|
201
|
+
"A2AAgentTool",
|
|
202
|
+
"A2AArtifact",
|
|
203
|
+
"A2ATaskStatus",
|
|
204
|
+
"A2APart",
|
|
205
|
+
"A2AStreamEvent",
|
|
206
|
+
"A2AError",
|
|
207
|
+
"A2AErrorCodes",
|
|
208
|
+
"JSONRPCRequest",
|
|
209
|
+
"JSONRPCResponse",
|
|
210
|
+
"JSONRPCError",
|
|
211
|
+
"AgentCard",
|
|
212
|
+
"AgentSkill",
|
|
213
|
+
"AgentCapabilities",
|
|
214
|
+
"AgentProvider",
|
|
215
|
+
"A2AServerConfig",
|
|
216
|
+
"A2AClientConfig",
|
|
217
|
+
"A2AClientState",
|
|
204
218
|
# Agent utilities
|
|
205
|
-
"create_a2a_agent",
|
|
206
|
-
"
|
|
207
|
-
|
|
219
|
+
"create_a2a_agent",
|
|
220
|
+
"create_a2a_tool",
|
|
221
|
+
"transform_a2a_agent_to_jaf",
|
|
222
|
+
"process_agent_query",
|
|
223
|
+
"execute_a2a_agent",
|
|
224
|
+
"execute_a2a_agent_with_streaming",
|
|
208
225
|
# Protocol
|
|
209
|
-
"validate_jsonrpc_request",
|
|
210
|
-
|
|
226
|
+
"validate_jsonrpc_request",
|
|
227
|
+
"route_a2a_request",
|
|
211
228
|
# Agent Card
|
|
212
|
-
"generate_agent_card",
|
|
213
|
-
|
|
229
|
+
"generate_agent_card",
|
|
230
|
+
"validate_agent_card",
|
|
214
231
|
# Server
|
|
215
|
-
"create_a2a_server",
|
|
216
|
-
|
|
232
|
+
"create_a2a_server",
|
|
233
|
+
"start_a2a_server",
|
|
234
|
+
"create_server_config",
|
|
217
235
|
# Client
|
|
218
|
-
"create_a2a_client",
|
|
219
|
-
"
|
|
236
|
+
"create_a2a_client",
|
|
237
|
+
"connect_to_a2a_agent",
|
|
238
|
+
"send_message",
|
|
239
|
+
"stream_message",
|
|
240
|
+
"discover_agents",
|
|
220
241
|
]
|
|
221
242
|
|
|
222
243
|
|
|
@@ -224,12 +245,12 @@ __all__ = [
|
|
|
224
245
|
class A2A:
|
|
225
246
|
"""
|
|
226
247
|
Convenience class for A2A operations
|
|
227
|
-
|
|
248
|
+
|
|
228
249
|
Usage:
|
|
229
250
|
# Create client
|
|
230
251
|
a2a = A2A.client("http://localhost:3000")
|
|
231
252
|
response = await a2a.ask("Hello")
|
|
232
|
-
|
|
253
|
+
|
|
233
254
|
# Create server
|
|
234
255
|
server = A2A.server(agents, "My Server", "Description", 3000)
|
|
235
256
|
await server.start()
|
|
@@ -279,11 +300,11 @@ A2A_SUPPORTED_METHODS = [
|
|
|
279
300
|
"message/stream",
|
|
280
301
|
"tasks/get",
|
|
281
302
|
"tasks/cancel",
|
|
282
|
-
"agent/getAuthenticatedExtendedCard"
|
|
303
|
+
"agent/getAuthenticatedExtendedCard",
|
|
283
304
|
]
|
|
284
305
|
A2A_SUPPORTED_TRANSPORTS = ["JSONRPC"]
|
|
285
306
|
A2A_DEFAULT_CAPABILITIES = {
|
|
286
307
|
"streaming": True,
|
|
287
308
|
"pushNotifications": False,
|
|
288
|
-
"stateTransitionHistory": True
|
|
309
|
+
"stateTransitionHistory": True,
|
|
289
310
|
}
|