cognite-function-apps 0.14.0__tar.gz → 0.15.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.
Files changed (113) hide show
  1. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/.pre-commit-config.yaml +2 -3
  2. cognite_function_apps-0.15.0/.release-please-manifest.json +3 -0
  3. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/AGENTS.md +8 -10
  4. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/CHANGELOG.md +30 -0
  5. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/PKG-INFO +2 -1
  6. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/docs/api-reference.md +2 -2
  7. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/docs/app-composition.md +26 -39
  8. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/docs/architecture.md +3 -3
  9. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/docs/dependency-injection.md +1 -3
  10. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/docs/dev-server.md +57 -11
  11. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/docs/introspection.md +25 -17
  12. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/docs/mcp.md +4 -10
  13. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/docs/response-customization.md +1 -4
  14. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/docs/tracing.md +10 -7
  15. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/docs-src/introspection.py +23 -17
  16. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/docs-src/tracing.py +9 -6
  17. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/examples/handler.py +2 -5
  18. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/pyproject.toml +2 -0
  19. cognite_function_apps-0.15.0/src/cognite_function_apps/_version.py +1 -0
  20. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/src/cognite_function_apps/app.py +17 -4
  21. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/src/cognite_function_apps/cli.py +28 -1
  22. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/src/cognite_function_apps/devserver/asgi.py +7 -3
  23. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/src/cognite_function_apps/devserver/swagger.py +25 -12
  24. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/src/cognite_function_apps/introspection.py +17 -7
  25. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/src/cognite_function_apps/tracer.py +33 -49
  26. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/tests/test_asgi.py +42 -0
  27. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/tests/test_cli.py +103 -6
  28. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/tests/test_swagger.py +62 -6
  29. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/tests/test_tracer.py +59 -11
  30. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/uv.lock +41 -4
  31. cognite_function_apps-0.14.0/.release-please-manifest.json +0 -3
  32. cognite_function_apps-0.14.0/src/cognite_function_apps/_version.py +0 -1
  33. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/.claude/settings.json +0 -0
  34. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/.gemini/config.yaml +0 -0
  35. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/.gitattributes +0 -0
  36. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/.github/agents/agentic-workflows.agent.md +0 -0
  37. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/.github/aw/actions-lock.json +0 -0
  38. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/.github/renovate.json +0 -0
  39. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/.github/workflows/conventional-pr-title.yml +0 -0
  40. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/.github/workflows/copilot-setup-steps.yml +0 -0
  41. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/.github/workflows/deploy-docs.yml +0 -0
  42. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/.github/workflows/python-package.yml +0 -0
  43. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/.github/workflows/python-publish.yml +0 -0
  44. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/.github/workflows/release-please.yml +0 -0
  45. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/.gitignore +0 -0
  46. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/.nojekyll +0 -0
  47. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/.python-version +0 -0
  48. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/CLAUDE.md +0 -0
  49. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/CODEOWNERS +0 -0
  50. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/LICENSE +0 -0
  51. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/README.md +0 -0
  52. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/RELEASING.md +0 -0
  53. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/Terminology.md +0 -0
  54. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/adr/response-customization.md +0 -0
  55. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/codecov.yml +0 -0
  56. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/docs/async-support.md +0 -0
  57. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/docs/contributing.md +0 -0
  58. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/docs/error-handling.md +0 -0
  59. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/docs/function-client.md +0 -0
  60. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/docs/index.md +0 -0
  61. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/docs/logging.md +0 -0
  62. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/docs/release-process.md +0 -0
  63. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/docs/stylesheets/extra.css +0 -0
  64. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/docs/type-safety.md +0 -0
  65. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/docs-src/error-handling.py +0 -0
  66. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/docs-src/function-client.py +0 -0
  67. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/docs-src/logging.py +0 -0
  68. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/docs-src/type-safety.py +0 -0
  69. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/examples/dev.py +0 -0
  70. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/examples/requirements.txt +0 -0
  71. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/justfile +0 -0
  72. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/mkdocs.yml +0 -0
  73. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/release-please-config.json +0 -0
  74. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/src/cognite_function_apps/__init__.py +0 -0
  75. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/src/cognite_function_apps/_type_utils.py +0 -0
  76. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/src/cognite_function_apps/base_client.py +0 -0
  77. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/src/cognite_function_apps/client.py +0 -0
  78. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/src/cognite_function_apps/client_generation.py +0 -0
  79. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/src/cognite_function_apps/convert.py +0 -0
  80. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/src/cognite_function_apps/dependency_registry.py +0 -0
  81. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/src/cognite_function_apps/devserver/__init__.py +0 -0
  82. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/src/cognite_function_apps/devserver/auth.py +0 -0
  83. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/src/cognite_function_apps/formatting.py +0 -0
  84. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/src/cognite_function_apps/logger.py +0 -0
  85. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/src/cognite_function_apps/mcp.py +0 -0
  86. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/src/cognite_function_apps/models.py +0 -0
  87. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/src/cognite_function_apps/py.typed +0 -0
  88. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/src/cognite_function_apps/routing.py +0 -0
  89. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/src/cognite_function_apps/schema.py +0 -0
  90. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/src/cognite_function_apps/service.py +0 -0
  91. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/src/cognite_function_apps/templates/__init__.py +0 -0
  92. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/src/cognite_function_apps/templates/client_template.jinja2 +0 -0
  93. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/tests/__init__.py +0 -0
  94. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/tests/conftest.py +0 -0
  95. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/tests/conftest_pep563.py +0 -0
  96. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/tests/conftest_type_checking.py +0 -0
  97. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/tests/test_app.py +0 -0
  98. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/tests/test_async_handlers.py +0 -0
  99. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/tests/test_client_generation.py +0 -0
  100. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/tests/test_convert.py +0 -0
  101. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/tests/test_convert_edge_cases.py +0 -0
  102. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/tests/test_convert_property_based.py +0 -0
  103. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/tests/test_dependency_injection.py +0 -0
  104. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/tests/test_error_handling.py +0 -0
  105. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/tests/test_formatting.py +0 -0
  106. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/tests/test_handle_function.py +0 -0
  107. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/tests/test_introspection.py +0 -0
  108. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/tests/test_logger.py +0 -0
  109. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/tests/test_mcp.py +0 -0
  110. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/tests/test_models.py +0 -0
  111. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/tests/test_routing.py +0 -0
  112. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/tests/test_schema.py +0 -0
  113. {cognite_function_apps-0.14.0 → cognite_function_apps-0.15.0}/tests/test_trace_propagation.py +0 -0
@@ -16,9 +16,8 @@ repos:
16
16
  - hooks:
17
17
  - id: pyright
18
18
  name: pyright
19
- entry: pyright
20
- language: node
19
+ entry: uv run pyright
20
+ language: system
21
21
  pass_filenames: false
22
22
  types: [python]
23
- additional_dependencies: ["pyright@1.1.410"]
24
23
  repo: local
@@ -0,0 +1,3 @@
1
+ {
2
+ ".": "0.15.0"
3
+ }
@@ -249,8 +249,8 @@ The framework uses a composition pattern where multiple `FunctionApp` instances
249
249
  Example composition:
250
250
 
251
251
  ```python
252
- handle = create_function_service(tracing_app, mcp_app, introspection_app, main_app)
253
- # Routes: tracing → mcp → introspection → main
252
+ handle = create_function_service(tracing_app, mcp_app, main_app)
253
+ # Routes: tracing → mcp → main (introspection prepended automatically)
254
254
  # Metadata: from main_app
255
255
  # Registry: shared across all apps
256
256
  ```
@@ -339,7 +339,7 @@ When changing code, update relevant docs:
339
339
 
340
340
  ### IntrospectionApp
341
341
 
342
- Provides debugging endpoints (always recommended for development):
342
+ Provides debugging endpoints. Prepended automatically by `create_function_service()` unless already present or `introspection=False` is passed:
343
343
 
344
344
  - `/__schema__` - Unified OpenAPI schema across all composed apps
345
345
  - `/__routes__` - List of all registered routes
@@ -394,17 +394,15 @@ handle = create_function_service(app)
394
394
 
395
395
  ```python
396
396
  from cognite_function_apps import (
397
- FunctionApp,
398
- create_function_service,
399
- create_tracing_app,
397
+ FunctionApp,
398
+ create_function_service,
399
+ create_tracing_app,
400
400
  )
401
- from cognite_function_apps.introspection import create_introspection_app
402
401
  from cognite_function_apps.mcp import create_mcp_app
403
402
 
404
403
  # Create system apps
405
404
  tracing = create_tracing_app()
406
405
  mcp = create_mcp_app()
407
- introspection = create_introspection_app()
408
406
 
409
407
  # Create business app
410
408
  app = FunctionApp("Asset Management", "1.0.0")
@@ -416,8 +414,8 @@ def get_asset(client: CogniteClient, tracer: FunctionTracer, asset_id: int) -> d
416
414
  # Business logic
417
415
  return {"id": asset_id}
418
416
 
419
- # Compose: tracing → AI tools → debugging → business logic
420
- handle = create_function_service(tracing, mcp, introspection, app)
417
+ # Compose: tracing → AI tools → business logic (introspection is prepended automatically)
418
+ handle = create_function_service(tracing, mcp, app)
421
419
  ```
422
420
 
423
421
  ### Custom Dependency Registration
@@ -1,5 +1,35 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.15.0](https://github.com/cognitedata/cognite-function-apps/compare/cognite-function-apps-v0.14.1...cognite-function-apps-v0.15.0) (2026-09-18)
4
+
5
+
6
+ ### Features
7
+
8
+ * add injectable devserver client ([#226](https://github.com/cognitedata/cognite-function-apps/issues/226)) ([98d0792](https://github.com/cognitedata/cognite-function-apps/commit/98d0792f656c3e55403867bf255ff237a5862394))
9
+ * add VS Code debugger attach mode ([#227](https://github.com/cognitedata/cognite-function-apps/issues/227)) ([85a29c8](https://github.com/cognitedata/cognite-function-apps/commit/85a29c8399ad307924eaf43bcfb539e58f099a95))
10
+
11
+
12
+ ### Bug Fixes
13
+
14
+ * run pyright hook in project environment ([#230](https://github.com/cognitedata/cognite-function-apps/issues/230)) ([1d15bbd](https://github.com/cognitedata/cognite-function-apps/commit/1d15bbd5b38e1ee762a7f37625ccec1e80a49137))
15
+
16
+
17
+ ### Documentation
18
+
19
+ * add local debugger launch configuration ([#231](https://github.com/cognitedata/cognite-function-apps/issues/231)) ([1bc068f](https://github.com/cognitedata/cognite-function-apps/commit/1bc068f5ce3b66ff6d51611141f216c68ae0f07e))
20
+
21
+ ## [0.14.1](https://github.com/cognitedata/cognite-function-apps/compare/cognite-function-apps-v0.14.0...cognite-function-apps-v0.14.1) (2026-09-15)
22
+
23
+
24
+ ### Bug Fixes
25
+
26
+ * report tracing status on /__health__ instead of logging ([#224](https://github.com/cognitedata/cognite-function-apps/issues/224)) ([9eac0ae](https://github.com/cognitedata/cognite-function-apps/commit/9eac0aef669cadc464618d86554a4e7b65c907a0))
27
+
28
+
29
+ ### Documentation
30
+
31
+ * document auto-injected introspection ([#65](https://github.com/cognitedata/cognite-function-apps/issues/65)) ([732088d](https://github.com/cognitedata/cognite-function-apps/commit/732088d335104e2f0bd00c507043369f93b4d993))
32
+
3
33
  ## [0.14.0](https://github.com/cognitedata/cognite-function-apps/compare/cognite-function-apps-v0.13.1...cognite-function-apps-v0.14.0) (2026-09-03)
4
34
 
5
35
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: cognite-function-apps
3
- Version: 0.14.0
3
+ Version: 0.15.0
4
4
  Summary: FastAPI-style framework for building composable Function Apps for Cognite Functions with automatic OpenAPI schema generation and MCP integration
5
5
  Project-URL: Repository, https://github.com/cognitedata/cognite-function-apps
6
6
  Project-URL: Changelog, https://github.com/cognitedata/cognite-function-apps/releases
@@ -10,6 +10,7 @@ Requires-Dist: cognite-sdk>=7.87.0
10
10
  Requires-Dist: pydantic>=2.10.5
11
11
  Requires-Dist: typing-extensions>=4.11.0
12
12
  Provides-Extra: cli
13
+ Requires-Dist: debugpy>=1.8.0; extra == 'cli'
13
14
  Requires-Dist: pydantic-settings>=2.0.0; extra == 'cli'
14
15
  Requires-Dist: typer>=0.9.0; extra == 'cli'
15
16
  Requires-Dist: uvicorn>=0.37.0; extra == 'cli'
@@ -77,8 +77,8 @@ def create_item(
77
77
  # Single app
78
78
  handle = create_function_service(app)
79
79
 
80
- # Multiple apps (composition)
81
- handle = create_function_service(introspection, main_app)
80
+ # Multiple apps (composition) — introspection is prepended automatically
81
+ handle = create_function_service(mcp, main_app)
82
82
 
83
83
  # With custom dependencies
84
84
  handle = create_function_service(app, registry=custom_registry)
@@ -1,6 +1,8 @@
1
1
  # App Composition
2
2
 
3
- > **Note:** This is an advanced feature for framework extensibility. Most developers won't need to use app composition directly - it's primarily used internally for features like MCP integration and introspection endpoints. For typical use cases, simply create one `FunctionApp` and add your routes.
3
+ > **Note:** This is an advanced feature for framework extensibility. Most developers won't need to use app composition directly - it's primarily used internally for features like MCP integration and distributed tracing. For typical use cases, simply create one `FunctionApp` and add your routes.
4
+
5
+ Introspection endpoints (`/__schema__`, `/__routes__`, `/__health__`, `/__ping__`, `/__client_methods__`) are prepended automatically by `create_function_service()`. You do not need to compose an `IntrospectionApp`. Pass `introspection=False` to opt out. See [Introspection](introspection.md).
4
6
 
5
7
  The framework supports composing multiple apps together to create modular services.
6
8
 
@@ -18,19 +20,18 @@ App composition allows you to combine multiple `FunctionApp` instances into a si
18
20
  Compose multiple apps using `create_function_service()`:
19
21
 
20
22
  ```python
21
- from cognite_function_apps import FunctionApp, create_function_service
22
- from cognite_function_apps.introspection import create_introspection_app
23
+ from cognite_function_apps import FunctionApp, create_function_service, create_tracing_app
23
24
 
24
25
  # Create individual apps
25
- introspection_app = create_introspection_app()
26
+ tracing_app = create_tracing_app()
26
27
  main_app = FunctionApp("Asset Management API", "2.1.0")
27
28
 
28
29
  @main_app.get("/assets/{asset_id}")
29
30
  def get_asset(client: CogniteClient, asset_id: int) -> dict[str, Any]:
30
31
  return {"id": asset_id, "name": f"Asset {asset_id}"}
31
32
 
32
- # Compose apps
33
- handle = create_function_service(introspection_app, main_app)
33
+ # Compose apps — introspection is prepended automatically
34
+ handle = create_function_service(tracing_app, main_app)
34
35
  ```
35
36
 
36
37
  ## Composition Rules
@@ -97,11 +98,10 @@ See [Dependency Injection](dependency-injection.md) for more information.
97
98
  Separate system utilities from business logic:
98
99
 
99
100
  ```python
100
- from cognite_function_apps import FunctionApp, create_function_service
101
- from cognite_function_apps.introspection import create_introspection_app
101
+ from cognite_function_apps import FunctionApp, create_function_service, create_tracing_app
102
102
 
103
- # System app provides introspection endpoints
104
- introspection = create_introspection_app()
103
+ # System app provides tracing
104
+ tracing = create_tracing_app()
105
105
 
106
106
  # Business app provides domain logic
107
107
  business_app = FunctionApp("Business API", "1.0.0")
@@ -111,7 +111,7 @@ def get_order(client: CogniteClient, order_id: int) -> dict[str, Any]:
111
111
  return {"order_id": order_id}
112
112
 
113
113
  # System endpoints first, then business logic
114
- handle = create_function_service(introspection, business_app)
114
+ handle = create_function_service(tracing, business_app)
115
115
  ```
116
116
 
117
117
  ### Full Stack Pattern
@@ -124,36 +124,29 @@ from cognite_function_apps import (
124
124
  create_function_service,
125
125
  create_tracing_app,
126
126
  )
127
- from cognite_function_apps.introspection import create_introspection_app
128
127
  from cognite_function_apps.mcp import create_mcp_app
129
128
 
130
129
  # Create all apps
131
130
  tracing = create_tracing_app()
132
131
  mcp = create_mcp_app()
133
- introspection = create_introspection_app()
134
132
  main_app = FunctionApp("My API", "1.0.0")
135
133
 
136
134
  @main_app.get("/items/{item_id}")
137
135
  def get_item(client: CogniteClient, item_id: int) -> dict[str, Any]:
138
136
  return {"id": item_id}
139
137
 
140
- # Complete composition: tracing + AI tools + debugging + business logic
141
- handle = create_function_service(tracing, mcp, introspection, main_app)
138
+ # Complete composition: tracing + AI tools + business logic
139
+ # Introspection is prepended automatically
140
+ handle = create_function_service(tracing, mcp, main_app)
142
141
  ```
143
142
 
144
- ### Development Pattern
143
+ ### Opting Out of Introspection
145
144
 
146
- Add debugging capabilities to existing services:
145
+ Introspection is on by default. Disable it when you need to hide system endpoints:
147
146
 
148
147
  ```python
149
- from cognite_function_apps.introspection import create_introspection_app
150
-
151
- # Your existing service
152
148
  existing_app = FunctionApp("Production API", "1.0.0")
153
-
154
- # Add introspection for debugging
155
- introspection = create_introspection_app()
156
- debug_handle = create_function_service(introspection, existing_app)
149
+ handle = create_function_service(existing_app, introspection=False)
157
150
  ```
158
151
 
159
152
  ## Cross-App Introspection
@@ -162,18 +155,16 @@ When apps are composed, introspection endpoints show routes from all apps:
162
155
 
163
156
  ```python
164
157
  from cognite_function_apps import FunctionApp, create_function_service
165
- from cognite_function_apps.introspection import create_introspection_app
166
158
  from cognite_function_apps.mcp import create_mcp_app
167
159
 
168
160
  mcp = create_mcp_app()
169
- introspection = create_introspection_app()
170
161
  main_app = FunctionApp("My API", "1.0.0")
171
162
 
172
163
  @main_app.get("/items/{item_id}")
173
164
  def get_item(client: CogniteClient, item_id: int) -> dict[str, Any]:
174
165
  return {"id": item_id}
175
166
 
176
- handle = create_function_service(mcp, introspection, main_app)
167
+ handle = create_function_service(mcp, main_app)
177
168
  ```
178
169
 
179
170
  The `/__schema__` endpoint returns a unified OpenAPI schema including:
@@ -285,8 +276,8 @@ handle = create_function_service(custom_app, main_app)
285
276
  ### Clean Separation of Concerns
286
277
 
287
278
  ```python
288
- # System concerns (tracing, introspection)
289
- system_app = create_introspection_app()
279
+ # System concerns (tracing)
280
+ system_app = create_tracing_app()
290
281
 
291
282
  # Business concerns (domain logic)
292
283
  business_app = FunctionApp("Orders API", "1.0.0")
@@ -310,17 +301,14 @@ service3 = create_function_service(monitoring_app, app3)
310
301
  ### Progressive Enhancement
311
302
 
312
303
  ```python
313
- # Start simple
304
+ # Start simple (introspection included automatically)
314
305
  handle = create_function_service(app)
315
306
 
316
- # Add introspection
317
- handle = create_function_service(introspection, app)
318
-
319
307
  # Add tracing
320
- handle = create_function_service(tracing, introspection, app)
308
+ handle = create_function_service(tracing, app)
321
309
 
322
310
  # Add AI integration
323
- handle = create_function_service(mcp, tracing, introspection, app)
311
+ handle = create_function_service(mcp, tracing, app)
324
312
  ```
325
313
 
326
314
  ## Best Practices
@@ -333,7 +321,6 @@ Put system apps before business apps:
333
321
  # **Good** - system apps first
334
322
  handle = create_function_service(
335
323
  tracing_app, # System
336
- introspection_app, # System
337
324
  mcp_app, # System
338
325
  main_app # Business (provides metadata)
339
326
  )
@@ -341,7 +328,7 @@ handle = create_function_service(
341
328
  # **Bad** - business app first
342
329
  handle = create_function_service(
343
330
  main_app, # Business
344
- introspection_app # System (won't provide metadata)
331
+ tracing_app # System (won't provide metadata)
345
332
  )
346
333
  ```
347
334
 
@@ -354,7 +341,7 @@ The last app should be your main business app:
354
341
  handle = create_function_service(system_apps..., main_business_app)
355
342
 
356
343
  # **Bad** - utility app provides metadata
357
- handle = create_function_service(main_business_app, introspection_app)
344
+ handle = create_function_service(main_business_app, tracing_app)
358
345
  ```
359
346
 
360
347
  ### Keep Apps Focused
@@ -391,7 +378,7 @@ handle = create_function_service(app)
391
378
 
392
379
  Only use composition when you need:
393
380
 
394
- - Framework extensions (introspection, MCP, tracing)
381
+ - Framework extensions (MCP, tracing)
395
382
  - Reusable middleware components
396
383
  - Clear separation between system and business concerns
397
384
 
@@ -64,7 +64,7 @@ Creates composed handler from multiple apps with optional custom registry.
64
64
  **Example:**
65
65
 
66
66
  ```python
67
- handle = create_function_service(introspection, main_app, registry=custom_registry)
67
+ handle = create_function_service(mcp, main_app, registry=custom_registry)
68
68
  ```
69
69
 
70
70
  ### 3. App Composition System
@@ -285,8 +285,8 @@ Provides distributed tracing support via OpenTelemetry.
285
285
  Apps are composable building blocks that can be combined:
286
286
 
287
287
  ```python
288
- # Compose any combination of apps
289
- handle = create_function_service(tracing, mcp, introspection, main_app)
288
+ # Compose any combination of apps (introspection is prepended automatically)
289
+ handle = create_function_service(tracing, mcp, main_app)
290
290
  ```
291
291
 
292
292
  ### 2. Type Safety
@@ -277,7 +277,6 @@ from cognite_function_apps import (
277
277
  FunctionTracer,
278
278
  )
279
279
  from cognite_function_apps.mcp import create_mcp_app
280
- from cognite_function_apps.introspection import create_introspection_app
281
280
 
282
281
  # Create your main app
283
282
  app = FunctionApp(title="My API", version="1.0.0")
@@ -291,10 +290,9 @@ def get_item(client: CogniteClient, tracer: FunctionTracer, item_id: int) -> dic
291
290
  # Create extension apps
292
291
  tracing_app = create_tracing_app() # Provides FunctionTracer dependency
293
292
  mcp_app = create_mcp_app()
294
- introspection_app = create_introspection_app()
295
293
 
296
294
  # Compose apps - FunctionTracer is now available to all apps!
297
- handle = create_function_service(tracing_app, introspection_app, mcp_app, app)
295
+ handle = create_function_service(tracing_app, mcp_app, app)
298
296
 
299
297
  # Now MCP tools can also use 'tracer' with the same parameter name
300
298
  @mcp_app.tool("Get item with tracing")
@@ -88,10 +88,52 @@ fun serve . --no-reload
88
88
  # Adjust log level
89
89
  fun serve . --log-level debug
90
90
 
91
+ # Wait for a debugger to attach on 127.0.0.1:5678 (disables auto-reload)
92
+ fun serve . --debugpy
93
+
94
+ # Use a different debugger port
95
+ fun serve . --debugpy --debugpy-port 5679
96
+
91
97
  # Combine options
92
98
  fun serve . --port 3000 --log-level debug
93
99
  ```
94
100
 
101
+ ### Attaching a Debugger
102
+
103
+ To start and debug the local server from an IDE that uses `launch.json`, add this launch configuration. It prompts for the Function App directory, opens Swagger UI when Uvicorn is ready, and lets breakpoints in handler code pause execution.
104
+
105
+ ```json
106
+ {
107
+ "version": "0.2.0",
108
+ "configurations": [
109
+ {
110
+ "name": "Debug Function App",
111
+ "type": "debugpy",
112
+ "request": "launch",
113
+ "module": "cognite_function_apps.cli",
114
+ "args": ["serve", "${input:appPath}"],
115
+ "console": "internalConsole",
116
+ "serverReadyAction": {
117
+ "action": "openExternally",
118
+ "pattern": "Uvicorn running on (http://\\S+)",
119
+ "uriFormat": "%s/docs"
120
+ },
121
+ "justMyCode": true
122
+ }
123
+ ],
124
+ "inputs": [
125
+ {
126
+ "id": "appPath",
127
+ "type": "promptString",
128
+ "description": "Path to Function App folder or file",
129
+ "default": "."
130
+ }
131
+ ]
132
+ }
133
+ ```
134
+
135
+ Select **Debug Function App** in the IDE, enter the Function App directory, and start debugging.
136
+
95
137
  #### Option B: Manual Setup
96
138
 
97
139
  If you prefer more control, create a `dev.py` file next to your handler:
@@ -146,22 +188,16 @@ Once your server is running, open your browser and navigate to:
146
188
 
147
189
  ### How Documentation Works
148
190
 
149
- The Swagger UI at `/docs` is powered by your app's `/__schema__` endpoint, provided by `create_introspection_app()`.
150
- Include it in your composition:
191
+ The Swagger UI at `/docs` is powered by your app's `/__schema__` endpoint.
192
+ That endpoint is included automatically by `create_function_service()`.
151
193
 
152
194
  ```python
153
- from cognite_function_apps import (
154
- FunctionApp,
155
- create_function_service,
156
- create_introspection_app,
157
- )
195
+ from cognite_function_apps import FunctionApp, create_function_service
158
196
 
159
- introspection = create_introspection_app() # provides /__schema__ for Swagger UI
160
197
  app = FunctionApp("My API", "1.0.0")
161
198
 
162
- # introspection is listed first so its system routes take precedence
163
- # The dev server automatically adds /docs and /openapi.json on top
164
- handle = create_function_service(introspection, app)
199
+ # /__schema__ is available by default; the dev server adds /docs and /openapi.json
200
+ handle = create_function_service(app)
165
201
  ```
166
202
 
167
203
  The development server:
@@ -255,6 +291,16 @@ fun serve . --log-level debug
255
291
  fun serve . --no-reload
256
292
  ```
257
293
 
294
+ ### Supplying a client
295
+
296
+ The dev server warns by default that Swagger calls use real CDF credentials, including the configured project and cluster. When embedding it, provide a client factory instead of replacing internal client creation.
297
+
298
+ ```python
299
+ from cognite_function_apps.devserver import create_asgi_app
300
+
301
+ app = create_asgi_app(handle, client_factory=create_local_client)
302
+ ```
303
+
258
304
  ### Using uvicorn directly
259
305
 
260
306
  If you're using the manual setup with `dev.py`:
@@ -1,4 +1,4 @@
1
- <!-- Auto-generated from docs-src/introspection.py at 2026-03-22T09:47:53Z, do not edit -->
1
+ <!-- Auto-generated from docs-src/introspection.py at 2026-09-14T22:06:45Z, do not edit -->
2
2
 
3
3
  <!-- #region -->
4
4
  # Introspection
@@ -138,6 +138,10 @@ curl "https://your-function-url" -d '{"path": "/__health__", "method": "GET"}'
138
138
  }
139
139
  ```
140
140
 
141
+ When `TracingApp` is composed, `data.checks.tracing` reports whether the tracing
142
+ API key resolved (`enabled`) or why tracing is disabled (`detail`). Export
143
+ failures are stored on `last_flush_error` instead of being written to stdout.
144
+
141
145
  ### `/__ping__`
142
146
 
143
147
  Simple connectivity check for monitoring and pre-warming.
@@ -224,7 +228,8 @@ This endpoint is used by [FunctionClient](function-client.md) to enable dynamic
224
228
 
225
229
  ## Enabling Introspection
226
230
 
227
- Introspection endpoints are provided by the `IntrospectionApp`. Include it in your app composition:
231
+ Introspection endpoints are included automatically when you call `create_function_service()`.
232
+ You do not need to create or compose an `IntrospectionApp`.
228
233
  <!-- #endregion -->
229
234
 
230
235
  ```python
@@ -233,7 +238,6 @@ from typing import Any
233
238
  from cognite.client import CogniteClient
234
239
 
235
240
  from cognite_function_apps import FunctionApp, create_function_service
236
- from cognite_function_apps.introspection import create_introspection_app
237
241
 
238
242
  # Create your main app
239
243
  app = FunctionApp(title="My API", version="1.0.0")
@@ -244,25 +248,29 @@ def get_item(client: CogniteClient, item_id: int) -> dict[str, Any]:
244
248
  return {"id": item_id}
245
249
 
246
250
 
247
- # Create introspection app
248
- introspection = create_introspection_app()
251
+ # /__schema__, /__routes__, /__health__, /__ping__, and /__client_methods__ are available
252
+ handle = create_function_service(app)
253
+ ```
254
+
255
+ <!-- #region -->
256
+ Pass `introspection=False` to opt out. Passing an explicit `IntrospectionApp` still
257
+ works and prevents a second copy from being injected:
249
258
 
250
- # Compose apps - introspection endpoints are now available
251
- handle = create_function_service(introspection, app)
259
+ ```python
260
+ handle = create_function_service(app, introspection=False)
252
261
  ```
253
262
 
254
263
  ## Cross-App Introspection
255
264
 
256
265
  When composing multiple apps, introspection endpoints show routes from all apps:
266
+ <!-- #endregion -->
257
267
 
258
268
  ```python
259
269
  from cognite_function_apps import FunctionApp, create_function_service
260
- from cognite_function_apps.introspection import create_introspection_app
261
270
  from cognite_function_apps.mcp import create_mcp_app
262
271
 
263
272
  # Create apps
264
273
  mcp = create_mcp_app()
265
- introspection = create_introspection_app()
266
274
  main_app = FunctionApp(title="My API", version="1.0.0")
267
275
 
268
276
 
@@ -271,8 +279,8 @@ def get_item(client: CogniteClient, item_id: int) -> dict[str, Any]: # type: ig
271
279
  return {"id": item_id}
272
280
 
273
281
 
274
- # Compose all apps
275
- handle = create_function_service(mcp, introspection, main_app)
282
+ # Compose all apps — introspection is prepended automatically
283
+ handle = create_function_service(mcp, main_app)
276
284
  ```
277
285
 
278
286
  The `/__schema__` response will include:
@@ -510,16 +518,16 @@ def search_items_bad(client: CogniteClient, q: str, n: int = 10, a: bool = False
510
518
  return {}
511
519
  ```
512
520
 
513
- ### Include Introspection in All Deployments
521
+ ### Keep Introspection Enabled in Production
514
522
 
515
- Always include the introspection app in production deployments:
523
+ Leave the default (`introspection=True`) so deployed functions stay discoverable:
516
524
 
517
525
  ```python
518
- # Good - introspection in production
519
- handle = create_function_service(introspection, main_app)
520
-
521
- # Bad - no visibility into deployed function
526
+ # Good - default, introspection included
522
527
  handle = create_function_service(main_app)
528
+
529
+ # Opt out only when you need to hide system endpoints
530
+ handle = create_function_service(main_app, introspection=False)
523
531
  ```
524
532
 
525
533
  ## See Also
@@ -83,7 +83,6 @@ Create an MCP app and use the `@mcp.tool()` decorator to expose functions as AI
83
83
  ```python
84
84
  from cognite_function_apps import FunctionApp, create_function_service
85
85
  from cognite_function_apps.mcp import create_mcp_app
86
- from cognite_function_apps.introspection import create_introspection_app
87
86
 
88
87
  # Create your main business app
89
88
  app = FunctionApp(title="Asset Management API", version="1.0.0")
@@ -102,11 +101,8 @@ def get_item_for_ai(client: CogniteClient, item_id: int) -> dict[str, Any]:
102
101
  """AI-accessible version of get_item"""
103
102
  return get_item(client, item_id)
104
103
 
105
- # Create introspection app
106
- introspection = create_introspection_app()
107
-
108
- # Compose all apps
109
- handle = create_function_service(mcp, introspection, app)
104
+ # Compose apps — introspection is prepended automatically
105
+ handle = create_function_service(mcp, app)
110
106
  ```
111
107
 
112
108
  ## Exposing Existing Endpoints
@@ -383,7 +379,6 @@ Complete example with multiple MCP tools:
383
379
  ```python
384
380
  from cognite_function_apps import FunctionApp, create_function_service
385
381
  from cognite_function_apps.mcp import create_mcp_app
386
- from cognite_function_apps.introspection import create_introspection_app
387
382
  from pydantic import BaseModel
388
383
 
389
384
  # Models
@@ -399,7 +394,6 @@ class AssetInfo(BaseModel):
399
394
  # Create apps
400
395
  app = FunctionApp(title="Asset Management", version="1.0.0")
401
396
  mcp = create_mcp_app()
402
- introspection = create_introspection_app()
403
397
 
404
398
  # MCP Tools
405
399
  @mcp.tool(description="Search for assets by name")
@@ -432,8 +426,8 @@ def get_asset_hierarchy(client: CogniteClient, asset_id: int, depth: int = 2) ->
432
426
  "children": [] # Implement hierarchy logic
433
427
  }
434
428
 
435
- # Compose
436
- handle = create_function_service(mcp, introspection, app)
429
+ # Compose — introspection is prepended automatically
430
+ handle = create_function_service(mcp, app)
437
431
  ```
438
432
 
439
433
  ## Best Practices
@@ -346,7 +346,6 @@ def get_image(client: CogniteClient, image_id: int) -> dict[str, Any]:
346
346
  ```python
347
347
  from cognite_function_apps import FunctionApp, Response, create_function_service
348
348
  from cognite_function_apps.models import RequestHeaders
349
- from cognite_function_apps.introspection import create_introspection_app
350
349
  from cognite.client import CogniteClient
351
350
  from pydantic import BaseModel
352
351
 
@@ -386,9 +385,7 @@ def create_item(
386
385
  # Sync creation
387
386
  return Response(data=item, status_code=201)
388
387
 
389
- # Create service with introspection
390
- introspection = create_introspection_app()
391
- handle = create_function_service(introspection, app)
388
+ handle = create_function_service(app)
392
389
  ```
393
390
 
394
391
  ## Best Practices
@@ -1,4 +1,4 @@
1
- <!-- Auto-generated from docs-src/tracing.py at 2026-03-20T14:15:32Z, do not edit -->
1
+ <!-- Auto-generated from docs-src/tracing.py at 2026-09-14T22:06:44Z, do not edit -->
2
2
 
3
3
  <!-- #region -->
4
4
  # Distributed Tracing
@@ -425,14 +425,17 @@ Or with `uv`:
425
425
  uv add 'cognite-function-apps[tracing]'
426
426
  ```
427
427
 
428
- **Error: `Secret 'tracing-api-key' not found in CDF secrets or environment variables`**
428
+ **Traces not appearing / tracing disabled**
429
429
 
430
- The tracing API key is missing. See the [Quick Start](#quick-start) section above for how to
431
- configure secrets for deployment (SDK or Toolkit) and local development.
430
+ When a Honeycomb or Lightstep preset is used without `tracing-api-key`, tracing is
431
+ disabled silently so function JSON output stays clean. Check ``GET /__health__``:
432
+ `data.checks.tracing.enabled` is `false` and `detail` explains the missing secret.
433
+ See the [Quick Start](#quick-start) for how to configure secrets (SDK, Toolkit, or
434
+ local `.env`).
432
435
 
433
- **Error: `Failed to flush trace spans: ... 401/403/unauthorized`**
434
-
435
- Your tracing API key is invalid, expired, or revoked. Get a new key:
436
+ If the secret is present but traces still do not show, the key may be invalid,
437
+ expired, or revoked. `/__health__` may set `data.checks.tracing.last_flush_error`
438
+ after a failed export. Get a new key:
436
439
 
437
440
  - [Honeycomb](https://ui.honeycomb.io/account) → Environment Settings → API Keys
438
441
  - [LightStep](https://docs.lightstep.com/docs/create-and-manage-access-tokens)