infralo 0.1.0.dev2__tar.gz → 0.1.0.dev3__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.
Files changed (56) hide show
  1. {infralo-0.1.0.dev2 → infralo-0.1.0.dev3}/PKG-INFO +36 -1
  2. {infralo-0.1.0.dev2 → infralo-0.1.0.dev3}/README.md +35 -0
  3. {infralo-0.1.0.dev2 → infralo-0.1.0.dev3}/pyproject.toml +1 -1
  4. {infralo-0.1.0.dev2 → infralo-0.1.0.dev3}/src/infralo/client.py +24 -6
  5. {infralo-0.1.0.dev2 → infralo-0.1.0.dev3}/uv.lock +1 -1
  6. {infralo-0.1.0.dev2 → infralo-0.1.0.dev3}/.gitignore +0 -0
  7. {infralo-0.1.0.dev2 → infralo-0.1.0.dev3}/.pre-commit-config.yaml +0 -0
  8. {infralo-0.1.0.dev2 → infralo-0.1.0.dev3}/examples/README.md +0 -0
  9. {infralo-0.1.0.dev2 → infralo-0.1.0.dev3}/examples/agno/README.md +0 -0
  10. {infralo-0.1.0.dev2 → infralo-0.1.0.dev3}/examples/agno/agno_complex_nesting.py +0 -0
  11. {infralo-0.1.0.dev2 → infralo-0.1.0.dev3}/examples/agno/agno_integration.py +0 -0
  12. {infralo-0.1.0.dev2 → infralo-0.1.0.dev3}/examples/agno/pyproject.toml +0 -0
  13. {infralo-0.1.0.dev2 → infralo-0.1.0.dev3}/examples/agno/uv.lock +0 -0
  14. {infralo-0.1.0.dev2 → infralo-0.1.0.dev3}/examples/core/README.md +0 -0
  15. {infralo-0.1.0.dev2 → infralo-0.1.0.dev3}/examples/core/complex_nesting.py +0 -0
  16. {infralo-0.1.0.dev2 → infralo-0.1.0.dev3}/examples/core/complex_nesting_decorator.py +0 -0
  17. {infralo-0.1.0.dev2 → infralo-0.1.0.dev3}/examples/core/mcp_integration.py +0 -0
  18. {infralo-0.1.0.dev2 → infralo-0.1.0.dev3}/examples/core/parallel_execution.py +0 -0
  19. {infralo-0.1.0.dev2 → infralo-0.1.0.dev3}/examples/core/pattern_a_context_manager.py +0 -0
  20. {infralo-0.1.0.dev2 → infralo-0.1.0.dev3}/examples/core/pattern_b_decorator.py +0 -0
  21. {infralo-0.1.0.dev2 → infralo-0.1.0.dev3}/examples/core/pattern_c_manual.py +0 -0
  22. {infralo-0.1.0.dev2 → infralo-0.1.0.dev3}/examples/core/pyproject.toml +0 -0
  23. {infralo-0.1.0.dev2 → infralo-0.1.0.dev3}/examples/core/tool_first_execution.py +0 -0
  24. {infralo-0.1.0.dev2 → infralo-0.1.0.dev3}/examples/core/uv.lock +0 -0
  25. {infralo-0.1.0.dev2 → infralo-0.1.0.dev3}/examples/crewai/README.md +0 -0
  26. {infralo-0.1.0.dev2 → infralo-0.1.0.dev3}/examples/crewai/crewai_complex_nesting.py +0 -0
  27. {infralo-0.1.0.dev2 → infralo-0.1.0.dev3}/examples/crewai/crewai_integration.py +0 -0
  28. {infralo-0.1.0.dev2 → infralo-0.1.0.dev3}/examples/crewai/pyproject.toml +0 -0
  29. {infralo-0.1.0.dev2 → infralo-0.1.0.dev3}/examples/crewai/uv.lock +0 -0
  30. {infralo-0.1.0.dev2 → infralo-0.1.0.dev3}/examples/google_adk/README.md +0 -0
  31. {infralo-0.1.0.dev2 → infralo-0.1.0.dev3}/examples/google_adk/google_adk_complex_nesting.py +0 -0
  32. {infralo-0.1.0.dev2 → infralo-0.1.0.dev3}/examples/google_adk/google_adk_integration.py +0 -0
  33. {infralo-0.1.0.dev2 → infralo-0.1.0.dev3}/examples/google_adk/pyproject.toml +0 -0
  34. {infralo-0.1.0.dev2 → infralo-0.1.0.dev3}/examples/google_adk/uv.lock +0 -0
  35. {infralo-0.1.0.dev2 → infralo-0.1.0.dev3}/examples/langgraph/README.md +0 -0
  36. {infralo-0.1.0.dev2 → infralo-0.1.0.dev3}/examples/langgraph/langgraph_complex_nesting.py +0 -0
  37. {infralo-0.1.0.dev2 → infralo-0.1.0.dev3}/examples/langgraph/langgraph_integration.py +0 -0
  38. {infralo-0.1.0.dev2 → infralo-0.1.0.dev3}/examples/langgraph/pyproject.toml +0 -0
  39. {infralo-0.1.0.dev2 → infralo-0.1.0.dev3}/examples/langgraph/uv.lock +0 -0
  40. {infralo-0.1.0.dev2 → infralo-0.1.0.dev3}/src/infralo/__init__.py +0 -0
  41. {infralo-0.1.0.dev2 → infralo-0.1.0.dev3}/src/infralo/_models.py +0 -0
  42. {infralo-0.1.0.dev2 → infralo-0.1.0.dev3}/src/infralo/exporter.py +0 -0
  43. {infralo-0.1.0.dev2 → infralo-0.1.0.dev3}/src/infralo/integrations/__init__.py +0 -0
  44. {infralo-0.1.0.dev2 → infralo-0.1.0.dev3}/src/infralo/integrations/agno.py +0 -0
  45. {infralo-0.1.0.dev2 → infralo-0.1.0.dev3}/src/infralo/integrations/crewai.py +0 -0
  46. {infralo-0.1.0.dev2 → infralo-0.1.0.dev3}/src/infralo/integrations/google_adk.py +0 -0
  47. {infralo-0.1.0.dev2 → infralo-0.1.0.dev3}/src/infralo/integrations/langgraph.py +0 -0
  48. {infralo-0.1.0.dev2 → infralo-0.1.0.dev3}/src/infralo/span.py +0 -0
  49. {infralo-0.1.0.dev2 → infralo-0.1.0.dev3}/src/infralo/trace.py +0 -0
  50. {infralo-0.1.0.dev2 → infralo-0.1.0.dev3}/tests/conftest.py +0 -0
  51. {infralo-0.1.0.dev2 → infralo-0.1.0.dev3}/tests/integrations/__init__.py +0 -0
  52. {infralo-0.1.0.dev2 → infralo-0.1.0.dev3}/tests/integrations/test_agno.py +0 -0
  53. {infralo-0.1.0.dev2 → infralo-0.1.0.dev3}/tests/integrations/test_crewai.py +0 -0
  54. {infralo-0.1.0.dev2 → infralo-0.1.0.dev3}/tests/integrations/test_google_adk.py +0 -0
  55. {infralo-0.1.0.dev2 → infralo-0.1.0.dev3}/tests/integrations/test_langgraph.py +0 -0
  56. {infralo-0.1.0.dev2 → infralo-0.1.0.dev3}/tests/test_sdk.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: infralo
3
- Version: 0.1.0.dev2
3
+ Version: 0.1.0.dev3
4
4
  Summary: Infralo SDK
5
5
  License: MIT
6
6
  Keywords: agents,ai,llm,observability,tracing
@@ -248,6 +248,41 @@ inside inherit it automatically.
248
248
 
249
249
  ---
250
250
 
251
+ ## Human-in-the-Loop Approvals
252
+
253
+ Pause sensitive agent operations until human reviewers authorize them in the Infralo dashboard.
254
+
255
+ ```python
256
+ # Initiate an approval request inside an active trace
257
+ approval = await infralo.acreate_approval(
258
+ title="Publish Stock Recap to Threads",
259
+ description="Please review content before publishing.",
260
+ review_data={"recap": "Today's stock market summary..."},
261
+ callback_url="https://agent.example.com/api/callback/approval",
262
+ client_reference_id="run_1024",
263
+ )
264
+ ```
265
+
266
+ ### Trace Linkage & Webhook Resumption
267
+
268
+ - Calling `create_approval()` / `acreate_approval()` inside a trace automatically attaches `trace_id` and sets the approval `span_id` as the current parent span.
269
+ - When reviewed, Infralo POSTs a webhook payload containing `approval_id`, `span_id`, and `trace_id` to your `callback_url`.
270
+ - Resume trace context in your webhook handler so subsequent tasks nest under the approval span:
271
+
272
+ ```python
273
+ @app.post("/api/callback/approval")
274
+ async def on_approval_callback(payload: dict):
275
+ with infralo.start_trace(trace_id=payload.get("trace_id")) as trace:
276
+ if payload.get("span_id"):
277
+ trace.set_parent_span_id(payload["span_id"])
278
+
279
+ if payload.get("status") == "approved":
280
+ # Decorated tool calls or LLM gateway calls here will nest under the approval span
281
+ await post_to_destination()
282
+ ```
283
+
284
+ ---
285
+
251
286
  ## Edge Cases
252
287
 
253
288
  ### Header Propagation Failure
@@ -229,6 +229,41 @@ inside inherit it automatically.
229
229
 
230
230
  ---
231
231
 
232
+ ## Human-in-the-Loop Approvals
233
+
234
+ Pause sensitive agent operations until human reviewers authorize them in the Infralo dashboard.
235
+
236
+ ```python
237
+ # Initiate an approval request inside an active trace
238
+ approval = await infralo.acreate_approval(
239
+ title="Publish Stock Recap to Threads",
240
+ description="Please review content before publishing.",
241
+ review_data={"recap": "Today's stock market summary..."},
242
+ callback_url="https://agent.example.com/api/callback/approval",
243
+ client_reference_id="run_1024",
244
+ )
245
+ ```
246
+
247
+ ### Trace Linkage & Webhook Resumption
248
+
249
+ - Calling `create_approval()` / `acreate_approval()` inside a trace automatically attaches `trace_id` and sets the approval `span_id` as the current parent span.
250
+ - When reviewed, Infralo POSTs a webhook payload containing `approval_id`, `span_id`, and `trace_id` to your `callback_url`.
251
+ - Resume trace context in your webhook handler so subsequent tasks nest under the approval span:
252
+
253
+ ```python
254
+ @app.post("/api/callback/approval")
255
+ async def on_approval_callback(payload: dict):
256
+ with infralo.start_trace(trace_id=payload.get("trace_id")) as trace:
257
+ if payload.get("span_id"):
258
+ trace.set_parent_span_id(payload["span_id"])
259
+
260
+ if payload.get("status") == "approved":
261
+ # Decorated tool calls or LLM gateway calls here will nest under the approval span
262
+ await post_to_destination()
263
+ ```
264
+
265
+ ---
266
+
232
267
  ## Edge Cases
233
268
 
234
269
  ### Header Propagation Failure
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "infralo"
7
- version = "0.1.0.dev2"
7
+ version = "0.1.0.dev3"
8
8
  description = "Infralo SDK"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.10"
@@ -292,9 +292,17 @@ class Infralo:
292
292
  )
293
293
  resp.raise_for_status()
294
294
  resp_json = resp.json()
295
- if isinstance(resp_json, dict) and "data" in resp_json:
296
- return resp_json["data"]
297
- return resp_json
295
+ result: dict = (
296
+ resp_json["data"] if isinstance(resp_json, dict) and "data" in resp_json else resp_json
297
+ )
298
+
299
+ active_trace = get_active_trace()
300
+ if active_trace is not None:
301
+ span_id: str | None = result.get("span_id")
302
+ if span_id:
303
+ active_trace.set_parent_span_id(span_id)
304
+
305
+ return result
298
306
 
299
307
  async def acreate_approval(
300
308
  self,
@@ -343,9 +351,19 @@ class Infralo:
343
351
  )
344
352
  resp.raise_for_status()
345
353
  resp_json = resp.json()
346
- if isinstance(resp_json, dict) and "data" in resp_json:
347
- return resp_json["data"]
348
- return resp_json
354
+ result: dict = (
355
+ resp_json["data"]
356
+ if isinstance(resp_json, dict) and "data" in resp_json
357
+ else resp_json
358
+ )
359
+
360
+ active_trace = get_active_trace()
361
+ if active_trace is not None:
362
+ span_id: str | None = result.get("span_id")
363
+ if span_id:
364
+ active_trace.set_parent_span_id(span_id)
365
+
366
+ return result
349
367
 
350
368
  request_approval = create_approval
351
369
  arequest_approval = acreate_approval
@@ -1499,7 +1499,7 @@ wheels = [
1499
1499
 
1500
1500
  [[package]]
1501
1501
  name = "infralo"
1502
- version = "0.1.0.dev2"
1502
+ version = "0.1.0.dev3"
1503
1503
  source = { editable = "." }
1504
1504
  dependencies = [
1505
1505
  { name = "httpx" },
File without changes