knowledge2 0.5.0__tar.gz → 0.8.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 (162) hide show
  1. knowledge2-0.8.0/CHANGELOG.md +298 -0
  2. knowledge2-0.8.0/PKG-INFO +485 -0
  3. knowledge2-0.8.0/README.md +456 -0
  4. {knowledge2-0.5.0 → knowledge2-0.8.0}/__init__.py +3 -0
  5. {knowledge2-0.5.0 → knowledge2-0.8.0}/_async_base.py +48 -2
  6. {knowledge2-0.5.0 → knowledge2-0.8.0}/_base.py +48 -2
  7. knowledge2-0.8.0/_embedding_limits.py +13 -0
  8. knowledge2-0.8.0/_sentinels.py +33 -0
  9. {knowledge2-0.5.0 → knowledge2-0.8.0}/_validation_response.py +2 -2
  10. {knowledge2-0.5.0 → knowledge2-0.8.0}/_version.py +1 -1
  11. {knowledge2-0.5.0 → knowledge2-0.8.0}/async_client.py +16 -2
  12. {knowledge2-0.5.0 → knowledge2-0.8.0}/async_resources/__init__.py +6 -0
  13. {knowledge2-0.5.0 → knowledge2-0.8.0}/async_resources/agents.py +223 -19
  14. {knowledge2-0.5.0 → knowledge2-0.8.0}/async_resources/corpora.py +61 -1
  15. knowledge2-0.8.0/async_resources/destinations.py +249 -0
  16. {knowledge2-0.5.0 → knowledge2-0.8.0}/async_resources/documents.py +362 -9
  17. knowledge2-0.8.0/async_resources/extraction_templates.py +196 -0
  18. knowledge2-0.8.0/async_resources/feeds.py +470 -0
  19. {knowledge2-0.5.0 → knowledge2-0.8.0}/async_resources/indexes.py +37 -11
  20. {knowledge2-0.5.0 → knowledge2-0.8.0}/async_resources/pipelines.py +181 -4
  21. {knowledge2-0.5.0 → knowledge2-0.8.0}/async_resources/projects.py +29 -0
  22. knowledge2-0.8.0/async_resources/quality.py +216 -0
  23. {knowledge2-0.5.0 → knowledge2-0.8.0}/async_resources/search.py +30 -2
  24. {knowledge2-0.5.0 → knowledge2-0.8.0}/client.py +16 -3
  25. {knowledge2-0.5.0 → knowledge2-0.8.0}/examples/batch_operations.py +4 -2
  26. {knowledge2-0.5.0 → knowledge2-0.8.0}/examples/document_upload.py +3 -2
  27. {knowledge2-0.5.0 → knowledge2-0.8.0}/examples/e2e_lifecycle.py +6 -32
  28. {knowledge2-0.5.0 → knowledge2-0.8.0}/examples/retrieval_quickstart.py +2 -2
  29. {knowledge2-0.5.0 → knowledge2-0.8.0}/integrations/__init__.py +6 -6
  30. knowledge2-0.8.0/knowledge2.egg-info/PKG-INFO +485 -0
  31. {knowledge2-0.5.0 → knowledge2-0.8.0}/knowledge2.egg-info/SOURCES.txt +28 -0
  32. {knowledge2-0.5.0 → knowledge2-0.8.0}/knowledge2.egg-info/requires.txt +2 -1
  33. {knowledge2-0.5.0 → knowledge2-0.8.0}/models/__init__.py +4 -6
  34. {knowledge2-0.5.0 → knowledge2-0.8.0}/models/_registry.py +65 -0
  35. knowledge2-0.8.0/models/agents.py +376 -0
  36. {knowledge2-0.5.0 → knowledge2-0.8.0}/models/console.py +3 -0
  37. {knowledge2-0.5.0 → knowledge2-0.8.0}/models/corpora.py +3 -0
  38. knowledge2-0.8.0/models/destinations.py +31 -0
  39. {knowledge2-0.5.0 → knowledge2-0.8.0}/models/documents.py +26 -0
  40. {knowledge2-0.5.0 → knowledge2-0.8.0}/models/embeddings.py +1 -0
  41. knowledge2-0.8.0/models/extraction_templates.py +35 -0
  42. knowledge2-0.8.0/models/feeds.py +113 -0
  43. {knowledge2-0.5.0 → knowledge2-0.8.0}/models/pipelines.py +83 -0
  44. {knowledge2-0.5.0 → knowledge2-0.8.0}/models/projects.py +1 -0
  45. knowledge2-0.8.0/models/quality.py +70 -0
  46. {knowledge2-0.5.0 → knowledge2-0.8.0}/namespaces.py +68 -7
  47. {knowledge2-0.5.0 → knowledge2-0.8.0}/pyproject.toml +4 -3
  48. {knowledge2-0.5.0 → knowledge2-0.8.0}/resources/__init__.py +6 -0
  49. {knowledge2-0.5.0 → knowledge2-0.8.0}/resources/agents.py +275 -19
  50. {knowledge2-0.5.0 → knowledge2-0.8.0}/resources/corpora.py +61 -1
  51. knowledge2-0.8.0/resources/destinations.py +269 -0
  52. {knowledge2-0.5.0 → knowledge2-0.8.0}/resources/documents.py +364 -9
  53. knowledge2-0.8.0/resources/extraction_templates.py +194 -0
  54. knowledge2-0.8.0/resources/feeds.py +534 -0
  55. {knowledge2-0.5.0 → knowledge2-0.8.0}/resources/indexes.py +41 -11
  56. {knowledge2-0.5.0 → knowledge2-0.8.0}/resources/pipeline_builder.py +2 -1
  57. {knowledge2-0.5.0 → knowledge2-0.8.0}/resources/pipelines.py +243 -2
  58. {knowledge2-0.5.0 → knowledge2-0.8.0}/resources/projects.py +45 -0
  59. knowledge2-0.8.0/resources/quality.py +216 -0
  60. {knowledge2-0.5.0 → knowledge2-0.8.0}/resources/search.py +30 -2
  61. {knowledge2-0.5.0 → knowledge2-0.8.0}/types/__init__.py +67 -0
  62. knowledge2-0.8.0/types/agents.py +395 -0
  63. {knowledge2-0.5.0 → knowledge2-0.8.0}/types/console.py +3 -0
  64. {knowledge2-0.5.0 → knowledge2-0.8.0}/types/corpora.py +3 -0
  65. knowledge2-0.8.0/types/destinations.py +31 -0
  66. {knowledge2-0.5.0 → knowledge2-0.8.0}/types/documents.py +26 -0
  67. {knowledge2-0.5.0 → knowledge2-0.8.0}/types/embeddings.py +1 -0
  68. knowledge2-0.8.0/types/extraction_templates.py +39 -0
  69. knowledge2-0.8.0/types/feeds.py +128 -0
  70. {knowledge2-0.5.0 → knowledge2-0.8.0}/types/pipelines.py +100 -0
  71. {knowledge2-0.5.0 → knowledge2-0.8.0}/types/projects.py +1 -0
  72. knowledge2-0.8.0/types/quality.py +80 -0
  73. knowledge2-0.5.0/CHANGELOG.md +0 -85
  74. knowledge2-0.5.0/PKG-INFO +0 -217
  75. knowledge2-0.5.0/README.md +0 -189
  76. knowledge2-0.5.0/async_resources/feeds.py +0 -233
  77. knowledge2-0.5.0/knowledge2.egg-info/PKG-INFO +0 -217
  78. knowledge2-0.5.0/models/agents.py +0 -143
  79. knowledge2-0.5.0/models/feeds.py +0 -55
  80. knowledge2-0.5.0/resources/feeds.py +0 -231
  81. knowledge2-0.5.0/types/agents.py +0 -180
  82. knowledge2-0.5.0/types/feeds.py +0 -59
  83. {knowledge2-0.5.0 → knowledge2-0.8.0}/.github/workflows/pypi-release.yml +0 -0
  84. {knowledge2-0.5.0 → knowledge2-0.8.0}/MANIFEST.in +0 -0
  85. {knowledge2-0.5.0 → knowledge2-0.8.0}/_async_paging.py +0 -0
  86. {knowledge2-0.5.0 → knowledge2-0.8.0}/_logging.py +0 -0
  87. {knowledge2-0.5.0 → knowledge2-0.8.0}/_paging.py +0 -0
  88. {knowledge2-0.5.0 → knowledge2-0.8.0}/_preview.py +0 -0
  89. {knowledge2-0.5.0 → knowledge2-0.8.0}/_raw_response.py +0 -0
  90. {knowledge2-0.5.0 → knowledge2-0.8.0}/_request_options.py +0 -0
  91. {knowledge2-0.5.0 → knowledge2-0.8.0}/_transport.py +0 -0
  92. {knowledge2-0.5.0 → knowledge2-0.8.0}/_validation.py +0 -0
  93. {knowledge2-0.5.0 → knowledge2-0.8.0}/async_resources/_mixin_base.py +0 -0
  94. {knowledge2-0.5.0 → knowledge2-0.8.0}/async_resources/a2a.py +0 -0
  95. {knowledge2-0.5.0 → knowledge2-0.8.0}/async_resources/audit.py +0 -0
  96. {knowledge2-0.5.0 → knowledge2-0.8.0}/async_resources/auth.py +0 -0
  97. {knowledge2-0.5.0 → knowledge2-0.8.0}/async_resources/console.py +0 -0
  98. {knowledge2-0.5.0 → knowledge2-0.8.0}/async_resources/generation_models.py +0 -0
  99. {knowledge2-0.5.0 → knowledge2-0.8.0}/async_resources/jobs.py +0 -0
  100. {knowledge2-0.5.0 → knowledge2-0.8.0}/async_resources/metadata.py +0 -0
  101. {knowledge2-0.5.0 → knowledge2-0.8.0}/async_resources/onboarding.py +0 -0
  102. {knowledge2-0.5.0 → knowledge2-0.8.0}/async_resources/orgs.py +0 -0
  103. {knowledge2-0.5.0 → knowledge2-0.8.0}/async_resources/usage.py +0 -0
  104. {knowledge2-0.5.0 → knowledge2-0.8.0}/config.py +0 -0
  105. {knowledge2-0.5.0 → knowledge2-0.8.0}/errors.py +0 -0
  106. {knowledge2-0.5.0 → knowledge2-0.8.0}/examples/auth_factory.py +0 -0
  107. {knowledge2-0.5.0 → knowledge2-0.8.0}/examples/error_handling.py +0 -0
  108. {knowledge2-0.5.0 → knowledge2-0.8.0}/examples/pagination.py +0 -0
  109. {knowledge2-0.5.0 → knowledge2-0.8.0}/examples/quickstart.py +0 -0
  110. {knowledge2-0.5.0 → knowledge2-0.8.0}/examples/request_options.py +0 -0
  111. {knowledge2-0.5.0 → knowledge2-0.8.0}/examples/search.py +0 -0
  112. {knowledge2-0.5.0 → knowledge2-0.8.0}/integrations/_client.py +0 -0
  113. {knowledge2-0.5.0 → knowledge2-0.8.0}/integrations/langchain/__init__.py +0 -0
  114. {knowledge2-0.5.0 → knowledge2-0.8.0}/integrations/langchain/retriever.py +0 -0
  115. {knowledge2-0.5.0 → knowledge2-0.8.0}/integrations/langchain/tools.py +0 -0
  116. {knowledge2-0.5.0 → knowledge2-0.8.0}/integrations/llamaindex/__init__.py +0 -0
  117. {knowledge2-0.5.0 → knowledge2-0.8.0}/integrations/llamaindex/filters.py +0 -0
  118. {knowledge2-0.5.0 → knowledge2-0.8.0}/integrations/llamaindex/retriever.py +0 -0
  119. {knowledge2-0.5.0 → knowledge2-0.8.0}/integrations/llamaindex/tools.py +0 -0
  120. {knowledge2-0.5.0 → knowledge2-0.8.0}/integrations/llamaindex/vector_store.py +0 -0
  121. {knowledge2-0.5.0 → knowledge2-0.8.0}/knowledge2.egg-info/dependency_links.txt +0 -0
  122. {knowledge2-0.5.0 → knowledge2-0.8.0}/knowledge2.egg-info/top_level.txt +0 -0
  123. {knowledge2-0.5.0 → knowledge2-0.8.0}/models/_base.py +0 -0
  124. {knowledge2-0.5.0 → knowledge2-0.8.0}/models/a2a.py +0 -0
  125. {knowledge2-0.5.0 → knowledge2-0.8.0}/models/audit.py +0 -0
  126. {knowledge2-0.5.0 → knowledge2-0.8.0}/models/auth.py +0 -0
  127. {knowledge2-0.5.0 → knowledge2-0.8.0}/models/chunks.py +0 -0
  128. {knowledge2-0.5.0 → knowledge2-0.8.0}/models/common.py +0 -0
  129. {knowledge2-0.5.0 → knowledge2-0.8.0}/models/feedback.py +0 -0
  130. {knowledge2-0.5.0 → knowledge2-0.8.0}/models/generation_models.py +0 -0
  131. {knowledge2-0.5.0 → knowledge2-0.8.0}/models/indexes.py +0 -0
  132. {knowledge2-0.5.0 → knowledge2-0.8.0}/models/jobs.py +0 -0
  133. {knowledge2-0.5.0 → knowledge2-0.8.0}/models/onboarding.py +0 -0
  134. {knowledge2-0.5.0 → knowledge2-0.8.0}/models/orgs.py +0 -0
  135. {knowledge2-0.5.0 → knowledge2-0.8.0}/models/search.py +0 -0
  136. {knowledge2-0.5.0 → knowledge2-0.8.0}/models/usage.py +0 -0
  137. {knowledge2-0.5.0 → knowledge2-0.8.0}/py.typed +0 -0
  138. {knowledge2-0.5.0 → knowledge2-0.8.0}/resources/_mixin_base.py +0 -0
  139. {knowledge2-0.5.0 → knowledge2-0.8.0}/resources/a2a.py +0 -0
  140. {knowledge2-0.5.0 → knowledge2-0.8.0}/resources/audit.py +0 -0
  141. {knowledge2-0.5.0 → knowledge2-0.8.0}/resources/auth.py +0 -0
  142. {knowledge2-0.5.0 → knowledge2-0.8.0}/resources/console.py +0 -0
  143. {knowledge2-0.5.0 → knowledge2-0.8.0}/resources/generation_models.py +0 -0
  144. {knowledge2-0.5.0 → knowledge2-0.8.0}/resources/jobs.py +0 -0
  145. {knowledge2-0.5.0 → knowledge2-0.8.0}/resources/metadata.py +0 -0
  146. {knowledge2-0.5.0 → knowledge2-0.8.0}/resources/onboarding.py +0 -0
  147. {knowledge2-0.5.0 → knowledge2-0.8.0}/resources/orgs.py +0 -0
  148. {knowledge2-0.5.0 → knowledge2-0.8.0}/resources/usage.py +0 -0
  149. {knowledge2-0.5.0 → knowledge2-0.8.0}/setup.cfg +0 -0
  150. {knowledge2-0.5.0 → knowledge2-0.8.0}/types/a2a.py +0 -0
  151. {knowledge2-0.5.0 → knowledge2-0.8.0}/types/audit.py +0 -0
  152. {knowledge2-0.5.0 → knowledge2-0.8.0}/types/auth.py +0 -0
  153. {knowledge2-0.5.0 → knowledge2-0.8.0}/types/chunks.py +0 -0
  154. {knowledge2-0.5.0 → knowledge2-0.8.0}/types/common.py +0 -0
  155. {knowledge2-0.5.0 → knowledge2-0.8.0}/types/feedback.py +0 -0
  156. {knowledge2-0.5.0 → knowledge2-0.8.0}/types/generation_models.py +0 -0
  157. {knowledge2-0.5.0 → knowledge2-0.8.0}/types/indexes.py +0 -0
  158. {knowledge2-0.5.0 → knowledge2-0.8.0}/types/jobs.py +0 -0
  159. {knowledge2-0.5.0 → knowledge2-0.8.0}/types/onboarding.py +0 -0
  160. {knowledge2-0.5.0 → knowledge2-0.8.0}/types/orgs.py +0 -0
  161. {knowledge2-0.5.0 → knowledge2-0.8.0}/types/search.py +0 -0
  162. {knowledge2-0.5.0 → knowledge2-0.8.0}/types/usage.py +0 -0
@@ -0,0 +1,298 @@
1
+ # Changelog
2
+
3
+ All notable changes to the Knowledge² Python SDK will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## Unreleased
9
+
10
+ ### Changed
11
+
12
+ - **`validate_responses=True` now returns typed run envelopes.** Under response
13
+ validation, `run_agent(..., wait=True)`'s `result` and each `list_agent_runs()`
14
+ item's `result` are now `AgentRunEnvelope` models (attribute access:
15
+ `.content`, `.fields.inferred`, `.metadata.inferred`, `.metadata.provenance`)
16
+ rather than raw dicts. A malformed envelope raises `ValidationError` (as with
17
+ every other validated model), consistent across both read paths. The default
18
+ (`validate_responses=False`) is unchanged — raw dicts. Also: `Provenance` now
19
+ types `source_refs`, and `TaskTypeInfo.unavailable_reason` is narrowed to
20
+ `Literal["env", "org"] | None`. (#2594)
21
+
22
+ ### Added
23
+
24
+ - `client.backfill_feed(feed_id, *, start_from)` (sync) and
25
+ `await client.backfill_feed(...)` (async) — re-enqueue a backfill
26
+ on an existing feed without delete-and-recreate. Resets the feed
27
+ cursor and updates `Feed.start_from`; the worker re-sweeps the
28
+ corpus `CorpusChangeEvent` history from the supplied cutoff.
29
+ Returns `{job_id, start_from, previous_last_checked_seq}` (`202
30
+ Accepted`). Raises `ConflictError` (`code="feed_backfill_in_flight"`)
31
+ when a `run_feed` job for this feed is already queued or running;
32
+ raises `ValidationError` for future `start_from`. Per-feed-run
33
+ feedback lineage (#969) survives — every backfill produces a new
34
+ `feed_run_id`. (#2328)
35
+ - `schedule_cron` kwarg on `create_feed(...)` / `update_feed(...)`
36
+ (sync + async) — UTC five-field cron expression for calendar-aware
37
+ feed schedules (e.g. `"0 9 * * MON"`). Mutually exclusive with
38
+ `schedule_interval`; requires `persistent=True`; rejected when
39
+ combined with `reactive=True`. Invalid expressions surface as
40
+ `422 ValidationError` with the underlying croniter message. New
41
+ field also surfaces on `FeedResponse`. (#2305)
42
+ - `FeedRunResponse.generated_answer` (`dict | None`) — when
43
+ `execution_mode="answer"` and the retrieval step returns results,
44
+ the API now runs the full agent LLM via `execute_agent_task` over
45
+ the chunks and returns the envelope on the run response. Generation
46
+ failures are logged and downgrade gracefully (the response is still
47
+ returned without `generated_answer`). Previously the API raised
48
+ `501` for `answer` mode. (#2303)
49
+ - `client.trigger_pipeline_spec(pipeline_spec_id)` (sync) and
50
+ `await client.trigger_pipeline_spec(...)` (async) — manually fire a
51
+ pipeline run against the spec's bound feeds. Returns
52
+ `{pipeline_run_id, child_run_ids}`; the freshly minted UUID is
53
+ stamped on every follow-on job spawned during the trigger's unwind so
54
+ the entire causal tree shares one correlation id (queryable via the
55
+ forthcoming FR-16e history endpoint). New `PipelineTriggerResponse`
56
+ TypedDict + Pydantic model registered for `validate_responses=True`.
57
+ (#2298)
58
+ - `client.list_feed_runs(feed_id, *, limit, offset)` (sync) and
59
+ `await client.list_feed_runs(...)` (async) — paginated feed-run
60
+ history mirroring `list_agent_runs`. Returns the `run_feed` job
61
+ rows for the feed; the worker-internal `ingest_feed_results`
62
+ follow-on jobs are excluded server-side. (#2296)
63
+ - `client.list_project_subscriptions(project_id, *, agent_id, feed_id,
64
+ limit, offset)` (sync) and `await client.list_project_subscriptions(...)`
65
+ (async) — paginated project-scoped subscriptions admin list. Returns
66
+ per-row admin summary fields (derived `mode`, `destination_count`,
67
+ `last_delivery_status`, `last_delivery_at`) so callers can build a
68
+ cross-agent overview without N+1 fetches. Powers the
69
+ `/subscriptions` page in the console. (#2297)
70
+ - `client.run_agent(agent_id, *, input_chunks, wait, poll_s, timeout_s)`
71
+ (sync) and `await client.run_agent(...)` (async) gain
72
+ `wait=True` synchronous semantics. The default remains `wait=False`
73
+ (preserves today's 202-and-return behavior); opting in returns the
74
+ full job dict (`job_id` / `status` / `result` / `error_message`) once
75
+ the run reaches a terminal state. Raises `TimeoutError` past
76
+ `timeout_s` and `RuntimeError` on `failed` / `canceled` —
77
+ matching the exception contract of `upload_documents_batch(...,
78
+ wait=True)` and `optimize_indexes(..., wait=True)`. (#2343)
79
+
80
+ ### Changed
81
+
82
+ - **`task_type` and `intent_fallback` are now narrowed to `Literal` aliases.**
83
+ Pre-#2291 the Python SDK declared both as bare `str`, so typos like
84
+ `task_type="exract"` only failed at the server's 422. Post-#2291 the new
85
+ `TaskType` and `IntentFallback` `Literal` aliases at `sdk.types.agents`
86
+ (re-exported from `sdk.types`) catch typos at static-analysis time. The
87
+ Pydantic response models (`sdk.models.agents`) and the resource method
88
+ signatures (`create_agent`, `update_agent` on both sync and async clients)
89
+ are narrowed in lockstep. The TS SDK gets symmetric `TaskType` and
90
+ `IntentFallback` literal unions exported from
91
+ `sdk-ts/src/resources/agents.ts` and re-exported from the package root
92
+ (`@knowledge2/sdk`) so npm consumers can import them directly. Note: the
93
+ TS SDK additionally corrected a pre-existing phantom-field bug on its
94
+ `AgentRun` interface — the Python `AgentRunListItem` TypedDict was
95
+ already correct and is unchanged by this PR. (#2291)
96
+ - **`tool_config` is now a kind-discriminated tagged union.** Pre-#2307,
97
+ `tool_config` was a flat dict treated as webhook-only. Post-#2307 the
98
+ canonical shape is `{"kind": "webhook" | "mcp", "webhook": {...} | "mcp": {...}}`.
99
+ Two TypedDict envelopes are added (`ToolConfigWebhook`, `ToolConfigMcp`) plus
100
+ the helper alias `ToolConfigRequest` in `sdk.types.agents`. The legacy flat
101
+ shape (`{"webhook_url": "..."}`) is still accepted on write — the server
102
+ coerces it to the kinded shape via `_coerce_legacy_tool_config`. Response
103
+ shape (`ToolConfigResponseModel`) now carries `kind`, `webhook`, and `mcp`
104
+ fields; pre-#2307 top-level fields (`webhook_url`/`webhook_secret`/
105
+ `webhook_retries`) are tolerated for one minor version for SDK consumers
106
+ reading older API responses. The MCP kind is a stub — the server rejects
107
+ it at entitlement check with HTTP 403 + `feature_not_enabled` until the
108
+ enterprise rollout ships. Follow-up #2313 covers dropping the back-compat
109
+ paths once the engine is confirmed tightened. (#2307)
110
+ - **`HarvestPolicy` enum narrowed from 5 values to 3.** Legacy aliases
111
+ `"always"` (equivalent to `"declared-only"`) and `"declared_and_inferred"`
112
+ (equivalent to `"inferred"`) are no longer accepted by the API or SDK.
113
+ The canonical values are now `"off"` / `"inferred"` / `"declared-only"`.
114
+ Existing stored values are normalised by Alembic
115
+ `0100_harvest_policy_dedupe`. The Python `Literal` type at
116
+ `sdk.types.agents.HarvestPolicy` and the TS union at
117
+ `sdk-ts/src/resources/agents.ts::HarvestPolicy` are narrowed in lockstep.
118
+ Callers using the legacy aliases will see a 422 from `create_agent` /
119
+ `update_agent`; switch to the canonical equivalent. (#2286)
120
+ - `create_agent` / `async_create_agent` docstrings now recommend the
121
+ structured-destination flow for `task_type="notify"`: create the agent
122
+ without a `tool_config`, then attach destinations via
123
+ `create_destination(...)` against the agent's output subscription
124
+ (look up the subscription id via `list_subscriptions(agent_id)` first).
125
+ `tool_config.webhook_url` remains accepted as a generic-HTTPS shortcut
126
+ for backwards compat; the dispatcher fans out to both paths when both
127
+ are configured, so prefer one to avoid duplicate deliveries (#2241,
128
+ #2244).
129
+
130
+ ## [0.8.0] - 2026-05-04
131
+
132
+ ### Added
133
+
134
+ - `create_corpus` and `async_create_corpus` now accept `extraction_template_id`
135
+ and `re_extraction_policy` keyword arguments so callers can bind an extraction
136
+ template at create time without a follow-up PATCH.
137
+ - `update_corpus` and `async_update_corpus` now accept `extraction_template_id`
138
+ (pass `None` to unbind) and `re_extraction_policy` (`None` resets to server
139
+ default `"lazy"`). Both use the `NOT_GIVEN` sentinel to distinguish omit from
140
+ explicit `null`, preventing unintended field resets.
141
+ - `create_agent` and `async_create_agent` accept `declared_schema`
142
+ (`AgentDeclaredSchema | None`) and `harvest_policy` (`HarvestPolicy | None`).
143
+ - `update_agent` and `async_update_agent` accept `declared_schema` and
144
+ `harvest_policy` with `NOT_GIVEN` sentinel semantics.
145
+ - New types exported from `sdk.types`: `AgentDeclaredSchema`, `HarvestPolicy`,
146
+ `NotGivenOr` — use `NOT_GIVEN` from `sdk` for update-only sentinel kwargs.
147
+ - `NOT_GIVEN` sentinel and `_NotGiven` class are now exported from the top-level
148
+ `sdk` package for callers that build update payloads programmatically.
149
+
150
+ ### Changed
151
+
152
+ - `CorpusResponse` (and the underlying Pydantic model) now includes
153
+ `extraction_template_id` and `re_extraction_policy` fields, matching the
154
+ server-side schema added in API v0.8 (#1988).
155
+
156
+ ## [0.7.0] - 2026-04-23
157
+
158
+ ### Added
159
+
160
+ - Feed draft lifecycle on both `Knowledge2` and `AsyncKnowledge2`:
161
+ `create_feed_draft`, `get_feed_draft`, `activate_feed_draft`,
162
+ `discard_feed_draft`. Activation returns the updated **parent** feed;
163
+ the draft is deleted server-side.
164
+ - `list_feed_subscriptions(feed_id)` — read-only view of the subscriptions
165
+ embedded on the feed record. Handles validated and raw-response modes,
166
+ passing `with_raw_response` errors through unchanged and re-wrapping
167
+ successful responses so status/headers survive.
168
+ - Feed feedback helpers: `submit_feed_feedback(feed_id, *, rating,
169
+ chunk_id, feed_run_id)` and `get_feed_feedback_stats(feed_id, *,
170
+ feed_run_id=None)`. `rating` is validated client-side to be `0` or `1`.
171
+ - New response types `FeedFeedbackSubmitResponse` and
172
+ `FeedFeedbackStatsResponse` exported from `sdk.types`, with matching
173
+ strict Pydantic models registered for `validate_responses=True`.
174
+ - `FeedSubscriptionResponse` (and its Pydantic model) now include
175
+ `match_spec` and `match_spec_description` — the routing metadata
176
+ returned by the feed-side subscription schema for `explicit` and
177
+ `nl_semantic` subscriptions.
178
+
179
+ ### Changed
180
+
181
+ - `FeedResponseModel.subscriptions` now always validates to a list
182
+ (previously `list | None = None`). The server contract guarantees a
183
+ list — empty by default — so validated clients can iterate without a
184
+ None check. A legacy response containing `null` for `subscriptions`
185
+ will now raise `ValidationError` instead of producing a `None` field.
186
+ - `FeedSubscriptionResponseModel.agent_id` and `role` are now required
187
+ (previously `str | None = None`) to match the server schema and catch
188
+ malformed subscription payloads in validated clients.
189
+
190
+ ## [0.6.1] - 2026-04-17
191
+
192
+ ### Added
193
+
194
+ - `upload_documents_batch_and_wait(...)` as the canonical blocking helper for raw-text batch ingestion
195
+ - `wait_for_document_batch(...)` for callers that intentionally enqueue first and resolve the batch later
196
+
197
+ ### Changed
198
+
199
+ - base installs now include `pydantic`, so `pip install knowledge2` is import-clean and supports validated response models without an extra
200
+ - `knowledge2[pydantic]` remains accepted as a compatibility alias for older install commands
201
+ - batch wait helpers now enforce a single end-to-end timeout budget and support `with_raw_response` correctly
202
+ - `get_document_batch(...)` now surfaces stable `doc_ids` and live counters once a batch is visible, instead of waiting for terminal aggregation
203
+ - refreshed the primary onboarding docs and examples to prefer the blocking batch helper and the released public contract
204
+ - clarified early auth and quota guidance for the supported retrieval workflow
205
+
206
+ ## [0.6.0] - 2026-04-16
207
+
208
+ ### Changed
209
+
210
+ - `upload_documents_batch(..., wait=False)` returns an enqueue handle with `job_id`, `batch_id`, and `count`
211
+ - `get_document_batch(...)` is the supported batch-status lookup for raw-text uploads, including final `doc_ids` and per-item errors
212
+ - refreshed public SDK release notes to align with the current batch-upload surface
213
+
214
+ ## [0.5.0] - 2026-04-13
215
+
216
+ ### Changed
217
+
218
+ - aligned the published Python SDK support matrix with the public customer-facing surface
219
+ - refreshed README guidance, examples, and optimize-related test coverage for the current SDK capabilities
220
+
221
+ ## [0.4.1] - 2026-04-03
222
+
223
+ ### Changed
224
+
225
+ - Release automation hardening for the public SDK sync/tag/PyPI path. No SDK API surface changes.
226
+
227
+ ## [0.3.0] - 2026-03-30
228
+
229
+ ### Added
230
+
231
+ - **Async parallel uploads**: `upload_documents_parallel()` on `AsyncDocumentsMixin`, bringing parity with the sync client.
232
+ - **Typed response models**: New response types for agents (`sdk/types/agents.py`), feeds (`sdk/types/feeds.py`), and pipelines (`sdk/types/pipelines.py`).
233
+ - **Comprehensive unit tests**: 339 unit tests covering all SDK resource modules.
234
+ - **PyPI release pipeline**: Public-repo `pypi-release.yml` GitHub Actions workflow for automated publishing.
235
+ - **Python 3.13 classifier**: Added `Programming Language :: Python :: 3.13` to package metadata.
236
+ - **Changelog URL**: Added changelog link to `pyproject.toml` project URLs.
237
+ - Mark agents, feeds, pipelines, and A2A resources as preview — emits
238
+ `RuntimeWarning` on first call to indicate feature-flag dependency
239
+
240
+ ### Fixed
241
+
242
+ - **Python version badge**: README badge now correctly states Python 3.11+ (was 3.10+).
243
+
244
+ ## [0.2.0] - 2026-03-12
245
+
246
+ ### Added
247
+
248
+ - **`ClientTimeouts`** (#713): Per-phase HTTP timeout configuration (connect, read, write, pool). Accepts `ClientTimeouts` dataclass, `float`, or `httpx.Timeout`.
249
+ - **`require_str()` param guard** (#714): Validates non-empty, non-whitespace resource IDs at call site before API request.
250
+ - **SDK User-Agent** (#715): Auto-injected `User-Agent: k2-python-sdk/{version}` header on every request. Customizable via `user_agent` parameter.
251
+ - **`is_authenticated()` health check** (#716): Returns `True` if any auth credential (API key, bearer token, admin token, or factory) is configured.
252
+ - **`Page[T]` pagination** (#717): `list_*` methods return `Page[T]` frozen dataclass with `items`, `total`, `offset`, `limit`. Supports `len()`, iteration, and boolean check.
253
+ - **`SyncPager[T]`** (#717): Lazy paginator with `next_page()`, `iter_pages()`, and item-level iteration for `iter_*` methods.
254
+ - **`bearer_token_factory`** (#718): Callable-based dynamic auth for OAuth/OIDC. Thread-safe double-check locking with configurable `token_cache_ttl` (default 300s, 0 to disable). Auto-refreshes on 401.
255
+ - **Two-step delete guard** (#719): `delete_corpus()` requires `confirm=True` to execute. Raises `ValueError` if not confirmed.
256
+ - **`K2Config` frozen config** (#720): Pydantic-settings based configuration from environment variables (`K2_*` prefix), JSON/YAML files, or named profiles.
257
+ - **Sub-client namespaces** (#721): `client.documents.*`, `client.corpora.*`, `client.search_ns.*`, etc. Lightweight cached proxies — flat methods still work.
258
+ - **Parallel uploads** (#722): `upload_documents_parallel()` using `ThreadPoolExecutor` for concurrent document ingestion.
259
+ - **Pydantic response validation** (#723): Optional `validate_responses=True` or `Knowledge2Validated` class. Base installs now include the Pydantic model dependency.
260
+ - **`AsyncKnowledge2` client** (#724): Native async client using `httpx.AsyncClient`. `AsyncPager[T]` for async pagination. Factory methods: `create()`, `from_env()`, `from_file()`, `from_profile()`.
261
+ - **`RequestOptions`** (#732): Per-call overrides for timeout, retries, and passthrough headers. `request_options` parameter on all public methods.
262
+ - **`with_raw_response`** (#733): `client.with_raw_response.<method>(...)` returns `RawResponse[T]` with `status_code`, `headers`, and `parsed` body. Thread-safe (sync) and task-safe (async).
263
+ - **Custom `httpx.Client` injection** (#734): `http_client` parameter for custom TLS, proxies, or observability middleware. Explicit ownership — SDK never closes caller-supplied clients.
264
+
265
+ ### Changed
266
+
267
+ - **`list_*` methods return `Page[T]`** instead of raw dicts. This is a breaking change for code that accessed the raw dict keys directly. Use `page.items` instead.
268
+
269
+ ## [0.1.0] - 2026-02-13
270
+
271
+ ### Added
272
+
273
+ - **Error hierarchy**: 10 exception types (`AuthenticationError`, `RateLimitError`,
274
+ `ServerError`, `APIConnectionError`, `APITimeoutError`, etc.) with `retryable`
275
+ property. All subclass `Knowledge2Error` for backward compatibility.
276
+ - **Automatic retry**: Exponential backoff with jitter for 5xx, 429, connection
277
+ errors, and timeouts. Configurable via `max_retries` (default: 2). Rate limit
278
+ 429 responses honor `Retry-After` header.
279
+ - **Pagination iterators**: `iter_*` methods for all paginated `list_*` endpoints
280
+ (e.g., `iter_documents`, `iter_corpora`, `iter_jobs`). Lazy page fetching.
281
+ - **Debug logging**: Logger named `knowledge2` with credential redaction.
282
+ `set_debug()` convenience method.
283
+ - **Typed config parameters**: Search methods accept TypedDict types
284
+ (`SearchHybridConfig`, `SearchRerankConfig`, etc.) alongside `dict[str, Any]`.
285
+ - **Comprehensive docstrings**: Google-style docstrings on all public methods.
286
+ - **Standalone package**: `pyproject.toml` for independent `pip install`.
287
+ - **SDK versioning**: `__version__` attribute and this changelog.
288
+ - **Focused examples**: Quick-start, search, document upload, error handling,
289
+ pagination, and batch operations examples.
290
+ - **Comprehensive README**: Installation, authentication, configuration, error
291
+ handling, pagination, and resource overview.
292
+
293
+ ### Changed
294
+
295
+ - `fetch_whoami()` renamed to `get_whoami()` for consistency. `fetch_whoami()`
296
+ is now a deprecated alias.
297
+ - `reconcile_jobs()` and `cancel_tuning_run()` return typed responses instead
298
+ of `dict[str, Any]`.