jaf-py 2.6.4__tar.gz → 2.6.6__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.
- {jaf_py-2.6.4 → jaf_py-2.6.6}/PKG-INFO +2 -2
- {jaf_py-2.6.4 → jaf_py-2.6.6}/README.md +1 -1
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf/__init__.py +1 -1
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf/core/agent_tool.py +89 -5
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf/core/tracing.py +1 -1
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf/core/types.py +7 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf_py.egg-info/PKG-INFO +2 -2
- {jaf_py-2.6.4 → jaf_py-2.6.6}/pyproject.toml +1 -1
- {jaf_py-2.6.4 → jaf_py-2.6.6}/LICENSE +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf/a2a/__init__.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf/a2a/agent.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf/a2a/agent_card.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf/a2a/client.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf/a2a/examples/__init__.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf/a2a/examples/client_example.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf/a2a/examples/integration_example.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf/a2a/examples/rag_demo/__init__.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf/a2a/examples/server_demo/__init__.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf/a2a/examples/server_example.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf/a2a/memory/__init__.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf/a2a/memory/cleanup.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf/a2a/memory/factory.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf/a2a/memory/providers/__init__.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf/a2a/memory/providers/composite.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf/a2a/memory/providers/in_memory.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf/a2a/memory/providers/postgres.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf/a2a/memory/providers/redis.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf/a2a/memory/serialization.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf/a2a/memory/tests/__init__.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf/a2a/memory/tests/run_comprehensive_tests.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf/a2a/memory/tests/test_cleanup.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf/a2a/memory/tests/test_serialization.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf/a2a/memory/tests/test_stress_concurrency.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf/a2a/memory/tests/test_task_lifecycle.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf/a2a/memory/types.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf/a2a/protocol.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf/a2a/server.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf/a2a/standalone_client.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf/a2a/tests/__init__.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf/a2a/tests/run_tests.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf/a2a/tests/test_agent.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf/a2a/tests/test_client.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf/a2a/tests/test_integration.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf/a2a/tests/test_protocol.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf/a2a/tests/test_types.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf/a2a/types.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf/cli.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf/core/__init__.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf/core/analytics.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf/core/checkpoint.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf/core/composition.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf/core/engine.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf/core/errors.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf/core/guardrails.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf/core/handoff.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf/core/parallel_agents.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf/core/performance.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf/core/proxy.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf/core/proxy_helpers.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf/core/regeneration.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf/core/state.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf/core/streaming.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf/core/tool_results.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf/core/tools.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf/core/workflows.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf/exceptions.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf/memory/__init__.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf/memory/approval_storage.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf/memory/factory.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf/memory/providers/__init__.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf/memory/providers/in_memory.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf/memory/providers/postgres.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf/memory/providers/redis.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf/memory/types.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf/memory/utils.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf/plugins/__init__.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf/plugins/base.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf/policies/__init__.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf/policies/handoff.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf/policies/validation.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf/providers/__init__.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf/providers/mcp.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf/providers/model.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf/server/__init__.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf/server/main.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf/server/server.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf/server/types.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf/utils/__init__.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf/utils/attachments.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf/utils/document_processor.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf/visualization/__init__.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf/visualization/example.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf/visualization/functional_core.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf/visualization/graphviz.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf/visualization/imperative_shell.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf/visualization/types.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf_py.egg-info/SOURCES.txt +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf_py.egg-info/dependency_links.txt +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf_py.egg-info/entry_points.txt +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf_py.egg-info/requires.txt +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/jaf_py.egg-info/top_level.txt +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/setup.cfg +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/setup.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/tests/test_a2a_deep.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/tests/test_a2a_examples.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/tests/test_api_reference_examples.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/tests/test_attachments.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/tests/test_callback_system_examples.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/tests/test_coffee_tool.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/tests/test_conversation_id_fix.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/tests/test_deployment_examples.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/tests/test_docs_code_examples.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/tests/test_engine.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/tests/test_engine_manual.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/tests/test_error_handling_examples.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/tests/test_getting_started_examples.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/tests/test_manual.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/tests/test_math_tool.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/tests/test_mcp_comprehensive.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/tests/test_mcp_docs.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/tests/test_mcp_real_functionality.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/tests/test_mcp_transports.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/tests/test_memory_system_examples.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/tests/test_model_providers_examples.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/tests/test_property_based.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/tests/test_proxy_simple.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/tests/test_redis_fixes.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/tests/test_redis_memory.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/tests/test_server_api_examples.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/tests/test_session_continuity.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/tests/test_streamable_http_mcp_example.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/tests/test_timeout_functionality.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/tests/test_tool_integration.py +0 -0
- {jaf_py-2.6.4 → jaf_py-2.6.6}/tests/test_validation.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: jaf-py
|
|
3
|
-
Version: 2.6.
|
|
3
|
+
Version: 2.6.6
|
|
4
4
|
Summary: A purely functional agent framework with immutable state and composable tools - Python implementation
|
|
5
5
|
Author: JAF Contributors
|
|
6
6
|
Maintainer: JAF Contributors
|
|
@@ -82,7 +82,7 @@ Dynamic: license-file
|
|
|
82
82
|
|
|
83
83
|
<!--  -->
|
|
84
84
|
|
|
85
|
-
[](https://github.com/xynehq/jaf-py)
|
|
86
86
|
[](https://www.python.org/)
|
|
87
87
|
[](https://xynehq.github.io/jaf-py/)
|
|
88
88
|
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
<!--  -->
|
|
4
4
|
|
|
5
|
-
[](https://github.com/xynehq/jaf-py)
|
|
6
6
|
[](https://www.python.org/)
|
|
7
7
|
[](https://xynehq.github.io/jaf-py/)
|
|
8
8
|
|
|
@@ -8,7 +8,6 @@ by other agents, enabling hierarchical agent orchestration patterns.
|
|
|
8
8
|
import asyncio
|
|
9
9
|
import json
|
|
10
10
|
import inspect
|
|
11
|
-
import inspect
|
|
12
11
|
import contextvars
|
|
13
12
|
from typing import Any, Callable, Dict, List, Optional, Union, Awaitable, TypeVar, get_type_hints
|
|
14
13
|
|
|
@@ -79,6 +78,7 @@ def create_agent_tool(
|
|
|
79
78
|
metadata: Optional[Dict[str, Any]] = None,
|
|
80
79
|
timeout: Optional[float] = None,
|
|
81
80
|
preserve_session: bool = False,
|
|
81
|
+
preserve_session_id: bool = False,
|
|
82
82
|
) -> Tool[AgentToolInput, Ctx]:
|
|
83
83
|
"""
|
|
84
84
|
Create a tool from an agent.
|
|
@@ -92,6 +92,10 @@ def create_agent_tool(
|
|
|
92
92
|
is_enabled: Whether the tool is enabled (bool, sync function, or async function)
|
|
93
93
|
metadata: Optional metadata for the tool
|
|
94
94
|
timeout: Optional timeout for tool execution
|
|
95
|
+
preserve_session: When True, inherit parent's conversation_id AND memory (shared session)
|
|
96
|
+
preserve_session_id: When True, inherit ONLY parent's conversation_id for tracing (no memory).
|
|
97
|
+
This allows subagent traces to appear together in Langfuse without
|
|
98
|
+
loading previous invocation history. Mutually exclusive with preserve_session.
|
|
95
99
|
|
|
96
100
|
Returns:
|
|
97
101
|
A Tool that wraps the agent execution
|
|
@@ -181,18 +185,98 @@ def create_agent_tool(
|
|
|
181
185
|
# Session inheritance is configurable via preserve_session.
|
|
182
186
|
# - When True: inherit parent's conversation_id and memory (shared memory/session)
|
|
183
187
|
# - When False: do not inherit (ephemeral, per-invocation sub-agent run)
|
|
188
|
+
#
|
|
189
|
+
# Model selection for subagents:
|
|
190
|
+
# - If subagent has its own model_config, use that model AND create appropriate provider
|
|
191
|
+
# - If subagent has no model_config, inherit parent's model_override and provider
|
|
192
|
+
# This allows subagents to run on different models than the parent agent
|
|
193
|
+
subagent_model_override = None
|
|
194
|
+
subagent_model_provider = parent_config.model_provider
|
|
195
|
+
|
|
196
|
+
if agent.model_config and agent.model_config.name:
|
|
197
|
+
subagent_model_name = agent.model_config.name
|
|
198
|
+
# Subagent has explicit model_config - create appropriate provider for it
|
|
199
|
+
# Use model_override to force the subagent's model
|
|
200
|
+
subagent_model_override = subagent_model_name
|
|
201
|
+
|
|
202
|
+
# Create provider based on model type
|
|
203
|
+
import os
|
|
204
|
+
if subagent_model_name.startswith("azure/"):
|
|
205
|
+
try:
|
|
206
|
+
from jaf.providers import make_litellm_sdk_provider
|
|
207
|
+
azure_api_key = os.getenv("AZURE_API_KEY")
|
|
208
|
+
azure_api_base = os.getenv("AZURE_API_BASE")
|
|
209
|
+
azure_api_version = os.getenv("AZURE_API_VERSION")
|
|
210
|
+
subagent_model_provider = make_litellm_sdk_provider(
|
|
211
|
+
model=subagent_model_name,
|
|
212
|
+
api_key=azure_api_key,
|
|
213
|
+
base_url=azure_api_base,
|
|
214
|
+
api_version=azure_api_version,
|
|
215
|
+
)
|
|
216
|
+
except Exception as e:
|
|
217
|
+
# Fallback to parent provider if Azure provider creation fails
|
|
218
|
+
subagent_model_provider = parent_config.model_provider
|
|
219
|
+
elif subagent_model_name.startswith("vertex_ai/"):
|
|
220
|
+
try:
|
|
221
|
+
from jaf.providers import make_litellm_sdk_provider
|
|
222
|
+
vertex_project = os.getenv("VERTEXAI_PROJECT")
|
|
223
|
+
vertex_location = os.getenv("VERTEXAI_LOCATION")
|
|
224
|
+
if not vertex_project or not vertex_location:
|
|
225
|
+
raise ValueError(
|
|
226
|
+
"VERTEXAI_PROJECT and VERTEXAI_LOCATION environment variables are required for vertex_ai/ models"
|
|
227
|
+
)
|
|
228
|
+
subagent_model_provider = make_litellm_sdk_provider(
|
|
229
|
+
model=subagent_model_name,
|
|
230
|
+
vertex_project=vertex_project,
|
|
231
|
+
vertex_location=vertex_location,
|
|
232
|
+
)
|
|
233
|
+
except Exception:
|
|
234
|
+
subagent_model_provider = parent_config.model_provider
|
|
235
|
+
elif subagent_model_name.startswith("glm"):
|
|
236
|
+
try:
|
|
237
|
+
from jaf.providers import make_litellm_provider
|
|
238
|
+
subagent_model_provider = make_litellm_provider(
|
|
239
|
+
base_url=os.getenv("LITELLM_BASE_URL"),
|
|
240
|
+
api_key=os.getenv("LITELLM_KEY")
|
|
241
|
+
)
|
|
242
|
+
except Exception:
|
|
243
|
+
subagent_model_provider = parent_config.model_provider
|
|
244
|
+
# For other models, use parent's provider (may work or may not)
|
|
245
|
+
else:
|
|
246
|
+
# No subagent model_config - inherit from parent
|
|
247
|
+
subagent_model_override = parent_config.model_override
|
|
248
|
+
subagent_model_provider = parent_config.model_provider
|
|
249
|
+
|
|
250
|
+
# Determine conversation_id and memory inheritance based on session preservation settings:
|
|
251
|
+
# - preserve_session=True: inherit both conversation_id AND memory (full shared session)
|
|
252
|
+
# - preserve_session_id=True: inherit ONLY conversation_id for tracing (no memory, stateless calls)
|
|
253
|
+
# - Both False: completely ephemeral sub-agent run
|
|
254
|
+
#
|
|
255
|
+
# preserve_session_id is useful when you want:
|
|
256
|
+
# 1. Subagent traces to appear together in Langfuse under the same conversation
|
|
257
|
+
# 2. But each subagent invocation to be stateless (no accumulated history from previous calls)
|
|
258
|
+
if preserve_session:
|
|
259
|
+
subagent_memory = parent_config.memory
|
|
260
|
+
subagent_conversation_id = parent_config.conversation_id
|
|
261
|
+
elif preserve_session_id:
|
|
262
|
+
subagent_memory = None # No memory inheritance - stateless
|
|
263
|
+
subagent_conversation_id = parent_config.conversation_id # Only for tracing
|
|
264
|
+
else:
|
|
265
|
+
subagent_memory = None
|
|
266
|
+
subagent_conversation_id = None
|
|
267
|
+
|
|
184
268
|
sub_config = RunConfig(
|
|
185
269
|
agent_registry={agent.name: agent, **parent_config.agent_registry},
|
|
186
|
-
model_provider=
|
|
270
|
+
model_provider=subagent_model_provider,
|
|
187
271
|
max_turns=max_turns or parent_config.max_turns,
|
|
188
|
-
model_override=
|
|
272
|
+
model_override=subagent_model_override,
|
|
189
273
|
initial_input_guardrails=parent_config.initial_input_guardrails,
|
|
190
274
|
final_output_guardrails=parent_config.final_output_guardrails,
|
|
191
275
|
on_event=parent_config.on_event,
|
|
192
276
|
before_llm_call=parent_config.before_llm_call,
|
|
193
277
|
after_llm_call=parent_config.after_llm_call,
|
|
194
|
-
memory=
|
|
195
|
-
conversation_id=
|
|
278
|
+
memory=subagent_memory,
|
|
279
|
+
conversation_id=subagent_conversation_id,
|
|
196
280
|
default_tool_timeout=parent_config.default_tool_timeout,
|
|
197
281
|
prefer_streaming=parent_config.prefer_streaming,
|
|
198
282
|
)
|
|
@@ -428,6 +428,7 @@ class Agent(Generic[Ctx, Out]):
|
|
|
428
428
|
metadata: Optional[Dict[str, Any]] = None,
|
|
429
429
|
timeout: Optional[float] = None,
|
|
430
430
|
preserve_session: bool = False,
|
|
431
|
+
preserve_session_id: bool = False,
|
|
431
432
|
) -> Tool[Any, Ctx]:
|
|
432
433
|
"""
|
|
433
434
|
Convert this agent into a tool that can be used by other agents.
|
|
@@ -440,6 +441,11 @@ class Agent(Generic[Ctx, Out]):
|
|
|
440
441
|
is_enabled: Whether the tool is enabled (bool, sync function, or async function)
|
|
441
442
|
metadata: Optional metadata for the tool
|
|
442
443
|
timeout: Optional timeout for the tool execution
|
|
444
|
+
preserve_session: When True, inherit parent's conversation_id AND memory (shared session)
|
|
445
|
+
preserve_session_id: When True, inherit ONLY parent's conversation_id for tracing (no memory).
|
|
446
|
+
This allows subagent traces to appear together in Langfuse without
|
|
447
|
+
loading previous invocation history. Useful for stateless subagent calls
|
|
448
|
+
that should still be grouped together in traces.
|
|
443
449
|
|
|
444
450
|
Returns:
|
|
445
451
|
A Tool that wraps this agent's execution
|
|
@@ -456,6 +462,7 @@ class Agent(Generic[Ctx, Out]):
|
|
|
456
462
|
metadata=metadata,
|
|
457
463
|
timeout=timeout,
|
|
458
464
|
preserve_session=preserve_session,
|
|
465
|
+
preserve_session_id=preserve_session_id,
|
|
459
466
|
)
|
|
460
467
|
|
|
461
468
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: jaf-py
|
|
3
|
-
Version: 2.6.
|
|
3
|
+
Version: 2.6.6
|
|
4
4
|
Summary: A purely functional agent framework with immutable state and composable tools - Python implementation
|
|
5
5
|
Author: JAF Contributors
|
|
6
6
|
Maintainer: JAF Contributors
|
|
@@ -82,7 +82,7 @@ Dynamic: license-file
|
|
|
82
82
|
|
|
83
83
|
<!--  -->
|
|
84
84
|
|
|
85
|
-
[](https://github.com/xynehq/jaf-py)
|
|
86
86
|
[](https://www.python.org/)
|
|
87
87
|
[](https://xynehq.github.io/jaf-py/)
|
|
88
88
|
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "jaf-py"
|
|
7
|
-
version = "2.6.
|
|
7
|
+
version = "2.6.6"
|
|
8
8
|
description = "A purely functional agent framework with immutable state and composable tools - Python implementation"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = "MIT"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|