elan-agentkit-runtime 0.2.7__tar.gz → 0.2.8__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 (23) hide show
  1. {elan_agentkit_runtime-0.2.7 → elan_agentkit_runtime-0.2.8}/CHANGELOG.md +6 -0
  2. {elan_agentkit_runtime-0.2.7 → elan_agentkit_runtime-0.2.8}/PKG-INFO +1 -1
  3. {elan_agentkit_runtime-0.2.7 → elan_agentkit_runtime-0.2.8}/pyproject.toml +1 -1
  4. {elan_agentkit_runtime-0.2.7 → elan_agentkit_runtime-0.2.8}/src/agentkit_runtime/builder.py +52 -1
  5. {elan_agentkit_runtime-0.2.7 → elan_agentkit_runtime-0.2.8}/.gitignore +0 -0
  6. {elan_agentkit_runtime-0.2.7 → elan_agentkit_runtime-0.2.8}/LICENSE +0 -0
  7. {elan_agentkit_runtime-0.2.7 → elan_agentkit_runtime-0.2.8}/README.md +0 -0
  8. {elan_agentkit_runtime-0.2.7 → elan_agentkit_runtime-0.2.8}/src/agentkit_runtime/__init__.py +0 -0
  9. {elan_agentkit_runtime-0.2.7 → elan_agentkit_runtime-0.2.8}/src/agentkit_runtime/concurrency.py +0 -0
  10. {elan_agentkit_runtime-0.2.7 → elan_agentkit_runtime-0.2.8}/src/agentkit_runtime/config.py +0 -0
  11. {elan_agentkit_runtime-0.2.7 → elan_agentkit_runtime-0.2.8}/src/agentkit_runtime/connections.py +0 -0
  12. {elan_agentkit_runtime-0.2.7 → elan_agentkit_runtime-0.2.8}/src/agentkit_runtime/consumer.py +0 -0
  13. {elan_agentkit_runtime-0.2.7 → elan_agentkit_runtime-0.2.8}/src/agentkit_runtime/engine.py +0 -0
  14. {elan_agentkit_runtime-0.2.7 → elan_agentkit_runtime-0.2.8}/src/agentkit_runtime/fleet.py +0 -0
  15. {elan_agentkit_runtime-0.2.7 → elan_agentkit_runtime-0.2.8}/src/agentkit_runtime/graph_export.py +0 -0
  16. {elan_agentkit_runtime-0.2.7 → elan_agentkit_runtime-0.2.8}/src/agentkit_runtime/main.py +0 -0
  17. {elan_agentkit_runtime-0.2.7 → elan_agentkit_runtime-0.2.8}/src/agentkit_runtime/manifest_export.py +0 -0
  18. {elan_agentkit_runtime-0.2.7 → elan_agentkit_runtime-0.2.8}/src/agentkit_runtime/plugins.py +0 -0
  19. {elan_agentkit_runtime-0.2.7 → elan_agentkit_runtime-0.2.8}/src/agentkit_runtime/pubsub_push.py +0 -0
  20. {elan_agentkit_runtime-0.2.7 → elan_agentkit_runtime-0.2.8}/src/agentkit_runtime/registry.py +0 -0
  21. {elan_agentkit_runtime-0.2.7 → elan_agentkit_runtime-0.2.8}/src/agentkit_runtime/schema_export.py +0 -0
  22. {elan_agentkit_runtime-0.2.7 → elan_agentkit_runtime-0.2.8}/src/agentkit_runtime/security.py +0 -0
  23. {elan_agentkit_runtime-0.2.7 → elan_agentkit_runtime-0.2.8}/src/agentkit_runtime/tenant_plugins.py +0 -0
@@ -3,6 +3,12 @@
3
3
  Versions follow the tag that published them — `runtime/v*`. A version with no
4
4
  date has not been published yet.
5
5
 
6
+ ## 0.2.8 — 2026-12-05
7
+
8
+ ### Fixed
9
+
10
+ - **Every model response names its model** (`ModelVersionPlugin`, installed by `build_app` on every App). ADK's `AnthropicLlm` never sets `LlmResponse.model_version`, so every Claude run reached the ledger as model `unknown` and the warehouse as `""` — the console's "unreported". The plugin fills it from `llm_request.model`, only when the provider left it empty, before the ledger or the stored event reads it.
11
+
6
12
  ## 0.2.7 — 2026-12-03
7
13
 
8
14
  ### Dependencies
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: elan-agentkit-runtime
3
- Version: 0.2.7
3
+ Version: 0.2.8
4
4
  Summary: The single container that runs any agent or workflow, selected by TARGET_SLUG
5
5
  Project-URL: Homepage, https://openelan.ai
6
6
  Project-URL: Documentation, https://openelan.ai/app/docs
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "elan-agentkit-runtime"
3
- version = "0.2.7"
3
+ version = "0.2.8"
4
4
  description = "The single container that runs any agent or workflow, selected by TARGET_SLUG"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.12"
@@ -494,6 +494,56 @@ class WorkflowResultPlugin(BasePlugin):
494
494
  return None
495
495
 
496
496
 
497
+ #: The model a call was ASKED for, set before the call and read after it. A
498
+ #: ContextVar because both callbacks run in the same task for one model call,
499
+ #: while a `ParallelAgent` branch runs in its own task with its own copy — so
500
+ #: two concurrent calls can never read each other's.
501
+ _REQUESTED_MODEL: ContextVar[str] = ContextVar("agentkit_requested_model", default="")
502
+
503
+
504
+ class ModelVersionPlugin(BasePlugin):
505
+ """Every model response names its model, whichever ADK class produced it.
506
+
507
+ ADK's `AnthropicLlm` NEVER SETS `LlmResponse.model_version` — measured on
508
+ 2.8.0, where `google_llm` and `lite_llm` both do. Everything downstream
509
+ keys on that field: the ledger's `token_charges.model`, the stored event's
510
+ `model_version`, and observability's per-model consumption rows. So every
511
+ Claude run was recorded with model `""`, which the console shows as
512
+ "unreported" and the ledger as "unknown".
513
+
514
+ FILLED FROM THE REQUEST, AND ONLY WHEN EMPTY. ADK sets `llm_request.model`
515
+ to the agent's model name before calling it (`flows/llm_flows/basic.py`),
516
+ so the name is the one the manifest declared. A provider that does report
517
+ its own version — Gemini's dated model id — is left exactly as it was.
518
+
519
+ IN PLACE, BEFORE ANYTHING READS IT. `after_model_callback` runs before ADK
520
+ turns the response into the stored event, and `build_app` installs this
521
+ ahead of every platform plugin, so the ledger and the event both see the
522
+ name. It returns None, so it never replaces a response or silences a
523
+ plugin after it.
524
+ """
525
+
526
+ #: A nested run calls models too, and its tokens fold into the caller's
527
+ #: tally per model (ADR-0268).
528
+ nested = RUNS_NESTED
529
+
530
+ def __init__(self) -> None:
531
+ super().__init__(name="model-version")
532
+
533
+ async def before_model_callback(self, *, callback_context: Any = None,
534
+ llm_request: Any = None, **_: Any) -> None:
535
+ _REQUESTED_MODEL.set(str(getattr(llm_request, "model", None) or ""))
536
+ return None
537
+
538
+ async def after_model_callback(self, *, callback_context: Any = None,
539
+ llm_response: Any = None, **_: Any) -> None:
540
+ requested = _REQUESTED_MODEL.get()
541
+ if llm_response is not None and requested \
542
+ and not getattr(llm_response, "model_version", None):
543
+ llm_response.model_version = requested
544
+ return None
545
+
546
+
497
547
  def _as_result_text(output: Any) -> str:
498
548
  """A terminal output as the text a calling model reads."""
499
549
  if isinstance(output, str):
@@ -926,7 +976,8 @@ def build_app(target: Target, settings: Settings, plugins: list[Any] | None = No
926
976
  # an event: the content it gives a terminal output is the tool result,
927
977
  # and a plugin after it seeing the event without that content would
928
978
  # disagree with what the caller is handed.
929
- plugins=[credentials, WorkflowResultPlugin(), *(plugins or [])],
979
+ plugins=[credentials, WorkflowResultPlugin(), ModelVersionPlugin(),
980
+ *(plugins or [])],
930
981
  resumability_config=resumability,
931
982
  events_compaction_config=_compaction(
932
983
  manifest, root, target.module_name.rpartition(".")[0]),