agent-framework-core 1.16.0__tar.gz → 1.18.0__tar.gz
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.
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/PKG-INFO +2 -5
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/__init__.py +58 -1
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/__init__.pyi +49 -1
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/_agent_hooks.py +92 -16
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/_agents.py +19 -19
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/_clients.py +5 -1
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/_compaction.py +296 -36
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/_evaluation.py +133 -169
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/_feature_stage.py +1 -0
- agent_framework_core-1.18.0/agent_framework/_filesystem.py +138 -0
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/_harness/_agent.py +6 -8
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/_harness/_agent.pyi +1 -1
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/_harness/_file_access.py +474 -76
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/_harness/_file_memory.py +61 -7
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/_harness/_memory.py +58 -13
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/_harness/_todo.py +13 -40
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/_harness/_tool_approval.py +2 -1
- agent_framework_core-1.18.0/agent_framework/_in_memory.py +604 -0
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/_mcp.py +626 -73
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/_middleware.py +212 -27
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/_serialization.py +144 -60
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/_sessions.py +49 -59
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/_settings.py +79 -17
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/_skills.py +149 -38
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/_telemetry.py +1 -0
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/_tools.py +640 -117
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/_types.py +96 -6
- agent_framework_core-1.18.0/agent_framework/_vector_filters.py +874 -0
- agent_framework_core-1.18.0/agent_framework/_vectors.py +2065 -0
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/_workflows/_agent.py +92 -23
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/_workflows/_agent_executor.py +76 -39
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/_workflows/_checkpoint.py +5 -4
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/_workflows/_const.py +7 -0
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/_workflows/_edge_runner.py +111 -6
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/_workflows/_events.py +28 -5
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/_workflows/_executor.py +4 -0
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/_workflows/_functional.py +97 -86
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/_workflows/_request_info_mixin.py +369 -369
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/_workflows/_runner.py +51 -5
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/_workflows/_runner_context.py +38 -0
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/_workflows/_workflow.py +156 -30
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/_workflows/_workflow_context.py +5 -0
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/_workflows/_workflow_executor.py +53 -25
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/ag_ui/__init__.py +4 -0
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/ag_ui/__init__.pyi +4 -0
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/azure/__init__.py +2 -0
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/azure/__init__.pyi +4 -0
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/observability.py +41 -10
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/redis/__init__.py +4 -1
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/redis/__init__.pyi +6 -0
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/security.py +1290 -684
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/pyproject.toml +5 -9
- agent_framework_core-1.16.0/agent_framework/_filesystem.py +0 -23
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/LICENSE +0 -0
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/README.md +0 -0
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/_docstrings.py +0 -0
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/_harness/__init__.py +0 -0
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/_harness/_background_agents.py +0 -0
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/_harness/_loop.py +0 -0
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/_harness/_mode.py +0 -0
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/_workflows/__init__.py +0 -0
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/_workflows/_agent_utils.py +0 -0
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/_workflows/_checkpoint_encoding.py +0 -0
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/_workflows/_conversation_history.py +0 -0
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/_workflows/_edge.py +0 -0
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/_workflows/_function_executor.py +0 -0
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/_workflows/_message_utils.py +0 -0
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/_workflows/_model_utils.py +0 -0
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/_workflows/_state.py +0 -0
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/_workflows/_typing_utils.py +0 -0
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/_workflows/_validation.py +0 -0
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/_workflows/_viz.py +0 -0
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/_workflows/_workflow_builder.py +0 -0
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/a2a/__init__.py +0 -0
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/a2a/__init__.pyi +0 -0
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/amazon/__init__.py +0 -0
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/amazon/__init__.pyi +0 -0
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/anthropic/__init__.py +0 -0
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/anthropic/__init__.pyi +0 -0
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/chatkit/__init__.py +0 -0
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/chatkit/__init__.pyi +0 -0
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/declarative/__init__.py +0 -0
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/declarative/__init__.pyi +0 -0
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/devui/__init__.py +0 -0
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/devui/__init__.pyi +0 -0
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/exceptions.py +0 -0
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/foundry/__init__.py +0 -0
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/foundry/__init__.pyi +0 -0
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/gemini/__init__.py +0 -0
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/gemini/__init__.pyi +0 -0
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/github/__init__.py +0 -0
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/github/__init__.pyi +0 -0
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/google/__init__.py +0 -0
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/google/__init__.pyi +0 -0
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/hyperlight/__init__.py +0 -0
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/lab/__init__.py +0 -0
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/mem0/__init__.py +0 -0
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/mem0/__init__.pyi +0 -0
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/microsoft/__init__.py +0 -0
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/microsoft/__init__.pyi +0 -0
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/mistral/__init__.py +0 -0
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/mistral/__init__.pyi +0 -0
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/monty/__init__.py +0 -0
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/monty/__init__.pyi +0 -0
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/ollama/__init__.py +0 -0
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/ollama/__init__.pyi +0 -0
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/openai/__init__.py +0 -0
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/openai/__init__.pyi +0 -0
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/orchestrations/__init__.py +0 -0
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/orchestrations/__init__.pyi +0 -0
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/py.typed +0 -0
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/tools/__init__.py +0 -0
- {agent_framework_core-1.16.0 → agent_framework_core-1.18.0}/agent_framework/tools/__init__.pyi +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: agent-framework-core
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.18.0
|
|
4
4
|
Summary: Microsoft Agent Framework for building AI Agents with Python. This is the core package that has all the core abstractions and implementations.
|
|
5
5
|
Author-email: Microsoft <af-support@microsoft.com>
|
|
6
6
|
Requires-Python: >=3.10
|
|
@@ -21,7 +21,6 @@ Requires-Dist: typing-extensions>=4.15.0,<5
|
|
|
21
21
|
Requires-Dist: pydantic>=2,<3
|
|
22
22
|
Requires-Dist: python-dotenv>=1,<2
|
|
23
23
|
Requires-Dist: opentelemetry-api>=1.39.0,<2
|
|
24
|
-
Requires-Dist: agent-hooks-sdk>=0.1.0a4,<0.2 ; extra == "agent-hooks"
|
|
25
24
|
Requires-Dist: mcp>=1.24.0,<2 ; extra == "all"
|
|
26
25
|
Requires-Dist: agent-framework-a2a ; extra == "all"
|
|
27
26
|
Requires-Dist: agent-framework-ag-ui ; extra == "all"
|
|
@@ -42,8 +41,7 @@ Requires-Dist: agent-framework-foundry-hosting ; extra == "all"
|
|
|
42
41
|
Requires-Dist: agent-framework-foundry-local ; extra == "all"
|
|
43
42
|
Requires-Dist: agent-framework-gemini ; extra == "all"
|
|
44
43
|
Requires-Dist: agent-framework-github-copilot ; extra == "all" and ( python_version >= '3.11')
|
|
45
|
-
Requires-Dist: agent-framework-hyperlight ; extra == "all" and ( (
|
|
46
|
-
Requires-Dist: agent-framework-lab ; extra == "all"
|
|
44
|
+
Requires-Dist: agent-framework-hyperlight ; extra == "all" and ( (sys_platform == 'linux' and platform_machine == 'x86_64') or (sys_platform == 'win32' and platform_machine == 'AMD64'))
|
|
47
45
|
Requires-Dist: agent-framework-mem0 ; extra == "all"
|
|
48
46
|
Requires-Dist: agent-framework-mistral ; extra == "all"
|
|
49
47
|
Requires-Dist: agent-framework-monty ; extra == "all"
|
|
@@ -57,7 +55,6 @@ Project-URL: homepage, https://aka.ms/agent-framework
|
|
|
57
55
|
Project-URL: issues, https://github.com/microsoft/agent-framework/issues
|
|
58
56
|
Project-URL: release_notes, https://github.com/microsoft/agent-framework/releases?q=tag%3Apython-1&expanded=true
|
|
59
57
|
Project-URL: source, https://github.com/microsoft/agent-framework/tree/main/python
|
|
60
|
-
Provides-Extra: agent-hooks
|
|
61
58
|
Provides-Extra: all
|
|
62
59
|
|
|
63
60
|
# Get Started with Microsoft Agent Framework
|
|
@@ -284,6 +284,37 @@ _LAZY_MODULE_EXPORTS: Final[Mapping[str, tuple[str, ...]]] = {
|
|
|
284
284
|
"validate_tool_mode",
|
|
285
285
|
"validate_tools",
|
|
286
286
|
),
|
|
287
|
+
"._in_memory": (
|
|
288
|
+
"InMemoryCollection",
|
|
289
|
+
"InMemoryStore",
|
|
290
|
+
),
|
|
291
|
+
"._vector_filters": (
|
|
292
|
+
"Filter",
|
|
293
|
+
"FilterGroup",
|
|
294
|
+
"FilterGroupOperator",
|
|
295
|
+
"FilterOperator",
|
|
296
|
+
"Param",
|
|
297
|
+
),
|
|
298
|
+
"._vectors": (
|
|
299
|
+
"DISTANCE_FUNCTION_DIRECTION_HELPER",
|
|
300
|
+
"BaseVectorCollection",
|
|
301
|
+
"BaseVectorSearch",
|
|
302
|
+
"BaseVectorStore",
|
|
303
|
+
"DistanceFunction",
|
|
304
|
+
"FieldTypes",
|
|
305
|
+
"GenerateVectors",
|
|
306
|
+
"IndexKind",
|
|
307
|
+
"SearchResponse",
|
|
308
|
+
"SearchResults",
|
|
309
|
+
"SearchType",
|
|
310
|
+
"SupportsVectorSearch",
|
|
311
|
+
"SupportsVectorUpsert",
|
|
312
|
+
"VectorStoreCollectionDefinition",
|
|
313
|
+
"VectorStoreField",
|
|
314
|
+
"create_vector_search_tool",
|
|
315
|
+
"register_vectorstoremodel",
|
|
316
|
+
"vectorstoremodel",
|
|
317
|
+
),
|
|
287
318
|
"._workflows._agent": ("WorkflowAgent",),
|
|
288
319
|
"._workflows._agent_executor": ("AgentExecutor", "AgentExecutorRequest", "AgentExecutorResponse"),
|
|
289
320
|
"._workflows._agent_utils": ("resolve_agent_id",),
|
|
@@ -343,7 +374,7 @@ _LAZY_MODULE_EXPORTS: Final[Mapping[str, tuple[str, ...]]] = {
|
|
|
343
374
|
"validate_workflow_graph",
|
|
344
375
|
),
|
|
345
376
|
"._workflows._viz": ("WorkflowViz",),
|
|
346
|
-
"._workflows._workflow": ("Workflow", "WorkflowRunResult"),
|
|
377
|
+
"._workflows._workflow": ("Workflow", "WorkflowInvocationKwargs", "WorkflowRunResult"),
|
|
347
378
|
"._workflows._workflow_builder": ("WorkflowBuilder",),
|
|
348
379
|
"._workflows._workflow_context": ("WorkflowContext",),
|
|
349
380
|
"._workflows._workflow_executor": (
|
|
@@ -371,6 +402,7 @@ __all__ = [
|
|
|
371
402
|
"DEFAULT_MODE_SOURCE_ID",
|
|
372
403
|
"DEFAULT_TODO_SOURCE_ID",
|
|
373
404
|
"DEFAULT_TOOL_APPROVAL_SOURCE_ID",
|
|
405
|
+
"DISTANCE_FUNCTION_DIRECTION_HELPER",
|
|
374
406
|
"EXCLUDED_KEY",
|
|
375
407
|
"EXCLUDE_REASON_KEY",
|
|
376
408
|
"GROUP_ANNOTATION_KEY",
|
|
@@ -412,6 +444,9 @@ __all__ = [
|
|
|
412
444
|
"BaseAgent",
|
|
413
445
|
"BaseChatClient",
|
|
414
446
|
"BaseEmbeddingClient",
|
|
447
|
+
"BaseVectorCollection",
|
|
448
|
+
"BaseVectorSearch",
|
|
449
|
+
"BaseVectorStore",
|
|
415
450
|
"CachingSkillsSource",
|
|
416
451
|
"Case",
|
|
417
452
|
"CharacterEstimatorTokenizer",
|
|
@@ -438,6 +473,7 @@ __all__ = [
|
|
|
438
473
|
"DeduplicatingSkillsSource",
|
|
439
474
|
"Default",
|
|
440
475
|
"DelegatingSkillsSource",
|
|
476
|
+
"DistanceFunction",
|
|
441
477
|
"Edge",
|
|
442
478
|
"EdgeCondition",
|
|
443
479
|
"EdgeDuplicationError",
|
|
@@ -456,6 +492,7 @@ __all__ = [
|
|
|
456
492
|
"ExperimentalFeature",
|
|
457
493
|
"FanInEdgeGroup",
|
|
458
494
|
"FanOutEdgeGroup",
|
|
495
|
+
"FieldTypes",
|
|
459
496
|
"FileAccessProvider",
|
|
460
497
|
"FileCheckpointStorage",
|
|
461
498
|
"FileHistoryProvider",
|
|
@@ -468,6 +505,10 @@ __all__ = [
|
|
|
468
505
|
"FileSkillsSource",
|
|
469
506
|
"FileStoreEntry",
|
|
470
507
|
"FileSystemAgentFileStore",
|
|
508
|
+
"Filter",
|
|
509
|
+
"FilterGroup",
|
|
510
|
+
"FilterGroupOperator",
|
|
511
|
+
"FilterOperator",
|
|
471
512
|
"FilteringSkillsSource",
|
|
472
513
|
"FinalT",
|
|
473
514
|
"FinishReason",
|
|
@@ -482,14 +523,18 @@ __all__ = [
|
|
|
482
523
|
"FunctionalWorkflow",
|
|
483
524
|
"FunctionalWorkflowAgent",
|
|
484
525
|
"FunctionalWorkflowDefinition",
|
|
526
|
+
"GenerateVectors",
|
|
485
527
|
"GeneratedEmbeddings",
|
|
486
528
|
"GraphConnectivityError",
|
|
487
529
|
"HistoryProvider",
|
|
488
530
|
"InMemoryAgentFileStore",
|
|
489
531
|
"InMemoryCheckpointStorage",
|
|
532
|
+
"InMemoryCollection",
|
|
490
533
|
"InMemoryHistoryProvider",
|
|
491
534
|
"InMemorySkillsSource",
|
|
535
|
+
"InMemoryStore",
|
|
492
536
|
"InProcRunnerContext",
|
|
537
|
+
"IndexKind",
|
|
493
538
|
"InlineSkill",
|
|
494
539
|
"InlineSkillResource",
|
|
495
540
|
"InlineSkillScript",
|
|
@@ -517,6 +562,7 @@ __all__ = [
|
|
|
517
562
|
"MiddlewareTypes",
|
|
518
563
|
"OuterFinalT",
|
|
519
564
|
"OuterUpdateT",
|
|
565
|
+
"Param",
|
|
520
566
|
"RawAgent",
|
|
521
567
|
"ReleaseCandidateFeature",
|
|
522
568
|
"ResponseStream",
|
|
@@ -527,6 +573,9 @@ __all__ = [
|
|
|
527
573
|
"Runner",
|
|
528
574
|
"RunnerContext",
|
|
529
575
|
"SamplingApprovalCallback",
|
|
576
|
+
"SearchResponse",
|
|
577
|
+
"SearchResults",
|
|
578
|
+
"SearchType",
|
|
530
579
|
"SecretString",
|
|
531
580
|
"SelectiveToolCallCompactionStrategy",
|
|
532
581
|
"ServiceSessionId",
|
|
@@ -555,6 +604,8 @@ __all__ = [
|
|
|
555
604
|
"SupportsImageGenerationTool",
|
|
556
605
|
"SupportsMCPTool",
|
|
557
606
|
"SupportsShellTool",
|
|
607
|
+
"SupportsVectorSearch",
|
|
608
|
+
"SupportsVectorUpsert",
|
|
558
609
|
"SupportsWebSearchTool",
|
|
559
610
|
"SwitchCaseEdgeGroup",
|
|
560
611
|
"SwitchCaseEdgeGroupCase",
|
|
@@ -580,6 +631,8 @@ __all__ = [
|
|
|
580
631
|
"UsageDetails",
|
|
581
632
|
"UserInputRequiredException",
|
|
582
633
|
"ValidationTypeEnum",
|
|
634
|
+
"VectorStoreCollectionDefinition",
|
|
635
|
+
"VectorStoreField",
|
|
583
636
|
"Workflow",
|
|
584
637
|
"WorkflowAgent",
|
|
585
638
|
"WorkflowBuilder",
|
|
@@ -593,6 +646,7 @@ __all__ = [
|
|
|
593
646
|
"WorkflowEventType",
|
|
594
647
|
"WorkflowException",
|
|
595
648
|
"WorkflowExecutor",
|
|
649
|
+
"WorkflowInvocationKwargs",
|
|
596
650
|
"WorkflowMessage",
|
|
597
651
|
"WorkflowRunResult",
|
|
598
652
|
"WorkflowRunState",
|
|
@@ -613,6 +667,7 @@ __all__ = [
|
|
|
613
667
|
"create_always_approve_tool_with_arguments_response",
|
|
614
668
|
"create_edge_runner",
|
|
615
669
|
"create_harness_agent",
|
|
670
|
+
"create_vector_search_tool",
|
|
616
671
|
"detect_media_type_from_base64",
|
|
617
672
|
"enqueue_messages",
|
|
618
673
|
"evaluate_agent",
|
|
@@ -636,6 +691,7 @@ __all__ = [
|
|
|
636
691
|
"prepend_instructions_to_messages",
|
|
637
692
|
"register_checkpoint_type",
|
|
638
693
|
"register_state_type",
|
|
694
|
+
"register_vectorstoremodel",
|
|
639
695
|
"resolve_agent_id",
|
|
640
696
|
"response_handler",
|
|
641
697
|
"set_agent_mode",
|
|
@@ -650,6 +706,7 @@ __all__ = [
|
|
|
650
706
|
"validate_tool_mode",
|
|
651
707
|
"validate_tools",
|
|
652
708
|
"validate_workflow_graph",
|
|
709
|
+
"vectorstoremodel",
|
|
653
710
|
"workflow",
|
|
654
711
|
]
|
|
655
712
|
|
|
@@ -123,6 +123,7 @@ from ._harness._tool_approval import (
|
|
|
123
123
|
create_always_approve_tool_response,
|
|
124
124
|
create_always_approve_tool_with_arguments_response,
|
|
125
125
|
)
|
|
126
|
+
from ._in_memory import InMemoryCollection, InMemoryStore
|
|
126
127
|
from ._mcp import (
|
|
127
128
|
MCPStdioTool,
|
|
128
129
|
MCPStreamableHTTPTool,
|
|
@@ -250,6 +251,27 @@ from ._types import (
|
|
|
250
251
|
validate_tool_mode,
|
|
251
252
|
validate_tools,
|
|
252
253
|
)
|
|
254
|
+
from ._vector_filters import Filter, FilterGroup, FilterGroupOperator, FilterOperator, Param
|
|
255
|
+
from ._vectors import (
|
|
256
|
+
DISTANCE_FUNCTION_DIRECTION_HELPER,
|
|
257
|
+
BaseVectorCollection,
|
|
258
|
+
BaseVectorSearch,
|
|
259
|
+
BaseVectorStore,
|
|
260
|
+
DistanceFunction,
|
|
261
|
+
FieldTypes,
|
|
262
|
+
GenerateVectors,
|
|
263
|
+
IndexKind,
|
|
264
|
+
SearchResponse,
|
|
265
|
+
SearchResults,
|
|
266
|
+
SearchType,
|
|
267
|
+
SupportsVectorSearch,
|
|
268
|
+
SupportsVectorUpsert,
|
|
269
|
+
VectorStoreCollectionDefinition,
|
|
270
|
+
VectorStoreField,
|
|
271
|
+
create_vector_search_tool,
|
|
272
|
+
register_vectorstoremodel,
|
|
273
|
+
vectorstoremodel,
|
|
274
|
+
)
|
|
253
275
|
from ._workflows._agent import WorkflowAgent
|
|
254
276
|
from ._workflows._agent_executor import AgentExecutor, AgentExecutorRequest, AgentExecutorResponse
|
|
255
277
|
from ._workflows._agent_utils import resolve_agent_id
|
|
@@ -306,7 +328,7 @@ from ._workflows._validation import (
|
|
|
306
328
|
validate_workflow_graph,
|
|
307
329
|
)
|
|
308
330
|
from ._workflows._viz import WorkflowViz
|
|
309
|
-
from ._workflows._workflow import Workflow, WorkflowRunResult
|
|
331
|
+
from ._workflows._workflow import Workflow, WorkflowInvocationKwargs, WorkflowRunResult
|
|
310
332
|
from ._workflows._workflow_builder import WorkflowBuilder
|
|
311
333
|
from ._workflows._workflow_context import WorkflowContext
|
|
312
334
|
from ._workflows._workflow_executor import SubWorkflowRequestMessage, SubWorkflowResponseMessage, WorkflowExecutor
|
|
@@ -335,6 +357,7 @@ __all__ = [
|
|
|
335
357
|
"DEFAULT_MODE_SOURCE_ID",
|
|
336
358
|
"DEFAULT_TODO_SOURCE_ID",
|
|
337
359
|
"DEFAULT_TOOL_APPROVAL_SOURCE_ID",
|
|
360
|
+
"DISTANCE_FUNCTION_DIRECTION_HELPER",
|
|
338
361
|
"EXCLUDED_KEY",
|
|
339
362
|
"EXCLUDE_REASON_KEY",
|
|
340
363
|
"GROUP_ANNOTATION_KEY",
|
|
@@ -376,6 +399,9 @@ __all__ = [
|
|
|
376
399
|
"BaseAgent",
|
|
377
400
|
"BaseChatClient",
|
|
378
401
|
"BaseEmbeddingClient",
|
|
402
|
+
"BaseVectorCollection",
|
|
403
|
+
"BaseVectorSearch",
|
|
404
|
+
"BaseVectorStore",
|
|
379
405
|
"CachingSkillsSource",
|
|
380
406
|
"Case",
|
|
381
407
|
"CharacterEstimatorTokenizer",
|
|
@@ -402,6 +428,7 @@ __all__ = [
|
|
|
402
428
|
"DeduplicatingSkillsSource",
|
|
403
429
|
"Default",
|
|
404
430
|
"DelegatingSkillsSource",
|
|
431
|
+
"DistanceFunction",
|
|
405
432
|
"Edge",
|
|
406
433
|
"EdgeCondition",
|
|
407
434
|
"EdgeDuplicationError",
|
|
@@ -420,6 +447,7 @@ __all__ = [
|
|
|
420
447
|
"ExperimentalFeature",
|
|
421
448
|
"FanInEdgeGroup",
|
|
422
449
|
"FanOutEdgeGroup",
|
|
450
|
+
"FieldTypes",
|
|
423
451
|
"FileAccessProvider",
|
|
424
452
|
"FileCheckpointStorage",
|
|
425
453
|
"FileHistoryProvider",
|
|
@@ -432,6 +460,10 @@ __all__ = [
|
|
|
432
460
|
"FileSkillsSource",
|
|
433
461
|
"FileStoreEntry",
|
|
434
462
|
"FileSystemAgentFileStore",
|
|
463
|
+
"Filter",
|
|
464
|
+
"FilterGroup",
|
|
465
|
+
"FilterGroupOperator",
|
|
466
|
+
"FilterOperator",
|
|
435
467
|
"FilteringSkillsSource",
|
|
436
468
|
"FinalT",
|
|
437
469
|
"FinishReason",
|
|
@@ -446,14 +478,18 @@ __all__ = [
|
|
|
446
478
|
"FunctionalWorkflow",
|
|
447
479
|
"FunctionalWorkflowAgent",
|
|
448
480
|
"FunctionalWorkflowDefinition",
|
|
481
|
+
"GenerateVectors",
|
|
449
482
|
"GeneratedEmbeddings",
|
|
450
483
|
"GraphConnectivityError",
|
|
451
484
|
"HistoryProvider",
|
|
452
485
|
"InMemoryAgentFileStore",
|
|
453
486
|
"InMemoryCheckpointStorage",
|
|
487
|
+
"InMemoryCollection",
|
|
454
488
|
"InMemoryHistoryProvider",
|
|
455
489
|
"InMemorySkillsSource",
|
|
490
|
+
"InMemoryStore",
|
|
456
491
|
"InProcRunnerContext",
|
|
492
|
+
"IndexKind",
|
|
457
493
|
"InlineSkill",
|
|
458
494
|
"InlineSkillResource",
|
|
459
495
|
"InlineSkillScript",
|
|
@@ -481,6 +517,7 @@ __all__ = [
|
|
|
481
517
|
"MiddlewareTypes",
|
|
482
518
|
"OuterFinalT",
|
|
483
519
|
"OuterUpdateT",
|
|
520
|
+
"Param",
|
|
484
521
|
"RawAgent",
|
|
485
522
|
"ReleaseCandidateFeature",
|
|
486
523
|
"ResponseStream",
|
|
@@ -491,6 +528,9 @@ __all__ = [
|
|
|
491
528
|
"Runner",
|
|
492
529
|
"RunnerContext",
|
|
493
530
|
"SamplingApprovalCallback",
|
|
531
|
+
"SearchResponse",
|
|
532
|
+
"SearchResults",
|
|
533
|
+
"SearchType",
|
|
494
534
|
"SecretString",
|
|
495
535
|
"SelectiveToolCallCompactionStrategy",
|
|
496
536
|
"ServiceSessionId",
|
|
@@ -519,6 +559,8 @@ __all__ = [
|
|
|
519
559
|
"SupportsImageGenerationTool",
|
|
520
560
|
"SupportsMCPTool",
|
|
521
561
|
"SupportsShellTool",
|
|
562
|
+
"SupportsVectorSearch",
|
|
563
|
+
"SupportsVectorUpsert",
|
|
522
564
|
"SupportsWebSearchTool",
|
|
523
565
|
"SwitchCaseEdgeGroup",
|
|
524
566
|
"SwitchCaseEdgeGroupCase",
|
|
@@ -544,6 +586,8 @@ __all__ = [
|
|
|
544
586
|
"UsageDetails",
|
|
545
587
|
"UserInputRequiredException",
|
|
546
588
|
"ValidationTypeEnum",
|
|
589
|
+
"VectorStoreCollectionDefinition",
|
|
590
|
+
"VectorStoreField",
|
|
547
591
|
"Workflow",
|
|
548
592
|
"WorkflowAgent",
|
|
549
593
|
"WorkflowBuilder",
|
|
@@ -557,6 +601,7 @@ __all__ = [
|
|
|
557
601
|
"WorkflowEventType",
|
|
558
602
|
"WorkflowException",
|
|
559
603
|
"WorkflowExecutor",
|
|
604
|
+
"WorkflowInvocationKwargs",
|
|
560
605
|
"WorkflowMessage",
|
|
561
606
|
"WorkflowRunResult",
|
|
562
607
|
"WorkflowRunState",
|
|
@@ -577,6 +622,7 @@ __all__ = [
|
|
|
577
622
|
"create_always_approve_tool_with_arguments_response",
|
|
578
623
|
"create_edge_runner",
|
|
579
624
|
"create_harness_agent",
|
|
625
|
+
"create_vector_search_tool",
|
|
580
626
|
"detect_media_type_from_base64",
|
|
581
627
|
"enqueue_messages",
|
|
582
628
|
"evaluate_agent",
|
|
@@ -600,6 +646,7 @@ __all__ = [
|
|
|
600
646
|
"prepend_instructions_to_messages",
|
|
601
647
|
"register_checkpoint_type",
|
|
602
648
|
"register_state_type",
|
|
649
|
+
"register_vectorstoremodel",
|
|
603
650
|
"resolve_agent_id",
|
|
604
651
|
"response_handler",
|
|
605
652
|
"set_agent_mode",
|
|
@@ -614,5 +661,6 @@ __all__ = [
|
|
|
614
661
|
"validate_tool_mode",
|
|
615
662
|
"validate_tools",
|
|
616
663
|
"validate_workflow_graph",
|
|
664
|
+
"vectorstoremodel",
|
|
617
665
|
"workflow",
|
|
618
666
|
]
|
|
@@ -93,7 +93,7 @@ per-run points and the host owns the session boundaries.
|
|
|
93
93
|
|
|
94
94
|
The ``agent-hooks-sdk`` dependency is optional: importing this module (and the lazy root
|
|
95
95
|
exports) works without it, and the factories raise a descriptive ``ModuleNotFoundError``
|
|
96
|
-
when the SDK is missing. Install it via ``pip install agent-
|
|
96
|
+
when the SDK is missing. Install it via ``pip install agent-hooks-sdk``.
|
|
97
97
|
"""
|
|
98
98
|
|
|
99
99
|
from __future__ import annotations
|
|
@@ -162,7 +162,7 @@ _DEFAULT_TIMEOUT = 5.0
|
|
|
162
162
|
|
|
163
163
|
_SDK_MISSING_MESSAGE = (
|
|
164
164
|
"The agent-hooks middleware requires the optional `agent-hooks-sdk` package. "
|
|
165
|
-
"Please install `
|
|
165
|
+
"Please install it with `pip install agent-hooks-sdk`."
|
|
166
166
|
)
|
|
167
167
|
|
|
168
168
|
_TRIO_REQUIRED_MESSAGE = (
|
|
@@ -191,7 +191,7 @@ def _require_sdk() -> None:
|
|
|
191
191
|
"""Import the SDK surface this module uses at runtime, with a helpful install hint.
|
|
192
192
|
|
|
193
193
|
Only a genuinely missing ``agent_hooks`` package is translated into the
|
|
194
|
-
|
|
194
|
+
SDK installation message; anything else (a broken installation, an incompatible
|
|
195
195
|
SDK version missing symbols, a failing transitive import) propagates unchanged so
|
|
196
196
|
real breakage is not masked as a missing extra.
|
|
197
197
|
"""
|
|
@@ -862,23 +862,99 @@ def _agent_updates_from_response(response: AgentResponse[Any]) -> list[AgentResp
|
|
|
862
862
|
return updates
|
|
863
863
|
|
|
864
864
|
|
|
865
|
-
def
|
|
866
|
-
"""
|
|
867
|
-
|
|
865
|
+
def _normalized_tools(tools: Any, *, point: str) -> list[Any]:
|
|
866
|
+
"""Normalize a tools value for projection; empty (with a warning) when it cannot be.
|
|
867
|
+
|
|
868
|
+
Everything — including the emptiness check inside ``normalize_tools`` — runs under
|
|
869
|
+
the guard, so a tools container whose ``__bool__``/``__len__``/``__iter__`` raises
|
|
870
|
+
degrades to omitting the projection instead of aborting the emission mid-run.
|
|
871
|
+
"""
|
|
872
|
+
from ._tools import normalize_tools
|
|
868
873
|
|
|
869
|
-
|
|
870
|
-
|
|
874
|
+
try:
|
|
875
|
+
return list(normalize_tools(tools))
|
|
876
|
+
except Exception:
|
|
877
|
+
logger.warning("agent-hooks could not normalize the tools for the %s projection.", point)
|
|
871
878
|
return []
|
|
879
|
+
|
|
880
|
+
|
|
881
|
+
def _projected_tool_name(item: Any) -> str:
|
|
882
|
+
"""Project a tool's display name; hosted-tool mappings fall back to their ``type``."""
|
|
883
|
+
from ._tools import _get_tool_name # type: ignore[reportPrivateUsage]
|
|
884
|
+
|
|
885
|
+
fallback = type(item).__name__
|
|
886
|
+
name = _get_tool_name(item)
|
|
887
|
+
if name:
|
|
888
|
+
return name
|
|
889
|
+
if isinstance(item, Mapping):
|
|
890
|
+
# Hosted-tool mappings carry top-level fields (no nested "function"), e.g.
|
|
891
|
+
# {"type": "web_search"} or {"type": "web_search_20250305", "name": "web_search"}.
|
|
892
|
+
mapping = cast("Mapping[str, Any]", item)
|
|
893
|
+
for key in ("name", "type"):
|
|
894
|
+
value = mapping.get(key)
|
|
895
|
+
if isinstance(value, str) and value:
|
|
896
|
+
return value
|
|
897
|
+
return fallback
|
|
898
|
+
|
|
899
|
+
|
|
900
|
+
def _tool_description(item: Any) -> str | None:
|
|
901
|
+
"""Extract a tool description from a tool object or dict tool definition."""
|
|
902
|
+
if isinstance(item, Mapping):
|
|
903
|
+
mapping = cast("Mapping[str, Any]", item)
|
|
904
|
+
function = mapping.get("function")
|
|
905
|
+
# Function-tool dicts nest the description; hosted-tool mappings keep it top-level.
|
|
906
|
+
description = (
|
|
907
|
+
cast("Mapping[str, Any]", function).get("description")
|
|
908
|
+
if isinstance(function, Mapping)
|
|
909
|
+
else mapping.get("description")
|
|
910
|
+
)
|
|
911
|
+
return description if isinstance(description, str) else None
|
|
912
|
+
description = getattr(item, "description", None)
|
|
913
|
+
return description if isinstance(description, str) else None
|
|
914
|
+
|
|
915
|
+
|
|
916
|
+
def _tool_names(context: AgentContext) -> list[str]:
|
|
917
|
+
"""Project the run-start tool names for ``agent_startup`` (spec ``tools_registered``).
|
|
918
|
+
|
|
919
|
+
The framework owns the run-start resolution — ``AgentContext._resolve_run_start_tools``
|
|
920
|
+
returns the agent-declared tools plus this invocation's run-level tools (the named
|
|
921
|
+
``tools`` parameter takes precedence over a ``tools`` entry in the options mapping),
|
|
922
|
+
already normalized — so this helper is projection only. This is deliberately the
|
|
923
|
+
run-start snapshot: tools registered dynamically during the run (for example by
|
|
924
|
+
context providers during run preparation, or by MCP servers whose functions expand
|
|
925
|
+
at connect time) cannot be known at ``agent_startup`` time; they surface in each
|
|
926
|
+
``pre_model_call`` emission's ``tools`` projection (the completed per-call set) and
|
|
927
|
+
are bracketed by ``pre_tool_call``/``post_tool_call`` like any other tool when
|
|
928
|
+
invoked. An unresolvable set degrades to a warning and an empty snapshot rather
|
|
929
|
+
than aborting the emission.
|
|
930
|
+
"""
|
|
872
931
|
try:
|
|
873
|
-
|
|
932
|
+
resolved = context._resolve_run_start_tools() # pyright: ignore[reportPrivateUsage]
|
|
874
933
|
except Exception:
|
|
875
|
-
logger.warning("agent-hooks could not
|
|
934
|
+
logger.warning("agent-hooks could not resolve the run-start tools for the agent_startup projection.")
|
|
876
935
|
return []
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
936
|
+
return [_projected_tool_name(item) for item in resolved]
|
|
937
|
+
|
|
938
|
+
|
|
939
|
+
def _pre_model_call_tools(options: Mapping[str, Any]) -> list[dict[str, Any]] | None:
|
|
940
|
+
"""Project the per-call effective tool set for ``pre_model_call`` (spec ``tools``).
|
|
941
|
+
|
|
942
|
+
This is the completed set for this model call — the run-start tools plus anything
|
|
943
|
+
registered during the run (context-provider tools, connected MCP-server functions,
|
|
944
|
+
progressive tool exposure) — whereas ``agent_startup``'s ``tools_registered`` is the
|
|
945
|
+
run-start snapshot. Entries carry ``{"name", "description"?}`` (description omitted
|
|
946
|
+
when the tool has none). Returns ``None`` — the spec's optional field is omitted —
|
|
947
|
+
when the call offers no tools or the set cannot be projected, so an unprojectable
|
|
948
|
+
set is never misreported as "no tools".
|
|
949
|
+
"""
|
|
950
|
+
projected: list[dict[str, Any]] = []
|
|
951
|
+
for item in _normalized_tools(options.get("tools"), point="pre_model_call"):
|
|
952
|
+
entry: dict[str, Any] = {"name": _projected_tool_name(item)}
|
|
953
|
+
description = _tool_description(item)
|
|
954
|
+
if description:
|
|
955
|
+
entry["description"] = description
|
|
956
|
+
projected.append(entry)
|
|
957
|
+
return projected or None
|
|
882
958
|
|
|
883
959
|
|
|
884
960
|
def _is_host_error(record: InterceptionRecord) -> bool:
|
|
@@ -1269,7 +1345,7 @@ class _AgentHooksChatMiddleware(_AgentHooksMiddlewareBase, ChatMiddleware):
|
|
|
1269
1345
|
model_id = str(options.get("model") or type(context.client).__name__)
|
|
1270
1346
|
before = _ModelRequestCodec.to_wire(context.messages)
|
|
1271
1347
|
outcome: EmitOutcome = await state.emitter.emit(
|
|
1272
|
-
state.builder.pre_model_call(model_id=model_id, messages=before)
|
|
1348
|
+
state.builder.pre_model_call(model_id=model_id, messages=before, tools=_pre_model_call_tools(options))
|
|
1273
1349
|
)
|
|
1274
1350
|
transformed_messages = _ModelRequestCodec.write_back(context.messages, before, outcome.target)
|
|
1275
1351
|
if transformed_messages is not None:
|
|
@@ -31,6 +31,8 @@ from ._middleware import (
|
|
|
31
31
|
FunctionInvocationContext,
|
|
32
32
|
MiddlewareTypes,
|
|
33
33
|
_as_middleware_list, # pyright: ignore[reportPrivateUsage]
|
|
34
|
+
_copy_middleware_sequence, # pyright: ignore[reportPrivateUsage]
|
|
35
|
+
_select_run_level_tools, # pyright: ignore[reportPrivateUsage]
|
|
34
36
|
categorize_middleware,
|
|
35
37
|
)
|
|
36
38
|
from ._serialization import SerializationMixin
|
|
@@ -439,7 +441,7 @@ class BaseAgent(SerializationMixin):
|
|
|
439
441
|
name: str | None = None,
|
|
440
442
|
description: str | None = None,
|
|
441
443
|
context_providers: Sequence[ContextProvider] | None = None,
|
|
442
|
-
middleware:
|
|
444
|
+
middleware: Sequence[MiddlewareTypes] | None = None,
|
|
443
445
|
additional_properties: MutableMapping[str, Any] | None = None,
|
|
444
446
|
) -> None:
|
|
445
447
|
"""Initialize a BaseAgent instance.
|
|
@@ -450,10 +452,8 @@ class BaseAgent(SerializationMixin):
|
|
|
450
452
|
name: The name of the agent, can be None.
|
|
451
453
|
description: The description of the agent.
|
|
452
454
|
context_providers: Context providers to include during agent invocation.
|
|
453
|
-
middleware: List of middleware
|
|
454
|
-
|
|
455
|
-
constructor copies the sequence; assign to or mutate the
|
|
456
|
-
``middleware`` attribute for post-construction changes.
|
|
455
|
+
middleware: List of middleware. The constructor copies the sequence; assign
|
|
456
|
+
to or mutate the ``middleware`` attribute for post-construction changes.
|
|
457
457
|
additional_properties: Additional properties set on the agent.
|
|
458
458
|
"""
|
|
459
459
|
if id is None:
|
|
@@ -462,11 +462,8 @@ class BaseAgent(SerializationMixin):
|
|
|
462
462
|
self.name = name
|
|
463
463
|
self.description = description
|
|
464
464
|
self.context_providers: list[ContextProvider] = list(context_providers or [])
|
|
465
|
-
# Canonicalize storage: the bare-source rule (a single middleware object or a
|
|
466
|
-
# MiddlewareBundle is one element) is owned by _as_middleware_list; storing a
|
|
467
|
-
# normalized list keeps the declared attribute type honest.
|
|
468
465
|
self.middleware: list[MiddlewareTypes] | None = (
|
|
469
|
-
|
|
466
|
+
_copy_middleware_sequence(middleware) if middleware is not None else None
|
|
470
467
|
)
|
|
471
468
|
self.additional_properties: dict[str, Any] = cast(dict[str, Any], additional_properties or {})
|
|
472
469
|
|
|
@@ -819,7 +816,7 @@ class RawAgent(BaseAgent, Generic[OptionsCoT]):
|
|
|
819
816
|
tools: ToolTypes | Callable[..., Any] | Sequence[ToolTypes | Callable[..., Any]] | None = None,
|
|
820
817
|
default_options: OptionsCoT | None = None,
|
|
821
818
|
context_providers: Sequence[ContextProvider] | None = None,
|
|
822
|
-
middleware:
|
|
819
|
+
middleware: Sequence[MiddlewareTypes] | None = None,
|
|
823
820
|
require_per_service_call_history_persistence: bool = False,
|
|
824
821
|
compaction_strategy: CompactionStrategy | None = None,
|
|
825
822
|
tokenizer: TokenizerProtocol | None = None,
|
|
@@ -838,8 +835,6 @@ class RawAgent(BaseAgent, Generic[OptionsCoT]):
|
|
|
838
835
|
description: A brief description of the agent's purpose.
|
|
839
836
|
context_providers: Context providers to include during agent invocation.
|
|
840
837
|
middleware: List of middleware to intercept agent and function invocations.
|
|
841
|
-
A single middleware object (including a ``MiddlewareBundle``) is
|
|
842
|
-
treated as a one-element list.
|
|
843
838
|
require_per_service_call_history_persistence: When True (and a HistoryProvider is
|
|
844
839
|
present), the provider always persists history via per-service-call middleware,
|
|
845
840
|
regardless of whether the client stores history server-side. If the client does
|
|
@@ -1365,8 +1360,13 @@ class RawAgent(BaseAgent, Generic[OptionsCoT]):
|
|
|
1365
1360
|
opts = dict(options) if options else {}
|
|
1366
1361
|
existing_additional_args: dict[str, Any] = opts.pop("additional_function_arguments", None) or {}
|
|
1367
1362
|
|
|
1368
|
-
#
|
|
1369
|
-
|
|
1363
|
+
# Run-level tools: the named parameter takes precedence over an options entry
|
|
1364
|
+
# (_select_run_level_tools is the framework's single statement of that rule,
|
|
1365
|
+
# shared with the middleware layer's run-start resolution). The options entry
|
|
1366
|
+
# is consumed either way, so a losing options["tools"] can never ride the
|
|
1367
|
+
# remaining options into the request and silently override the resolved list.
|
|
1368
|
+
tools_ = _select_run_level_tools(tools, opts)
|
|
1369
|
+
opts.pop("tools", None)
|
|
1370
1370
|
|
|
1371
1371
|
input_messages = normalize_messages(messages)
|
|
1372
1372
|
|
|
@@ -1808,7 +1808,7 @@ class Agent(
|
|
|
1808
1808
|
*,
|
|
1809
1809
|
stream: Literal[False] = ...,
|
|
1810
1810
|
session: AgentSession | None = None,
|
|
1811
|
-
middleware:
|
|
1811
|
+
middleware: Sequence[MiddlewareTypes] | None = None,
|
|
1812
1812
|
tools: ToolTypes | Callable[..., Any] | Sequence[ToolTypes | Callable[..., Any]] | None = None,
|
|
1813
1813
|
options: ChatOptions[ResponseModelBoundT],
|
|
1814
1814
|
compaction_strategy: CompactionStrategy | None = None,
|
|
@@ -1824,7 +1824,7 @@ class Agent(
|
|
|
1824
1824
|
*,
|
|
1825
1825
|
stream: Literal[False] = ...,
|
|
1826
1826
|
session: AgentSession | None = None,
|
|
1827
|
-
middleware:
|
|
1827
|
+
middleware: Sequence[MiddlewareTypes] | None = None,
|
|
1828
1828
|
tools: ToolTypes | Callable[..., Any] | Sequence[ToolTypes | Callable[..., Any]] | None = None,
|
|
1829
1829
|
options: OptionsCoT | ChatOptions[None] | None = None,
|
|
1830
1830
|
compaction_strategy: CompactionStrategy | None = None,
|
|
@@ -1840,7 +1840,7 @@ class Agent(
|
|
|
1840
1840
|
*,
|
|
1841
1841
|
stream: Literal[True],
|
|
1842
1842
|
session: AgentSession | None = None,
|
|
1843
|
-
middleware:
|
|
1843
|
+
middleware: Sequence[MiddlewareTypes] | None = None,
|
|
1844
1844
|
tools: ToolTypes | Callable[..., Any] | Sequence[ToolTypes | Callable[..., Any]] | None = None,
|
|
1845
1845
|
options: OptionsCoT | ChatOptions[Any] | None = None,
|
|
1846
1846
|
compaction_strategy: CompactionStrategy | None = None,
|
|
@@ -1855,7 +1855,7 @@ class Agent(
|
|
|
1855
1855
|
*,
|
|
1856
1856
|
stream: bool = False,
|
|
1857
1857
|
session: AgentSession | None = None,
|
|
1858
|
-
middleware:
|
|
1858
|
+
middleware: Sequence[MiddlewareTypes] | None = None,
|
|
1859
1859
|
tools: ToolTypes | Callable[..., Any] | Sequence[ToolTypes | Callable[..., Any]] | None = None,
|
|
1860
1860
|
options: OptionsCoT | ChatOptions[Any] | None = None,
|
|
1861
1861
|
compaction_strategy: CompactionStrategy | None = None,
|
|
@@ -1893,7 +1893,7 @@ class Agent(
|
|
|
1893
1893
|
tools: ToolTypes | Callable[..., Any] | Sequence[ToolTypes | Callable[..., Any]] | None = None,
|
|
1894
1894
|
default_options: OptionsCoT | None = None,
|
|
1895
1895
|
context_providers: Sequence[ContextProvider] | None = None,
|
|
1896
|
-
middleware:
|
|
1896
|
+
middleware: Sequence[MiddlewareTypes] | None = None,
|
|
1897
1897
|
require_per_service_call_history_persistence: bool = False,
|
|
1898
1898
|
compaction_strategy: CompactionStrategy | None = None,
|
|
1899
1899
|
tokenizer: TokenizerProtocol | None = None,
|
|
@@ -96,6 +96,10 @@ class SupportsChatGetResponse(Protocol[OptionsContraT]):
|
|
|
96
96
|
Protocols use structural subtyping (duck typing). Classes don't need
|
|
97
97
|
to explicitly inherit from this protocol to be considered compatible.
|
|
98
98
|
|
|
99
|
+
Implementing this protocol does not by itself guarantee that an instance
|
|
100
|
+
can be reused across concurrent calls. Check the concrete client's
|
|
101
|
+
concurrency contract before sharing it.
|
|
102
|
+
|
|
99
103
|
Examples:
|
|
100
104
|
.. code-block:: python
|
|
101
105
|
|
|
@@ -578,7 +582,7 @@ class BaseChatClient(SerializationMixin, ABC, Generic[OptionsCoT]):
|
|
|
578
582
|
tools: ToolTypes | Callable[..., Any] | Sequence[ToolTypes | Callable[..., Any]] | None = None,
|
|
579
583
|
default_options: OptionsCoT | Mapping[str, Any] | None = None,
|
|
580
584
|
context_providers: Sequence[Any] | None = None,
|
|
581
|
-
middleware:
|
|
585
|
+
middleware: Sequence[MiddlewareTypes] | None = None,
|
|
582
586
|
require_per_service_call_history_persistence: bool = False,
|
|
583
587
|
compaction_strategy: CompactionStrategy | None = None,
|
|
584
588
|
tokenizer: TokenizerProtocol | None = None,
|