traceAI-temporal 0.1.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.
@@ -0,0 +1,14 @@
1
+ """Thin configuration adapter for Temporal's native replay-safe OpenTelemetry."""
2
+
3
+ from ._configure import TemporalTracing, configure
4
+ from ._privacy import SafeSpanExporter
5
+ from ._session import WorkflowIdAsSession
6
+ from .version import __version__
7
+
8
+ __all__ = [
9
+ "SafeSpanExporter",
10
+ "TemporalTracing",
11
+ "WorkflowIdAsSession",
12
+ "__version__",
13
+ "configure",
14
+ ]
@@ -0,0 +1,282 @@
1
+ """Native Temporal provider setup and bounded, application-owned lifecycle."""
2
+
3
+ import atexit
4
+ import logging
5
+ import math
6
+ import os
7
+ import threading
8
+ from types import TracebackType
9
+ from urllib.parse import urlsplit
10
+
11
+ from fi_instrumentation.otel import BatchSpanProcessor
12
+ from opentelemetry import trace
13
+ from opentelemetry.exporter.otlp.proto.http import Compression
14
+ from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
15
+ from opentelemetry.sdk.resources import Resource
16
+ from opentelemetry.sdk.trace import SpanLimits
17
+ from opentelemetry.sdk.trace.export import SpanExporter
18
+ from temporalio.contrib.opentelemetry import (
19
+ OpenTelemetryPlugin,
20
+ ReplaySafeTracerProvider,
21
+ create_tracer_provider,
22
+ )
23
+ from typing_extensions import Self
24
+
25
+ from ._privacy import SafeSpanExporter
26
+ from ._session import WorkflowIdAsSession
27
+
28
+ _CONFIGURE_LOCK = threading.Lock()
29
+ _LOGGER = logging.getLogger(__name__)
30
+
31
+
32
+ def _positive(value, name):
33
+ if isinstance(value, bool) or not math.isfinite(value) or value <= 0:
34
+ raise ValueError(f"{name} must be finite and positive")
35
+
36
+
37
+ class TemporalTracing:
38
+ """Provider, native plugin, and bounded flush/shutdown.
39
+
40
+ Stop the worker before shutdown. A timeout returns False; it does not kill
41
+ an in-progress exporter. At most one flush and one shutdown task run, and
42
+ they are daemon threads so a broken exporter cannot hold process exit.
43
+ OpenTelemetry does not permit replacing a shut-down global provider.
44
+ """
45
+
46
+ def __init__(
47
+ self,
48
+ provider: ReplaySafeTracerProvider,
49
+ plugin: OpenTelemetryPlugin,
50
+ shutdown_timeout_millis: int,
51
+ ) -> None:
52
+ self.provider = provider
53
+ self.plugin = plugin
54
+ self._timeout = shutdown_timeout_millis
55
+ self._lock = threading.Lock()
56
+ self._flush_thread: threading.Thread | None = None
57
+ self._flush_result = False
58
+ self._shutdown_thread: threading.Thread | None = None
59
+ self._shutdown_result = False
60
+ self._closed = False
61
+ self._exit_hook = self.shutdown
62
+ atexit.register(self._exit_hook)
63
+
64
+ @property
65
+ def closed(self) -> bool:
66
+ return self._closed
67
+
68
+ def force_flush(self, timeout_millis: int = 3000) -> bool:
69
+ _positive(timeout_millis, "timeout_millis")
70
+ with self._lock:
71
+ if self._closed:
72
+ return False
73
+ if self._flush_thread is None or not self._flush_thread.is_alive():
74
+ self._flush_result = False
75
+
76
+ def flush():
77
+ try:
78
+ self._flush_result = bool(
79
+ self.provider.force_flush(timeout_millis)
80
+ )
81
+ except Exception: # noqa: BLE001 -- lifecycle failures must not escape into the application
82
+ self._flush_result = False
83
+ # Exception text and stacks may contain credentials/content.
84
+ _LOGGER.warning(
85
+ "Temporal tracing flush failed; details redacted"
86
+ )
87
+
88
+ self._flush_thread = threading.Thread(
89
+ target=flush, name="traceai-temporal-flush", daemon=True
90
+ )
91
+ self._flush_thread.start()
92
+ thread = self._flush_thread
93
+ thread.join(timeout_millis / 1000)
94
+ return not thread.is_alive() and self._flush_result
95
+
96
+ def shutdown(self, timeout_millis: int | None = None) -> bool:
97
+ timeout_millis = self._timeout if timeout_millis is None else timeout_millis
98
+ _positive(timeout_millis, "timeout_millis")
99
+ with self._lock:
100
+ if self._shutdown_thread is None:
101
+ self._closed = True
102
+ atexit.unregister(self._exit_hook)
103
+
104
+ def stop():
105
+ try:
106
+ # BatchSpanProcessor.shutdown drains ended spans. Do not end
107
+ # open workflow spans here: replay safety belongs to Temporal.
108
+ self.provider.shutdown()
109
+ self._shutdown_result = True
110
+ except Exception: # noqa: BLE001 -- lifecycle failures must not escape into the application
111
+ self._shutdown_result = False
112
+ _LOGGER.warning(
113
+ "Temporal tracing shutdown failed; details redacted"
114
+ )
115
+
116
+ self._shutdown_thread = threading.Thread(
117
+ target=stop, name="traceai-temporal-shutdown", daemon=True
118
+ )
119
+ self._shutdown_thread.start()
120
+ thread = self._shutdown_thread
121
+ thread.join(timeout_millis / 1000)
122
+ return not thread.is_alive() and self._shutdown_result
123
+
124
+ def __enter__(self) -> Self:
125
+ return self
126
+
127
+ def __exit__(
128
+ self,
129
+ exc_type: type[BaseException] | None,
130
+ exc_value: BaseException | None,
131
+ traceback: TracebackType | None,
132
+ ) -> None:
133
+ self.shutdown()
134
+
135
+
136
+ def configure(
137
+ *,
138
+ project_name: str | None = None,
139
+ base_url: str | None = None,
140
+ api_key: str | None = None,
141
+ secret_key: str | None = None,
142
+ capture_content: bool = False,
143
+ keep_error_text: bool = False,
144
+ compression: str = "none",
145
+ exporter: SpanExporter | None = None,
146
+ export_timeout: float = 3.0,
147
+ shutdown_timeout_millis: int = 3000,
148
+ max_queue_size: int = 2048,
149
+ max_export_batch_size: int = 512,
150
+ schedule_delay_millis: int = 1000,
151
+ max_content_length: int = 16384,
152
+ ) -> TemporalTracing:
153
+ """Configure once, before Client.connect(), in the starter and the worker.
154
+
155
+ Use handle.plugin on each client; workers inherit it from the client. The
156
+ native provider is registered globally; an existing global SDK provider is
157
+ rejected before an exporter is created. No model SDK is instrumented here.
158
+ Pass this provider to the one traceAI model instrumentor your activity uses.
159
+ Passing exporter bypasses endpoint/auth configuration and transfers ownership.
160
+ Do not import this module from workflow code.
161
+ """
162
+ project_name = (
163
+ project_name if project_name is not None else os.getenv("FI_PROJECT_NAME")
164
+ )
165
+ if not isinstance(project_name, str) or not project_name.strip():
166
+ raise ValueError("Set project_name or FI_PROJECT_NAME")
167
+ if not isinstance(capture_content, bool) or not isinstance(keep_error_text, bool):
168
+ raise TypeError("capture_content and keep_error_text must be booleans")
169
+ for value, name in (
170
+ (export_timeout, "export_timeout"),
171
+ (shutdown_timeout_millis, "shutdown_timeout_millis"),
172
+ (schedule_delay_millis, "schedule_delay_millis"),
173
+ (max_queue_size, "max_queue_size"),
174
+ (max_export_batch_size, "max_export_batch_size"),
175
+ (max_content_length, "max_content_length"),
176
+ ):
177
+ _positive(value, name)
178
+ if any(
179
+ not isinstance(value, int) or isinstance(value, bool)
180
+ for value in (max_queue_size, max_export_batch_size, max_content_length)
181
+ ):
182
+ raise ValueError("Queue, batch, and content limits must be integers")
183
+ if max_export_batch_size > max_queue_size:
184
+ raise ValueError("max_export_batch_size must not exceed max_queue_size")
185
+ if compression not in {"none", "gzip"}:
186
+ raise ValueError("compression must be 'none' or 'gzip'")
187
+
188
+ with _CONFIGURE_LOCK:
189
+ if not isinstance(trace.get_tracer_provider(), trace.ProxyTracerProvider):
190
+ raise RuntimeError( # noqa: TRY004 -- process state conflict, not a bad argument
191
+ "A global tracer provider already exists; call configure() once, before other instrumentation"
192
+ )
193
+ if exporter is None:
194
+ base_url = (
195
+ base_url
196
+ if base_url is not None
197
+ else os.getenv("FI_BASE_URL", "https://api.futureagi.com")
198
+ )
199
+ if not isinstance(base_url, str):
200
+ raise TypeError("base_url must be a string")
201
+ parsed = urlsplit(base_url)
202
+ if (
203
+ parsed.scheme not in {"https", "http"}
204
+ or not parsed.hostname
205
+ or parsed.username
206
+ or parsed.password
207
+ or parsed.query
208
+ or parsed.fragment
209
+ ):
210
+ raise ValueError(
211
+ "base_url must be an HTTP(S) origin or path, without credentials/query/fragment"
212
+ )
213
+ if parsed.scheme == "http" and parsed.hostname not in {
214
+ "localhost",
215
+ "127.0.0.1",
216
+ "::1",
217
+ }:
218
+ raise ValueError(
219
+ "Remote endpoints require HTTPS; HTTP is allowed only on loopback"
220
+ )
221
+ api_key = api_key if api_key is not None else os.getenv("FI_API_KEY")
222
+ secret_key = (
223
+ secret_key if secret_key is not None else os.getenv("FI_SECRET_KEY")
224
+ )
225
+ if not api_key or not secret_key:
226
+ raise ValueError(
227
+ "Set both FI_API_KEY and FI_SECRET_KEY, or pass api_key and secret_key"
228
+ )
229
+ exporter = OTLPSpanExporter(
230
+ endpoint=base_url.rstrip("/") + "/tracer/v1/traces",
231
+ headers={"X-Api-Key": api_key, "X-Secret-Key": secret_key},
232
+ timeout=export_timeout,
233
+ compression=Compression.Gzip
234
+ if compression == "gzip"
235
+ else Compression.NoCompression,
236
+ )
237
+ safe = SafeSpanExporter(
238
+ exporter,
239
+ capture_content=capture_content,
240
+ keep_error_text=keep_error_text,
241
+ max_content_length=max_content_length,
242
+ )
243
+ provider = create_tracer_provider(
244
+ # Resource(), not create(): no environment, host, process, or SDK detectors.
245
+ resource=Resource(
246
+ {
247
+ "project_name": project_name,
248
+ "project_type": "observe",
249
+ "semantic_convention": "fi",
250
+ "service.name": "temporal",
251
+ }
252
+ ),
253
+ shutdown_on_exit=False,
254
+ span_limits=SpanLimits(
255
+ max_attributes=128,
256
+ max_events=64,
257
+ max_links=64,
258
+ max_attribute_length=max(16384, max_content_length),
259
+ ),
260
+ )
261
+ provider.add_span_processor(WorkflowIdAsSession())
262
+ provider.add_span_processor(
263
+ BatchSpanProcessor(
264
+ safe,
265
+ max_queue_size=max_queue_size,
266
+ max_export_batch_size=max_export_batch_size,
267
+ schedule_delay_millis=schedule_delay_millis,
268
+ )
269
+ )
270
+ handle = TemporalTracing(
271
+ provider,
272
+ OpenTelemetryPlugin(add_temporal_spans=True),
273
+ shutdown_timeout_millis,
274
+ )
275
+ trace.set_tracer_provider(provider)
276
+ if trace.get_tracer_provider() is not provider:
277
+ # An unrelated library may race our lock; never return an unusable handle.
278
+ handle.shutdown()
279
+ raise RuntimeError(
280
+ "Another library installed the global provider during Temporal configuration"
281
+ )
282
+ return handle
@@ -0,0 +1,298 @@
1
+ """Destination-local, fail-closed filtering of completed native spans."""
2
+
3
+ import logging
4
+ import re
5
+ from collections.abc import Sequence
6
+
7
+ from fi_instrumentation import TraceConfig
8
+ from opentelemetry.sdk.resources import Resource
9
+ from opentelemetry.sdk.trace import Event, ReadableSpan
10
+ from opentelemetry.sdk.trace.export import SpanExporter, SpanExportResult
11
+ from opentelemetry.sdk.util.instrumentation import InstrumentationScope
12
+ from opentelemetry.trace import Link, SpanContext, Status, StatusCode
13
+
14
+ _LOGGER = logging.getLogger(__name__)
15
+
16
+ # An allowlist, not a prefix denylist: newly added upstream fields stay private.
17
+ _METADATA = frozenset(
18
+ {
19
+ "temporalWorkflowID",
20
+ "temporalRunID",
21
+ "temporalActivityID",
22
+ "temporalActivityType",
23
+ "session.id",
24
+ "user.id",
25
+ "gen_ai.conversation.id",
26
+ "gen_ai.span.kind",
27
+ "gen_ai.operation.name",
28
+ "gen_ai.provider.name",
29
+ "gen_ai.system",
30
+ "gen_ai.request.model",
31
+ "gen_ai.response.model",
32
+ "gen_ai.response.id",
33
+ "gen_ai.tool.name",
34
+ "gen_ai.tool.type",
35
+ "gen_ai.tool.call.id",
36
+ "gen_ai.usage.input_tokens",
37
+ "gen_ai.usage.output_tokens",
38
+ "gen_ai.usage.total_tokens",
39
+ "gen_ai.usage.cache_read_tokens",
40
+ "gen_ai.usage.cache_write_tokens",
41
+ "gen_ai.usage.input_tokens.cache_read",
42
+ "gen_ai.usage.input_tokens.cache_write",
43
+ "gen_ai.usage.input_tokens.cache_input",
44
+ "gen_ai.usage.input_tokens.audio",
45
+ "gen_ai.usage.output_tokens.audio",
46
+ "gen_ai.usage.output_tokens.reasoning",
47
+ "llm.provider",
48
+ "llm.system",
49
+ "tool.name",
50
+ "tool.id",
51
+ "tool.type",
52
+ "exception.type",
53
+ "error.type",
54
+ }
55
+ )
56
+ _ALIASES = {
57
+ "fi.span.kind": "gen_ai.span.kind",
58
+ "openinference.span.kind": "gen_ai.span.kind",
59
+ "llm.model_name": "gen_ai.request.model",
60
+ "llm.invocation_parameters": "gen_ai.request.parameters",
61
+ "llm.token_count.prompt": "gen_ai.usage.input_tokens",
62
+ "llm.token_count.completion": "gen_ai.usage.output_tokens",
63
+ "llm.token_count.total": "gen_ai.usage.total_tokens",
64
+ }
65
+ _CONTENT = frozenset(
66
+ {
67
+ "input.value",
68
+ "output.value",
69
+ "input.mime_type",
70
+ "output.mime_type",
71
+ "gen_ai.input.messages",
72
+ "gen_ai.output.messages",
73
+ "gen_ai.system_instructions",
74
+ "gen_ai.tool.call.arguments",
75
+ "gen_ai.tool.call.result",
76
+ "gen_ai.request.parameters",
77
+ "raw.input",
78
+ "raw.output",
79
+ "gen_ai.prompts",
80
+ }
81
+ )
82
+ _MESSAGE_FIELD = re.compile(
83
+ r"(?:gen_ai\.(?:input|output)\.messages|llm\.(?:input|output)_messages)"
84
+ r"\.\d+\.message\.(?:role|content|name|tool_call_id|"
85
+ r"contents\.\d+\.message_content\.text|"
86
+ r"tool_calls\.\d+\.tool_call\.(?:id|function\.name|function\.arguments))\Z"
87
+ )
88
+
89
+ _RESOURCE = frozenset(
90
+ {"project_name", "project_type", "service.name", "semantic_convention"}
91
+ )
92
+ _ERROR_TYPE = re.compile(r"[A-Za-z_][A-Za-z0-9_.]{0,255}\Z")
93
+ _KINDS = frozenset(
94
+ {
95
+ "llm",
96
+ "tool",
97
+ "chain",
98
+ "agent",
99
+ "retriever",
100
+ "embedding",
101
+ "reranker",
102
+ "guardrail",
103
+ "evaluator",
104
+ }
105
+ )
106
+
107
+
108
+ def _context(context):
109
+ if context is None:
110
+ return None
111
+ # TraceState is arbitrary vendor data; it is unnecessary for exported parentage.
112
+ return SpanContext(
113
+ context.trace_id, context.span_id, context.is_remote, context.trace_flags
114
+ )
115
+
116
+
117
+ class SafeSpanExporter(SpanExporter):
118
+ """Sanitize only this destination; never mutate spans seen by other exporters.
119
+
120
+ Content requires capture_content. Exception messages additionally require
121
+ keep_error_text; exception stacks and arbitrary events are never exported.
122
+ Span/scope names and metadata IDs must not contain private application data.
123
+ The wrapped exporter is owned by this wrapper and shut down with it.
124
+ """
125
+
126
+ def __init__(
127
+ self,
128
+ exporter: SpanExporter,
129
+ *,
130
+ capture_content: bool = False,
131
+ keep_error_text: bool = False,
132
+ max_content_length: int = 16384,
133
+ ) -> None:
134
+ if not isinstance(capture_content, bool) or not isinstance(
135
+ keep_error_text, bool
136
+ ):
137
+ raise TypeError("capture_content and keep_error_text must be booleans")
138
+ if not isinstance(max_content_length, int) or isinstance(
139
+ max_content_length, bool
140
+ ):
141
+ raise TypeError("max_content_length must be an integer")
142
+ if max_content_length < 1:
143
+ raise ValueError("max_content_length must be positive")
144
+ self._exporter = exporter
145
+ self._capture_content = capture_content
146
+ self._config = TraceConfig()
147
+ self._keep_error_text = (
148
+ capture_content and keep_error_text and not self._config.hide_error_details
149
+ )
150
+ self._max_content_length = max_content_length
151
+
152
+ def _attributes(self, attributes):
153
+ original = dict(attributes or {})
154
+ for source, target in _ALIASES.items():
155
+ if source in original:
156
+ original.setdefault(target, original[source])
157
+ del original[source]
158
+ result = {}
159
+ for key, value in original.items():
160
+ if key in {"exception.type", "error.type"}:
161
+ result[key] = (
162
+ value
163
+ if isinstance(value, str) and _ERROR_TYPE.fullmatch(value)
164
+ else "Error"
165
+ )
166
+ elif key == "gen_ai.span.kind":
167
+ if isinstance(value, str) and value.lower() in _KINDS:
168
+ result[key] = value.lower()
169
+ elif key.startswith("gen_ai.usage.") and key in _METADATA:
170
+ if (
171
+ isinstance(value, int)
172
+ and not isinstance(value, bool)
173
+ and value >= 0
174
+ ):
175
+ result[key] = value
176
+ elif key in _METADATA:
177
+ if isinstance(value, (str, int, float, bool)):
178
+ result[key] = value
179
+ elif self._keep_error_text and key in {
180
+ "exception.message",
181
+ "error.message",
182
+ }:
183
+ if isinstance(value, str):
184
+ result[key] = value[: self._max_content_length]
185
+ elif self._capture_content and (
186
+ key in _CONTENT or _MESSAGE_FIELD.fullmatch(key)
187
+ ):
188
+ # Aggregate strings may contain message text/images that core's
189
+ # field-level mask cannot inspect. Hide them conservatively.
190
+ input_hidden = any(
191
+ (
192
+ self._config.hide_inputs,
193
+ self._config.hide_input_messages,
194
+ self._config.hide_input_text,
195
+ self._config.hide_input_images,
196
+ )
197
+ )
198
+ output_hidden = any(
199
+ (
200
+ self._config.hide_outputs,
201
+ self._config.hide_output_messages,
202
+ self._config.hide_output_text,
203
+ )
204
+ )
205
+ is_input = key.startswith(
206
+ ("input.", "raw.input", "gen_ai.input.", "llm.input_messages")
207
+ ) or key in {
208
+ "gen_ai.system_instructions",
209
+ "gen_ai.prompts",
210
+ "gen_ai.tool.call.arguments",
211
+ }
212
+ is_output = (
213
+ key.startswith(
214
+ (
215
+ "output.",
216
+ "raw.output",
217
+ "gen_ai.output.",
218
+ "llm.output_messages",
219
+ )
220
+ )
221
+ or key == "gen_ai.tool.call.result"
222
+ )
223
+ if (is_input and input_hidden) or (is_output and output_hidden):
224
+ continue
225
+ if key == "gen_ai.request.parameters" and (
226
+ input_hidden
227
+ or output_hidden
228
+ or self._config.hide_llm_invocation_parameters
229
+ ):
230
+ continue
231
+ masked = self._config.mask(key, value)
232
+ if masked is not None:
233
+ if isinstance(masked, str):
234
+ result[key] = masked[: self._max_content_length]
235
+ elif isinstance(masked, (int, float, bool)):
236
+ result[key] = masked
237
+ return result
238
+
239
+ def _scrub(self, span: ReadableSpan) -> ReadableSpan:
240
+ status = Status(span.status.status_code)
241
+ if span.status.status_code == StatusCode.ERROR:
242
+ status = Status(
243
+ StatusCode.ERROR,
244
+ (
245
+ span.status.description[: self._max_content_length]
246
+ if self._keep_error_text and span.status.description
247
+ else "error"
248
+ ),
249
+ )
250
+ events = []
251
+ for event in span.events:
252
+ if event.name != "exception":
253
+ continue
254
+ attrs = event.attributes or {}
255
+ safe = self._attributes(
256
+ {k: v for k, v in attrs.items() if k == "exception.type"}
257
+ )
258
+ message = attrs.get("exception.message")
259
+ if self._keep_error_text and isinstance(message, str):
260
+ safe["exception.message"] = message[: self._max_content_length]
261
+ events.append(Event("exception", safe, event.timestamp))
262
+ scope = span.instrumentation_scope
263
+ return ReadableSpan(
264
+ name=span.name,
265
+ context=_context(span.context),
266
+ parent=_context(span.parent),
267
+ resource=Resource(
268
+ {k: v for k, v in span.resource.attributes.items() if k in _RESOURCE}
269
+ ),
270
+ attributes=self._attributes(span.attributes),
271
+ events=events,
272
+ links=[Link(_context(link.context)) for link in span.links],
273
+ kind=span.kind,
274
+ status=status,
275
+ start_time=span.start_time,
276
+ end_time=span.end_time,
277
+ instrumentation_scope=InstrumentationScope(scope.name, scope.version)
278
+ if scope
279
+ else None,
280
+ )
281
+
282
+ def export(self, spans: Sequence[ReadableSpan]) -> SpanExportResult:
283
+ try:
284
+ safe = [self._scrub(span) for span in spans]
285
+ return self._exporter.export(safe)
286
+ except Exception: # noqa: BLE001 -- fail closed for both filter and exporter failures
287
+ # Neither a filtering error nor an exporter exception may send the originals
288
+ # or log exception text that can contain a request body/credentials.
289
+ _LOGGER.warning(
290
+ "Temporal span filtering or export failed; batch dropped, details redacted"
291
+ )
292
+ return SpanExportResult.FAILURE
293
+
294
+ def force_flush(self, timeout_millis: int = 30000) -> bool:
295
+ return self._exporter.force_flush(timeout_millis)
296
+
297
+ def shutdown(self) -> None:
298
+ self._exporter.shutdown()
@@ -0,0 +1,58 @@
1
+ """Session propagation without inventing workflow spans or IDs."""
2
+
3
+ import logging
4
+
5
+ from opentelemetry import context, trace
6
+ from opentelemetry.context import Context
7
+ from opentelemetry.sdk.trace import Span, SpanProcessor
8
+ from temporalio import activity, workflow
9
+
10
+ _LOGGER = logging.getLogger(__name__)
11
+
12
+
13
+ class WorkflowIdAsSession(SpanProcessor):
14
+ """Use the native workflow ID unless the application supplies a session.
15
+
16
+ Activity runtime context also covers SDK versions that omit workflow IDs on
17
+ RunActivity. Only local parent/context user IDs propagate: no new baggage or
18
+ workflow headers are added, and identities never cross a workflow boundary
19
+ implicitly.
20
+ """
21
+
22
+ def force_flush(self, timeout_millis: int = 30000) -> bool:
23
+ # OTel 1.39's default SpanProcessor method returns None, which aborts
24
+ # the provider's flush before it reaches the actual batch processor.
25
+ return True
26
+
27
+ def on_start(self, span: Span, parent_context: Context | None = None) -> None:
28
+ try:
29
+ attrs = span.attributes or {}
30
+ parent = (
31
+ getattr(trace.get_current_span(parent_context), "attributes", None)
32
+ or {}
33
+ )
34
+ if not attrs.get("session.id"):
35
+ session = context.get_value("session.id", parent_context)
36
+ if not session:
37
+ # Native workflow boundaries keep their own identity rather
38
+ # than inheriting a caller's session implicitly.
39
+ session = attrs.get("temporalWorkflowID")
40
+ if not session:
41
+ session = parent.get("session.id")
42
+ if not session and activity.in_activity():
43
+ session = activity.info().workflow_id
44
+ if not session and workflow.in_workflow():
45
+ session = workflow.info().workflow_id
46
+ if isinstance(session, str) and session:
47
+ span.set_attribute("session.id", session)
48
+ if not attrs.get("user.id"):
49
+ user = context.get_value("user.id", parent_context) or parent.get(
50
+ "user.id"
51
+ )
52
+ if isinstance(user, str) and user:
53
+ span.set_attribute("user.id", user)
54
+ except Exception: # noqa: BLE001 -- telemetry hooks must not break workflows
55
+ # Do not log exception text/stacks: they may include application content.
56
+ _LOGGER.warning(
57
+ "Temporal session mapping failed; span kept, details redacted"
58
+ )
File without changes
@@ -0,0 +1 @@
1
+ __version__ = "0.1.0" # x-release-please-version
@@ -0,0 +1,191 @@
1
+ Metadata-Version: 2.5
2
+ Name: traceAI-temporal
3
+ Version: 0.1.0
4
+ Summary: Future AGI configuration for Temporal's native replay-safe OpenTelemetry tracing
5
+ Project-URL: Repository, https://github.com/future-agi/traceAI/tree/dev/python/frameworks/temporal
6
+ Project-URL: Documentation, https://docs.futureagi.com/docs/integrations/frameworks/temporal
7
+ Author-email: Future AGI <no-reply@futureagi.com>
8
+ License-Expression: Apache-2.0
9
+ License-File: LICENSE
10
+ License-File: NOTICE
11
+ Requires-Python: <3.14,>=3.10
12
+ Requires-Dist: fi-instrumentation-otel<2,>=1.2.2
13
+ Requires-Dist: opentelemetry-exporter-otlp-proto-http<2,>=1.39
14
+ Requires-Dist: opentelemetry-sdk<2,>=1.39
15
+ Requires-Dist: temporalio[opentelemetry]<1.36,>=1.34
16
+ Requires-Dist: typing-extensions<5,>=4.5
17
+ Provides-Extra: dev
18
+ Requires-Dist: build<2,>=1.2; extra == 'dev'
19
+ Requires-Dist: hatchling<2,>=1.27; extra == 'dev'
20
+ Requires-Dist: mypy<2,>=1.15; extra == 'dev'
21
+ Requires-Dist: pytest<9,>=8; extra == 'dev'
22
+ Description-Content-Type: text/markdown
23
+
24
+ # traceAI Temporal
25
+
26
+ Send Temporal's native workflow and activity spans to Future AGI, with model and tool spans nested inside the activities that run them. The package configures Temporal's replay-safe OpenTelemetry provider; it does not replace Temporal's instrumentation or create duplicate workflow spans.
27
+
28
+ ## Install
29
+
30
+ Use Python 3.10–3.13 and Temporal Python SDK 1.34 or 1.35.
31
+
32
+ ```bash
33
+ pip install "traceAI-temporal==0.1.0"
34
+ ```
35
+
36
+ Temporal marks its OpenTelemetry plugin and replay-safe provider as experimental. This package restricts the SDK range to the supported minor versions.
37
+
38
+ ## Configure
39
+
40
+ Set the same project in the starter and worker processes. Supply your keys through your deployment's environment or secret manager.
41
+
42
+ ```bash
43
+ export FI_PROJECT_NAME=temporal-orders
44
+ export FI_API_KEY='<your-api-key>'
45
+ export FI_SECRET_KEY='<your-secret-key>'
46
+ # Optional, for a self-hosted deployment:
47
+ # export FI_BASE_URL=https://your-futureagi-host
48
+ ```
49
+
50
+ Call `configure()` once in each process, **before connecting the client**. Do not also call `fi_instrumentation.register()` or install another global tracer provider.
51
+
52
+ ```python
53
+ from temporalio.client import Client
54
+ from traceai_temporal import configure
55
+
56
+ telemetry = configure()
57
+ client = await Client.connect("localhost:7233", plugins=[telemetry.plugin])
58
+ ```
59
+
60
+ Workers created from this client inherit the native plugin. Do not add it to the worker again. The plugin enables Temporal's workflow and activity spans by default.
61
+
62
+ ## Run a workflow
63
+
64
+ Start your Temporal cluster or a local [Temporal dev server](https://docs.temporal.io/cli):
65
+
66
+ ```bash
67
+ temporal server start-dev
68
+ ```
69
+
70
+ Keep workflow code deterministic. Save this ordinary workflow as `workflows.py`; it must not import the exporter, this package, or a model SDK.
71
+
72
+ ```python
73
+ from datetime import timedelta
74
+ from temporalio import workflow
75
+
76
+
77
+ @workflow.defn
78
+ class OrderWorkflow:
79
+ @workflow.run
80
+ async def run(self, quantity: int) -> str:
81
+ return await workflow.execute_activity(
82
+ "price_order",
83
+ quantity,
84
+ start_to_close_timeout=timedelta(seconds=10),
85
+ )
86
+ ```
87
+
88
+ Save the worker and starter as `app.py`. This example runs them in one process; separate deployments use the same `configure()` and client setup in each process.
89
+
90
+ ```python
91
+ import asyncio
92
+ import uuid
93
+ from opentelemetry import trace
94
+ from temporalio import activity
95
+ from temporalio.client import Client
96
+ from temporalio.worker import Worker
97
+ from traceai_temporal import configure
98
+ from workflows import OrderWorkflow
99
+
100
+
101
+ @activity.defn
102
+ async def price_order(quantity: int) -> str:
103
+ with trace.get_tracer("orders").start_as_current_span(
104
+ "calculate-price", attributes={"gen_ai.span.kind": "tool"}
105
+ ):
106
+ return f"EUR {quantity * 21}"
107
+
108
+
109
+ async def main():
110
+ telemetry = configure()
111
+ try:
112
+ client = await Client.connect("localhost:7233", plugins=[telemetry.plugin])
113
+ async with Worker(
114
+ client,
115
+ task_queue="orders",
116
+ workflows=[OrderWorkflow],
117
+ activities=[price_order],
118
+ ):
119
+ result = await client.execute_workflow(
120
+ OrderWorkflow.run,
121
+ 2,
122
+ id=f"order-{uuid.uuid4().hex}",
123
+ task_queue="orders",
124
+ )
125
+ print(result)
126
+ finally:
127
+ # Stop workers first. These methods return False if the time budget expires.
128
+ if not telemetry.shutdown(timeout_millis=3000):
129
+ print("Tracing shutdown timed out; the final batch may be lost")
130
+
131
+
132
+ asyncio.run(main())
133
+ ```
134
+
135
+ ```bash
136
+ python app.py
137
+ ```
138
+
139
+ In Future AGI, open **Observe**, select `temporal-orders`, and open the latest `StartWorkflow:OrderWorkflow` trace. It contains `RunWorkflow`, `StartActivity`, `RunActivity`, and `calculate-price`. The workflow ID is the session ID, including on nested tool/model spans and signal handlers.
140
+
141
+ ## Add model tracing inside activities
142
+
143
+ Temporal's plugin does not trace model requests. Install the traceAI package for your model SDK and instrument it **once**, using `telemetry.provider`. For example, with `traceAI-openai` installed:
144
+
145
+ ```python
146
+ from traceai_openai import OpenAIInstrumentor
147
+
148
+ OpenAIInstrumentor().instrument(tracer_provider=telemetry.provider)
149
+ ```
150
+
151
+ Make model calls only inside activities, not replayed workflow code. Provider spans keep their model, token usage, and span kind; the adapter does not copy token totals onto workflow or activity parents. Do not instrument the same model call through two packages.
152
+
153
+ ## Privacy
154
+
155
+ The default is **metadata only**: workflow/run/activity IDs, span names and timing, status, model/tool identifiers, token counts, and explicit session/user IDs. Unknown attributes, content, arbitrary events, status text, and exception messages are removed before this destination exports. Exception types remain. Exception stack attributes are always removed, including with content enabled. Resource and scope attributes are filtered, and link attributes and trace state are removed.
156
+
157
+ Use opaque workflow IDs and user IDs. Span names, instrumentation-scope names, and allowed metadata values are not secret scanners; do not put prompts, emails, paths, or credentials in them.
158
+
159
+ To include supported input/output and message attributes, opt in in both processes as needed:
160
+
161
+ ```python
162
+ telemetry = configure(capture_content=True)
163
+ ```
164
+
165
+ Error text needs a second explicit opt-in, `keep_error_text=True`, together with `capture_content=True`. The core `FI_HIDE_*` settings remain privacy ceilings; `FI_HIDE_ERROR_DETAILS=true` still removes error text. Content values are capped at 16,384 characters by default. The adapter cannot recover content that your instrumentor did not record, and opt-in content can contain sensitive data.
166
+
167
+ The policy applies to this exporter only. It does not redact Temporal history, application logs, or other exporters you attach. It does not propagate user identity across Temporal's process boundary: attach explicit user IDs in activities if needed. Application-supplied `session.id` takes precedence over the workflow ID.
168
+
169
+ ## Configuration and lifecycle
170
+
171
+ - `project_name`, `api_key`, `secret_key`, `base_url` override the corresponding `FI_*` environment values. `base_url` is the origin (optionally with a deployment prefix), not the traces URL; the package appends `/tracer/v1/traces`.
172
+ - The destination uses upstream OTLP/HTTP **protobuf** with no compression. Set `compression="gzip"` for Future AGI Cloud or self-hosted v1.56.0 and later. Remote endpoints require HTTPS; plain HTTP is allowed only for loopback collectors.
173
+ - `exporter=` accepts an application-supplied OpenTelemetry `SpanExporter` in place of endpoint/auth settings. It still receives filtered spans and is shut down by the handle.
174
+ - The batch queue holds at most 2,048 spans, with batches of at most 512 and a 1-second schedule. Set `max_queue_size`, `max_export_batch_size`, and `schedule_delay_millis` to tune them. A full queue drops spans rather than blocking an activity.
175
+ - `export_timeout` defaults to 3 seconds per HTTP export. `telemetry.force_flush(timeout_millis=3000)` and `telemetry.shutdown(timeout_millis=3000)` bound the caller's wait and return a boolean. On timeout, an in-flight daemon export can finish later; delivery is not guaranteed. Neither method ends unfinished workflow spans.
176
+ - Normal interpreter exit has a bounded shutdown fallback. Explicitly shut down after stopping the worker. Crashes, forced exits, and container freezes can lose buffered spans. In an async server, use `await asyncio.to_thread(telemetry.shutdown)` to avoid blocking its event loop while waiting.
177
+ - Do not configure again after shutdown: OpenTelemetry does not allow replacing its process-global provider. Construct worker processes after forking, then configure each process.
178
+
179
+ ## Troubleshooting
180
+
181
+ **The worker rejects the global tracer provider.** Call this package's `configure()` before `Client.connect()`. Do not use the ordinary `register()` provider with Temporal's replay-safe plugin.
182
+
183
+ **Model spans start separate traces.** Configure the plugin on both clients and pass `telemetry.provider` to the model instrumentor. Keep calls inside activities.
184
+
185
+ **A workflow fails sandbox validation.** Move tracing setup and model imports into the worker/activity module. The workflow module should import only deterministic workflow dependencies and refer to activities by name.
186
+
187
+ **No spans appear, or the trace splits across projects.** Check both key headers, the base URL, and that starter and worker use the same `FI_PROJECT_NAME`. Flush short-lived starters before exit. A running workflow's `RunWorkflow` span is exported only when it ends.
188
+
189
+ ## Limits
190
+
191
+ This integration covers the Python native plugin's workflow/activity hierarchy, activity retries, signal sessions, and history replay. It does not configure Temporal metrics/logs, cluster authentication, or model instrumentation. Native Temporal spans remain runtime spans rather than being relabeled as model calls. Each activity attempt is a distinct span; no attempt number is synthesized. Temporal owns deterministic IDs and replay suppression, not exactly-once delivery to Future AGI. Child workflows, continue-as-new, Nexus, and standalone activities are not additional compatibility guarantees of this package.
@@ -0,0 +1,11 @@
1
+ traceai_temporal/__init__.py,sha256=cjUjPt8cciyJrBOlP-ufsD36dD02usnO0XCkTi3H9nk,373
2
+ traceai_temporal/_configure.py,sha256=9CnymS7SiAR9KAJulpI3nQvILy77vESl4kQk9Av57ng,11336
3
+ traceai_temporal/_privacy.py,sha256=GBetp7I6TM3JhFNRX9Wr64agM58VZ-Fb8r2ZMyOixaA,11218
4
+ traceai_temporal/_session.py,sha256=coXhhKahWHLhFqMsiu88JNmJh3SIctp8jk9esyp3kEs,2586
5
+ traceai_temporal/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
+ traceai_temporal/version.py,sha256=IOEzhCbX916JIkvZr03GFY4bl9YqSkfjdqLO4qJ2FOs,50
7
+ traceai_temporal-0.1.0.dist-info/METADATA,sha256=y0XYKrDYFELKzi5NInFv7wi24BROKxRFovVrPu8uO9E,10298
8
+ traceai_temporal-0.1.0.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
9
+ traceai_temporal-0.1.0.dist-info/licenses/LICENSE,sha256=MdFVOqVey1yWrQ7QcNxBkeYHdrsTUICh6lhmP3LxOEc,11308
10
+ traceai_temporal-0.1.0.dist-info/licenses/NOTICE,sha256=bv5-n0BXeHzEOxr5NmwLIOSOSbs4QjsJ-023dtOQUSc,337
11
+ traceai_temporal-0.1.0.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.33.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for describing the origin of the Work and
141
+ reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may accept and charge a
167
+ fee for acceptance of support, warranty, indemnity, or other liability
168
+ obligations and/or rights consistent with this License. However, in
169
+ accepting such obligations, You may act only on Your own behalf and on
170
+ Your sole responsibility, not on behalf of any other Contributor, and
171
+ only if You agree to indemnify, defend, and hold each Contributor
172
+ harmless for any liability incurred by, or claims asserted against,
173
+ such Contributor by reason of your accepting any such warranty or
174
+ additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2024-2026 Future AGI, Inc.
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,7 @@
1
+ traceAI
2
+ Copyright (c) 2024-2026 Future AGI, Inc.
3
+
4
+ This product is part of the Future AGI open-source ecosystem
5
+ (https://github.com/future-agi/future-agi) and is licensed under the Apache
6
+ License, Version 2.0 (the "License"). See the LICENSE file for the full
7
+ license text, or obtain a copy at http://www.apache.org/licenses/LICENSE-2.0.