adk-neomundi 0.1.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.
- adk_neomundi-0.1.0/.gitignore +9 -0
- adk_neomundi-0.1.0/CHANGELOG.md +58 -0
- adk_neomundi-0.1.0/INTEGRATION.yaml +137 -0
- adk_neomundi-0.1.0/LIMITATIONS.md +88 -0
- adk_neomundi-0.1.0/PKG-INFO +119 -0
- adk_neomundi-0.1.0/README.md +96 -0
- adk_neomundi-0.1.0/README_FR.md +72 -0
- adk_neomundi-0.1.0/VALUE.md +46 -0
- adk_neomundi-0.1.0/examples/measure_an_agent.py +58 -0
- adk_neomundi-0.1.0/notebooks/quickstart.ipynb +76 -0
- adk_neomundi-0.1.0/pyproject.toml +69 -0
- adk_neomundi-0.1.0/src/adk_neomundi/__init__.py +18 -0
- adk_neomundi-0.1.0/src/adk_neomundi/callbacks.py +154 -0
- adk_neomundi-0.1.0/src/adk_neomundi/py.typed +0 -0
- adk_neomundi-0.1.0/src/adk_neomundi/version.py +1 -0
- adk_neomundi-0.1.0/tests/test_callbacks.py +350 -0
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project are documented here.
|
|
4
|
+
This project adheres to [Semantic Versioning](https://semver.org/).
|
|
5
|
+
|
|
6
|
+
## 0.1.0 โ released 2026-11-28
|
|
7
|
+
|
|
8
|
+
First shape. ๐ด **Evidence level E1**: offline tests only, **no real provider
|
|
9
|
+
call**. โ **Publishing a package does not raise its evidence level**, and this
|
|
10
|
+
release does not pretend otherwise.
|
|
11
|
+
|
|
12
|
+
๐ข **Published after `otel-neomundi` 0.2.0, and in that order** -- the reverse
|
|
13
|
+
would have delivered a dependency **nobody can install**, which the CI matrix
|
|
14
|
+
proved on ten cells before the floor was corrected.
|
|
15
|
+
|
|
16
|
+
โ **PyPI is immutable for a given version.** What is written below cannot be
|
|
17
|
+
corrected afterwards; only a 0.1.1 could.
|
|
18
|
+
|
|
19
|
+
### Added
|
|
20
|
+
|
|
21
|
+
- `adk_neomundi.callbacks(processor)` โ returns ADK's
|
|
22
|
+
`before_model_callback`, `after_model_callback` and the mailbox that holds the
|
|
23
|
+
interaction between them.
|
|
24
|
+
- `adk_neomundi.Mailbox` โ **one slot**, and it **refuses** rather than
|
|
25
|
+
overwrites. `mailbox.refused` counts the handovers turned away: โ **a
|
|
26
|
+
non-zero value means model turns ran unmeasured**.
|
|
27
|
+
|
|
28
|
+
### Measured, and not claimed beyond that
|
|
29
|
+
|
|
30
|
+
๐ด **`real_observations: 0`.** The chain was exercised end to end against
|
|
31
|
+
`google-adk` 2.15.1 with a **stub model** and a **fabricated** ground truth.
|
|
32
|
+
**Nothing here says anything about Gemini, about Google Maps, or about any
|
|
33
|
+
provider.** E2 needs a real, authorised call.
|
|
34
|
+
|
|
35
|
+
### ๐ด Deliberately NOT added
|
|
36
|
+
|
|
37
|
+
No span processor, no `Outcome`, no parentage, no refusal set, no token reading,
|
|
38
|
+
no deferred close, no correlation. **All imported from `otel-neomundi` 0.2.0**,
|
|
39
|
+
because none of them knows anything about Google.
|
|
40
|
+
|
|
41
|
+
โ **If a future change re-implements an `Outcome` here, it is a regression**,
|
|
42
|
+
not a feature.
|
|
43
|
+
|
|
44
|
+
### Measured
|
|
45
|
+
|
|
46
|
+
- **23 offline tests**, no credential and no socket;
|
|
47
|
+
- the full chain run end to end against `google-adk` **2.15.1** with a **stub
|
|
48
|
+
model**: measurement **and** model-to-tool join both succeeded on the
|
|
49
|
+
**default** telemetry schema, via `gen_ai.tool.call.result`;
|
|
50
|
+
- ๐ข **16 lines** of host-side logic, 1 span processor to register.
|
|
51
|
+
|
|
52
|
+
### What 0.1.0 does not establish
|
|
53
|
+
|
|
54
|
+
- ๐ด **no real provider call.** Stub model, fabricated ground truth;
|
|
55
|
+
- ๐ด **no parallel ADK agent** was exercised;
|
|
56
|
+
- **no streaming**;
|
|
57
|
+
- โ the join needs `OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=SPAN_ONLY`,
|
|
58
|
+
and that switch puts tool content โ possibly **personal data** โ on spans.
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
# The single source of truth for this integration.
|
|
2
|
+
#
|
|
3
|
+
# The library index, the catalogue and the badges are GENERATED from this
|
|
4
|
+
# file and its siblings. `tools/check_conformance.py` validates it.
|
|
5
|
+
|
|
6
|
+
slug: adk
|
|
7
|
+
name: Google ADK
|
|
8
|
+
technology:
|
|
9
|
+
name: Google Agent Development Kit (Python)
|
|
10
|
+
homepage: https://google.github.io/adk-docs/
|
|
11
|
+
what_it_is: >-
|
|
12
|
+
Google's framework for building agents. It emits OpenTelemetry GenAI
|
|
13
|
+
spans of its own for the model calls and the tool calls it runs, which
|
|
14
|
+
an application exports to the tracing backend it already has.
|
|
15
|
+
|
|
16
|
+
package:
|
|
17
|
+
name: adk-neomundi
|
|
18
|
+
import_name: adk_neomundi
|
|
19
|
+
version: 0.1.0
|
|
20
|
+
# ๐ด `none` TANT QUE LE PAQUET N'EST PAS REELLEMENT SUR PyPI, et ce n'est
|
|
21
|
+
# pas une precaution de forme : ces deux champs pilotent un `pip install`
|
|
22
|
+
# COPIABLE dans l'index genere et un lien vers la page du projet.
|
|
23
|
+
#
|
|
24
|
+
# โ DEFAUT PAYE LE 2026-11-28, et c'est la SECONDE fois dans la journee.
|
|
25
|
+
# Le commit d'activation les avait passes a `pypi` AVANT la publication,
|
|
26
|
+
# en anticipant l'approbation de l'environnement. Pour `otel-neomundi` la
|
|
27
|
+
# sequence a tenu en quelques minutes ; ici la porte est restee fermee, et
|
|
28
|
+
# `main` a annonce pendant ce temps un paquet qui renvoyait 404.
|
|
29
|
+
#
|
|
30
|
+
# ๐ข LA REGLE : ces champs decrivent ce qui EST SERVI PAR PyPI, pas ce qui
|
|
31
|
+
# va l'etre. Ils se mettent a jour APRES la publication, jamais avant.
|
|
32
|
+
# โ `tools/check_conformance.py` verifie la coherence INTERNE du manifeste,
|
|
33
|
+
# pas PyPI : il ne peut pas attraper cette erreur a notre place.
|
|
34
|
+
published_on: none
|
|
35
|
+
pypi_url: null
|
|
36
|
+
|
|
37
|
+
# Package lifecycle, not evidence.
|
|
38
|
+
maturity: experimental
|
|
39
|
+
|
|
40
|
+
evidence:
|
|
41
|
+
# E0 nothing yet, E1 offline tests, E2 + real execution against
|
|
42
|
+
# production, E3 + independently reproduced.
|
|
43
|
+
#
|
|
44
|
+
# ๐ด E1, et declare comme tel. Aucun appel reel n'a eu lieu : le modele des
|
|
45
|
+
# sondes est FACTICE et la verite terrain est FABRIQUEE. E2 demande un
|
|
46
|
+
# identifiant Google et une execution autorisee -- elle est preparee et
|
|
47
|
+
# bloquee, pas oubliee.
|
|
48
|
+
level: e1
|
|
49
|
+
offline_tests: 23
|
|
50
|
+
real_observations: 0
|
|
51
|
+
observations_verified_persisted: 0
|
|
52
|
+
cost_chf: 0.0
|
|
53
|
+
proof: null
|
|
54
|
+
reason: >-
|
|
55
|
+
Twenty-three deterministic offline tests, no credential and no socket:
|
|
56
|
+
the one-slot mailbox refuses rather than overwrites, both callbacks
|
|
57
|
+
return None and never raise, the count comes from the provider's
|
|
58
|
+
response and never from a span, and the interaction is handed to
|
|
59
|
+
otel-neomundi's deferred close rather than decided here. The chain was
|
|
60
|
+
additionally run end to end against google-adk 2.15.1 with a stub
|
|
61
|
+
model: measurement and model-to-tool join both succeeded on the
|
|
62
|
+
default telemetry schema. No real provider call has been made.
|
|
63
|
+
|
|
64
|
+
compatibility:
|
|
65
|
+
python: ["3.11", "3.12", "3.13"]
|
|
66
|
+
platforms: [linux, macos, windows]
|
|
67
|
+
target:
|
|
68
|
+
name: google-adk
|
|
69
|
+
min: "2.15.1"
|
|
70
|
+
max: "<3.0"
|
|
71
|
+
verified: "2.15.1"
|
|
72
|
+
neomundi_sdk:
|
|
73
|
+
min: "2.1.0"
|
|
74
|
+
verified: "2.2.0"
|
|
75
|
+
# ๐ด La dependance qui porte tout le travail generique.
|
|
76
|
+
requires:
|
|
77
|
+
# ๐ข Plancher et exigence s'accordent desormais : 0.2.0 est sur PyPI.
|
|
78
|
+
- "otel-neomundi>=0.2.0,<0.3 -- published 2026-11-28; the floor and the runtime requirement now agree"
|
|
79
|
+
measurement_version_verified: "none (E1)"
|
|
80
|
+
|
|
81
|
+
value:
|
|
82
|
+
host_keeps: >-
|
|
83
|
+
Google ADK keeps the agent, the tools, the runner, its own telemetry
|
|
84
|
+
and the tracing backend you already run. Nothing is replaced and no
|
|
85
|
+
model call is rewritten, blocked or read.
|
|
86
|
+
neomundi_adds: >-
|
|
87
|
+
Signed, independently verifiable behavioural measurement of the model
|
|
88
|
+
calls your agent already traces, with the NeoMundi request_id written
|
|
89
|
+
into the same trace -- plus the tool result the model call consumed,
|
|
90
|
+
joined from the trace rather than guessed.
|
|
91
|
+
complements_not_replaces:
|
|
92
|
+
- Google ADK's own OpenTelemetry telemetry
|
|
93
|
+
- otel-neomundi, which this integration DEPENDS ON and never duplicates
|
|
94
|
+
- your tracing backend (Jaeger, Tempo, Cloud Trace, Datadog...)
|
|
95
|
+
typical_use:
|
|
96
|
+
- Measure the model turns of an ADK agent without a second timer or a second instrumentation.
|
|
97
|
+
- Read a tool's recorded result next to the model answer that consumed it, from telemetry alone.
|
|
98
|
+
- Find out, for free, which of your agent's turns could be measured, with submit=False.
|
|
99
|
+
|
|
100
|
+
entrypoint:
|
|
101
|
+
kind: callbacks
|
|
102
|
+
symbol: adk_neomundi.callbacks
|
|
103
|
+
snippet: |
|
|
104
|
+
processor = NeoMundiSpanProcessor(submit=False, tracer_provider=provider)
|
|
105
|
+
provider.add_span_processor(processor)
|
|
106
|
+
before, after, mailbox = callbacks(processor)
|
|
107
|
+
agent = LlmAgent(..., before_model_callback=before, after_model_callback=after)
|
|
108
|
+
# the Outcome arrives on processor.outcomes, after ADK ends its model span
|
|
109
|
+
# join(spans, trace_id=o.trace_id, span_id) gives the tool result it consumed
|
|
110
|
+
|
|
111
|
+
refusals:
|
|
112
|
+
- A token count read from a span is never submitted; only the count the provider returned in its response.
|
|
113
|
+
- A second model call while one is still pending is REFUSED, not overwritten -- a wrong measurement is worse than a missing one, and mailbox.refused counts them.
|
|
114
|
+
- An exception raised by the application is refused immediately and never deferred.
|
|
115
|
+
- A model span that never ends yields an explicit refusal at shutdown, never a fabricated measurement.
|
|
116
|
+
- Several tool spans in one trace are ambiguous; which one the model consumed is not guessed.
|
|
117
|
+
|
|
118
|
+
billing:
|
|
119
|
+
metered: true
|
|
120
|
+
note: >-
|
|
121
|
+
Every submitted observation is a billed measurement. Nothing is billed
|
|
122
|
+
for a span alone: only an interaction with a count declared from the
|
|
123
|
+
provider's response is submitted. Start with submit=False, which needs
|
|
124
|
+
no key and opens no socket.
|
|
125
|
+
|
|
126
|
+
links:
|
|
127
|
+
readme: README.md
|
|
128
|
+
readme_fr: README_FR.md
|
|
129
|
+
limitations: LIMITATIONS.md
|
|
130
|
+
value: VALUE.md
|
|
131
|
+
changelog: CHANGELOG.md
|
|
132
|
+
notebook: notebooks/quickstart.ipynb
|
|
133
|
+
examples: examples/
|
|
134
|
+
|
|
135
|
+
# ๐ด `null` jusqu'a la publication effective -- voir `published_on` ci-dessus.
|
|
136
|
+
delivered: null
|
|
137
|
+
last_verified: 2026-11-28
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# Limitations โ adk-neomundi
|
|
2
|
+
|
|
3
|
+
๐ด **A lire avant de citer un chiffre produit par ce paquet.** Niveau de
|
|
4
|
+
preuve **E1** : des tests hors ligne, et **aucun appel reel**.
|
|
5
|
+
|
|
6
|
+
## 1. ๐ด Aucun appel reel n'a eu lieu
|
|
7
|
+
|
|
8
|
+
Le modele des sondes est **factice** et la verite terrain est **fabriquee**. La
|
|
9
|
+
chaine a bien tourne de bout en bout contre `google-adk` 2.15.1 -- mesure **et**
|
|
10
|
+
jointure -- mais contre un modele que nous avons ecrit.
|
|
11
|
+
|
|
12
|
+
โ **Rien ici ne dit quoi que ce soit de Gemini, de Google Maps, ni d'aucun
|
|
13
|
+
fournisseur.** E2 demande un identifiant Google et une execution autorisee.
|
|
14
|
+
|
|
15
|
+
## 2. ๐ด La jointure modele-outil demande une variable d'environnement
|
|
16
|
+
|
|
17
|
+
`OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT` doit valoir **`SPAN_ONLY`**
|
|
18
|
+
ou **`SPAN_AND_EVENT`**. Sans elle, la jointure refuse avec
|
|
19
|
+
`tool_result_not_captured` -- un refus **explicite**, jamais un succes vide.
|
|
20
|
+
|
|
21
|
+
โ **Deux valeurs echouent en silence, et c'est un defaut de l'hote** :
|
|
22
|
+
|
|
23
|
+
| ecrit | resout vers | diagnostic |
|
|
24
|
+
|---|---|---|
|
|
25
|
+
| `true` | **`EVENT_ONLY`** -- pas sur le span | ๐ด aucun |
|
|
26
|
+
| `SPAN_AND_EVENTS` *(faute de frappe)* | **`NO_CONTENT`** | ๐ด aucun |
|
|
27
|
+
|
|
28
|
+
Signale en amont : [google/adk-python#8432](https://github.com/google/adk-python/issues/8432).
|
|
29
|
+
โ **Tant que ce n'est pas corrige, une configuration fautive ressemble a une
|
|
30
|
+
telemetrie vide.**
|
|
31
|
+
|
|
32
|
+
## 3. ๐ด Et cette variable met du contenu d'outil dans vos spans
|
|
33
|
+
|
|
34
|
+
Activer `SPAN_ONLY` ecrit **le resultat des outils** sur les spans. Si un outil
|
|
35
|
+
manipule des adresses, des noms ou toute autre donnee personnelle, **votre
|
|
36
|
+
telemetrie les porte aussi**.
|
|
37
|
+
|
|
38
|
+
๐ด **C'est une decision de confidentialite, pas un reglage.** Ce paquet ne la
|
|
39
|
+
prend pas pour vous et ne l'active jamais lui-meme.
|
|
40
|
+
|
|
41
|
+
## 4. Un seul appel de modele a la fois
|
|
42
|
+
|
|
43
|
+
La boite tient **une** interaction. Un second appel pendant qu'un premier est en
|
|
44
|
+
attente est **refuse**, et `mailbox.refused` le compte.
|
|
45
|
+
|
|
46
|
+
โ **Lire ce compteur** : non nul, il signifie que des tours ont tourne **non
|
|
47
|
+
mesures**. Ce n'est pas une erreur a avaler -- c'est un fait sur votre
|
|
48
|
+
deploiement.
|
|
49
|
+
|
|
50
|
+
๐ด **Un agent reellement parallele n'a pas ete eprouve.** `otel-neomundi` 0.2.0
|
|
51
|
+
tient des interactions **distinctes** sous 24 fils (9 tests, 12 passes de
|
|
52
|
+
stress) ; ce qui n'est pas eprouve, c'est un agent ADK qui emettrait deux appels
|
|
53
|
+
de modele **simultanes partageant ces rappels**.
|
|
54
|
+
|
|
55
|
+
## 5. Le streaming
|
|
56
|
+
|
|
57
|
+
Les reponses partielles ne terminent pas le span de modele. ๐ด **Non mesure.**
|
|
58
|
+
|
|
59
|
+
## 6. Ce qui n'est pas de notre ressort
|
|
60
|
+
|
|
61
|
+
- **le decompte lui-meme** : il vient de `llm_response.usage_metadata`. Si le
|
|
62
|
+
fournisseur n'en publie pas, l'interaction est **refusee** -- et c'est le
|
|
63
|
+
resultat honnete, pas un repli sur une estimation ;
|
|
64
|
+
- **la latence** : celle que l'instrumentation de l'ADK a observee ;
|
|
65
|
+
- **le modele servi** : celui que le span rapporte. โ Et il peut differer de
|
|
66
|
+
celui demande -- `gemini-2.5-flash` est **reroute** vers
|
|
67
|
+
`gemini-3.5-flash-lite` depuis le 2026-12-01.
|
|
68
|
+
|
|
69
|
+
## 7. ๐ด Le plancher declare et l'exigence reelle ne sont pas la meme chose
|
|
70
|
+
|
|
71
|
+
Le `pyproject.toml` declare `otel-neomundi>=0.1.0`, et **ce paquet a besoin de
|
|
72
|
+
0.2.0**. โ **Ce n'est pas un oubli** : declarer `>=0.2.0` rendrait ce paquet
|
|
73
|
+
**non installable**, parce que 0.2.0 n'est pas sur PyPI -- la CI l'a prouve avec
|
|
74
|
+
`No matching distribution found`.
|
|
75
|
+
|
|
76
|
+
๐ข **L'exigence est tenue autrement** : `callbacks()` **refuse au cablage** si le
|
|
77
|
+
processeur ne sait pas differer sa fermeture, avec un message qui nomme 0.2.0.
|
|
78
|
+
Un **controle de capacite**, pas une chaine de version -- il reste juste si la
|
|
79
|
+
capacite arrive par une autre route.
|
|
80
|
+
|
|
81
|
+
โ **Un `**kwargs` ne dit rien** et est donc accepte : on ne refuse pas un
|
|
82
|
+
processeur peut-etre valide. **Dit, pas cache.**
|
|
83
|
+
|
|
84
|
+
๐ด **Le plancher doit etre releve a `>=0.2.0,<0.3` dans le commit d'activation**,
|
|
85
|
+
celui qui retire aussi `Private :: Do Not Upload`.
|
|
86
|
+
|
|
87
|
+
โ **L'ordre n'est pas negociable** : `otel-neomundi` 0.2.0 d'abord, celui-ci
|
|
88
|
+
ensuite.
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: adk-neomundi
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Measure a Google ADK agent's model calls with NeoMundi, over OpenTelemetry
|
|
5
|
+
Project-URL: Homepage, https://github.com/neomundi-io/neomundi-integrations
|
|
6
|
+
Project-URL: Source, https://github.com/neomundi-io/neomundi-integrations/tree/main/integrations/adk
|
|
7
|
+
Author: NeoMundi
|
|
8
|
+
License-Expression: Apache-2.0
|
|
9
|
+
Keywords: agents,genai,google-adk,neomundi,opentelemetry
|
|
10
|
+
Classifier: Development Status :: 3 - Alpha
|
|
11
|
+
Classifier: Intended Audience :: Developers
|
|
12
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
14
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
15
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
16
|
+
Classifier: Topic :: System :: Monitoring
|
|
17
|
+
Requires-Python: >=3.11
|
|
18
|
+
Requires-Dist: google-adk<3,>=2.15.1
|
|
19
|
+
Requires-Dist: otel-neomundi<0.3,>=0.2.0
|
|
20
|
+
Provides-Extra: dev
|
|
21
|
+
Requires-Dist: pytest>=8.0; extra == 'dev'
|
|
22
|
+
Description-Content-Type: text/markdown
|
|
23
|
+
|
|
24
|
+
# adk-neomundi
|
|
25
|
+
|
|
26
|
+
Measure the model calls of a **Google ADK** agent with NeoMundi, over the
|
|
27
|
+
OpenTelemetry spans ADK already emits.
|
|
28
|
+
|
|
29
|
+
> ๐ด **Not published.** This package is not on PyPI, and publication is
|
|
30
|
+
> blocked by a `Private :: Do Not Upload` classifier. It also depends on
|
|
31
|
+
> `otel-neomundi>=0.2.0`, which is not published either.
|
|
32
|
+
|
|
33
|
+
## What it is, and what it is not
|
|
34
|
+
|
|
35
|
+
๐ด **This package is deliberately thin.** It is **two ADK callbacks and a
|
|
36
|
+
one-slot mailbox**. The span processor, the `Outcome`, the parentage, the closed
|
|
37
|
+
set of refusals, the deferred close and the model-to-tool join all live in
|
|
38
|
+
[`otel-neomundi`](../otel/README.md) and are **imported**.
|
|
39
|
+
|
|
40
|
+
โ **Why that matters**: none of those pieces knows anything about Google. A
|
|
41
|
+
copy of them in a package named `adk-neomundi` would make the next host pay for
|
|
42
|
+
it twice.
|
|
43
|
+
|
|
44
|
+
## ๐ด Install: you cannot, yet
|
|
45
|
+
|
|
46
|
+
**This package is not on PyPI, so there is no install command to copy.** Writing
|
|
47
|
+
one here would hand a reader a line that fails โ which is why
|
|
48
|
+
`tools/check_conformance.py` refuses a copyable `pip install` for a package
|
|
49
|
+
whose manifest says `published_on: none`. โ **It caught exactly that in a first
|
|
50
|
+
draft of this file.**
|
|
51
|
+
|
|
52
|
+
**Two things must happen first, in this order:**
|
|
53
|
+
|
|
54
|
+
1. **`otel-neomundi` 0.2.0 is published.** ๐ด This package depends on it and
|
|
55
|
+
carries **no copy** of what it provides;
|
|
56
|
+
2. the `Private :: Do Not Upload` classifier is removed from
|
|
57
|
+
`pyproject.toml`, in a **separate, approved activation commit**.
|
|
58
|
+
|
|
59
|
+
Until then, read it from the repository.
|
|
60
|
+
|
|
61
|
+
## Use
|
|
62
|
+
|
|
63
|
+
```python
|
|
64
|
+
from opentelemetry.sdk.trace import TracerProvider
|
|
65
|
+
from otel_neomundi import NeoMundiSpanProcessor, join
|
|
66
|
+
from adk_neomundi import callbacks
|
|
67
|
+
|
|
68
|
+
provider = TracerProvider()
|
|
69
|
+
# Start here: submit=False needs no key and opens no socket.
|
|
70
|
+
processor = NeoMundiSpanProcessor(submit=False, tracer_provider=provider)
|
|
71
|
+
provider.add_span_processor(processor)
|
|
72
|
+
|
|
73
|
+
before, after, mailbox = callbacks(processor)
|
|
74
|
+
|
|
75
|
+
agent = LlmAgent(
|
|
76
|
+
name="validator",
|
|
77
|
+
model="gemini-3.5-flash-lite",
|
|
78
|
+
tools=[validate_address],
|
|
79
|
+
before_model_callback=before,
|
|
80
|
+
after_model_callback=after,
|
|
81
|
+
)
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
The `Outcome` arrives on `processor.outcomes` **after ADK ends its model span**,
|
|
85
|
+
which is later than the end of any callback -- that is the whole reason
|
|
86
|
+
`close_on_model_span=True` exists.
|
|
87
|
+
|
|
88
|
+
### Reading the tool result the model consumed
|
|
89
|
+
|
|
90
|
+
```python
|
|
91
|
+
for outcome in processor.outcomes:
|
|
92
|
+
verdict = join(spans, trace_id=outcome.trace_id, model_span_id=outcome.span_id)
|
|
93
|
+
if verdict.joined:
|
|
94
|
+
print(verdict.tool_name, verdict.result)
|
|
95
|
+
else:
|
|
96
|
+
print("refused:", verdict.refusal) # never a guess
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
๐ด **This needs `OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=SPAN_ONLY`.**
|
|
100
|
+
โ **And that switch puts tool content on spans**: if your tool handles personal
|
|
101
|
+
data, so does your telemetry. Decide it on purpose.
|
|
102
|
+
|
|
103
|
+
โ **The value `true` does NOT work for this.** It resolves to `EVENT_ONLY` --
|
|
104
|
+
content on the log record, **not** on the span. Reported upstream:
|
|
105
|
+
[google/adk-python#8432](https://github.com/google/adk-python/issues/8432).
|
|
106
|
+
|
|
107
|
+
## What it refuses to do
|
|
108
|
+
|
|
109
|
+
- submit a token count **read from a span** -- only the one the provider returned;
|
|
110
|
+
- measure a **second** model call while one is pending: the mailbox **refuses**,
|
|
111
|
+
and `mailbox.refused` counts it. โ **Read that number**: non-zero means turns
|
|
112
|
+
ran unmeasured;
|
|
113
|
+
- defer an interaction in which the **application raised**;
|
|
114
|
+
- guess **which** tool result a model call consumed when several are candidates.
|
|
115
|
+
|
|
116
|
+
## Before you draw a conclusion
|
|
117
|
+
|
|
118
|
+
Read [`LIMITATIONS.md`](LIMITATIONS.md). Evidence level is **E1**: offline tests
|
|
119
|
+
only. ๐ด **No real provider call has been made.**
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# adk-neomundi
|
|
2
|
+
|
|
3
|
+
Measure the model calls of a **Google ADK** agent with NeoMundi, over the
|
|
4
|
+
OpenTelemetry spans ADK already emits.
|
|
5
|
+
|
|
6
|
+
> ๐ด **Not published.** This package is not on PyPI, and publication is
|
|
7
|
+
> blocked by a `Private :: Do Not Upload` classifier. It also depends on
|
|
8
|
+
> `otel-neomundi>=0.2.0`, which is not published either.
|
|
9
|
+
|
|
10
|
+
## What it is, and what it is not
|
|
11
|
+
|
|
12
|
+
๐ด **This package is deliberately thin.** It is **two ADK callbacks and a
|
|
13
|
+
one-slot mailbox**. The span processor, the `Outcome`, the parentage, the closed
|
|
14
|
+
set of refusals, the deferred close and the model-to-tool join all live in
|
|
15
|
+
[`otel-neomundi`](../otel/README.md) and are **imported**.
|
|
16
|
+
|
|
17
|
+
โ **Why that matters**: none of those pieces knows anything about Google. A
|
|
18
|
+
copy of them in a package named `adk-neomundi` would make the next host pay for
|
|
19
|
+
it twice.
|
|
20
|
+
|
|
21
|
+
## ๐ด Install: you cannot, yet
|
|
22
|
+
|
|
23
|
+
**This package is not on PyPI, so there is no install command to copy.** Writing
|
|
24
|
+
one here would hand a reader a line that fails โ which is why
|
|
25
|
+
`tools/check_conformance.py` refuses a copyable `pip install` for a package
|
|
26
|
+
whose manifest says `published_on: none`. โ **It caught exactly that in a first
|
|
27
|
+
draft of this file.**
|
|
28
|
+
|
|
29
|
+
**Two things must happen first, in this order:**
|
|
30
|
+
|
|
31
|
+
1. **`otel-neomundi` 0.2.0 is published.** ๐ด This package depends on it and
|
|
32
|
+
carries **no copy** of what it provides;
|
|
33
|
+
2. the `Private :: Do Not Upload` classifier is removed from
|
|
34
|
+
`pyproject.toml`, in a **separate, approved activation commit**.
|
|
35
|
+
|
|
36
|
+
Until then, read it from the repository.
|
|
37
|
+
|
|
38
|
+
## Use
|
|
39
|
+
|
|
40
|
+
```python
|
|
41
|
+
from opentelemetry.sdk.trace import TracerProvider
|
|
42
|
+
from otel_neomundi import NeoMundiSpanProcessor, join
|
|
43
|
+
from adk_neomundi import callbacks
|
|
44
|
+
|
|
45
|
+
provider = TracerProvider()
|
|
46
|
+
# Start here: submit=False needs no key and opens no socket.
|
|
47
|
+
processor = NeoMundiSpanProcessor(submit=False, tracer_provider=provider)
|
|
48
|
+
provider.add_span_processor(processor)
|
|
49
|
+
|
|
50
|
+
before, after, mailbox = callbacks(processor)
|
|
51
|
+
|
|
52
|
+
agent = LlmAgent(
|
|
53
|
+
name="validator",
|
|
54
|
+
model="gemini-3.5-flash-lite",
|
|
55
|
+
tools=[validate_address],
|
|
56
|
+
before_model_callback=before,
|
|
57
|
+
after_model_callback=after,
|
|
58
|
+
)
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
The `Outcome` arrives on `processor.outcomes` **after ADK ends its model span**,
|
|
62
|
+
which is later than the end of any callback -- that is the whole reason
|
|
63
|
+
`close_on_model_span=True` exists.
|
|
64
|
+
|
|
65
|
+
### Reading the tool result the model consumed
|
|
66
|
+
|
|
67
|
+
```python
|
|
68
|
+
for outcome in processor.outcomes:
|
|
69
|
+
verdict = join(spans, trace_id=outcome.trace_id, model_span_id=outcome.span_id)
|
|
70
|
+
if verdict.joined:
|
|
71
|
+
print(verdict.tool_name, verdict.result)
|
|
72
|
+
else:
|
|
73
|
+
print("refused:", verdict.refusal) # never a guess
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
๐ด **This needs `OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=SPAN_ONLY`.**
|
|
77
|
+
โ **And that switch puts tool content on spans**: if your tool handles personal
|
|
78
|
+
data, so does your telemetry. Decide it on purpose.
|
|
79
|
+
|
|
80
|
+
โ **The value `true` does NOT work for this.** It resolves to `EVENT_ONLY` --
|
|
81
|
+
content on the log record, **not** on the span. Reported upstream:
|
|
82
|
+
[google/adk-python#8432](https://github.com/google/adk-python/issues/8432).
|
|
83
|
+
|
|
84
|
+
## What it refuses to do
|
|
85
|
+
|
|
86
|
+
- submit a token count **read from a span** -- only the one the provider returned;
|
|
87
|
+
- measure a **second** model call while one is pending: the mailbox **refuses**,
|
|
88
|
+
and `mailbox.refused` counts it. โ **Read that number**: non-zero means turns
|
|
89
|
+
ran unmeasured;
|
|
90
|
+
- defer an interaction in which the **application raised**;
|
|
91
|
+
- guess **which** tool result a model call consumed when several are candidates.
|
|
92
|
+
|
|
93
|
+
## Before you draw a conclusion
|
|
94
|
+
|
|
95
|
+
Read [`LIMITATIONS.md`](LIMITATIONS.md). Evidence level is **E1**: offline tests
|
|
96
|
+
only. ๐ด **No real provider call has been made.**
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
# adk-neomundi
|
|
2
|
+
|
|
3
|
+
Mesurer les appels de modele d'un agent **Google ADK** avec NeoMundi, par les
|
|
4
|
+
spans OpenTelemetry que l'ADK emet deja.
|
|
5
|
+
|
|
6
|
+
> ๐ด **Non publie.** Ce paquet n'est pas sur PyPI, et sa publication est
|
|
7
|
+
> bloquee par un classifieur `Private :: Do Not Upload`. Il depend en outre de
|
|
8
|
+
> `otel-neomundi>=0.2.0`, qui n'est pas publiee non plus.
|
|
9
|
+
|
|
10
|
+
## Ce qu'il est, et ce qu'il n'est pas
|
|
11
|
+
|
|
12
|
+
๐ด **Ce paquet est deliberement mince** : **deux rappels ADK et une boite a
|
|
13
|
+
une place**. Le processeur de spans, l'`Outcome`, l'appartenance par parente, le
|
|
14
|
+
jeu ferme de refus, la fermeture differee et la jointure modele-outil vivent
|
|
15
|
+
tous dans [`otel-neomundi`](../otel/README_FR.md) et sont **importes**.
|
|
16
|
+
|
|
17
|
+
โ **Pourquoi cela compte** : aucune de ces pieces ne connait Google. Une copie
|
|
18
|
+
dans un paquet nomme `adk-neomundi` ferait payer le prochain hote une seconde
|
|
19
|
+
fois.
|
|
20
|
+
|
|
21
|
+
## Utiliser
|
|
22
|
+
|
|
23
|
+
```python
|
|
24
|
+
from opentelemetry.sdk.trace import TracerProvider
|
|
25
|
+
from otel_neomundi import NeoMundiSpanProcessor, join
|
|
26
|
+
from adk_neomundi import callbacks
|
|
27
|
+
|
|
28
|
+
provider = TracerProvider()
|
|
29
|
+
# Commencer ici : submit=False ne demande aucune cle et n'ouvre aucun socket.
|
|
30
|
+
processor = NeoMundiSpanProcessor(submit=False, tracer_provider=provider)
|
|
31
|
+
provider.add_span_processor(processor)
|
|
32
|
+
|
|
33
|
+
before, after, mailbox = callbacks(processor)
|
|
34
|
+
|
|
35
|
+
agent = LlmAgent(
|
|
36
|
+
name="validateur",
|
|
37
|
+
model="gemini-3.5-flash-lite",
|
|
38
|
+
tools=[valider_adresse],
|
|
39
|
+
before_model_callback=before,
|
|
40
|
+
after_model_callback=after,
|
|
41
|
+
)
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
L'`Outcome` arrive sur `processor.outcomes` **apres que l'ADK a termine son span
|
|
45
|
+
de modele** -- plus tard que la fin de n'importe quel rappel. C'est toute la
|
|
46
|
+
raison d'etre de `close_on_model_span=True`.
|
|
47
|
+
|
|
48
|
+
### Lire le resultat d'outil que le modele a consomme
|
|
49
|
+
|
|
50
|
+
๐ด **Demande `OTEL_INSTRUMENTATION_GENAI_CAPTURE_MESSAGE_CONTENT=SPAN_ONLY`.**
|
|
51
|
+
โ **Et cette valeur met le contenu des reponses d'outil dans les spans** : si
|
|
52
|
+
votre outil manipule des donnees personnelles, votre telemetrie aussi.
|
|
53
|
+
|
|
54
|
+
โ **La valeur `true` NE MARCHE PAS pour cela** : elle resout vers `EVENT_ONLY`,
|
|
55
|
+
donc sur l'evenement et **pas** sur le span. Signale en amont :
|
|
56
|
+
[google/adk-python#8432](https://github.com/google/adk-python/issues/8432).
|
|
57
|
+
|
|
58
|
+
## Ce qu'il refuse de faire
|
|
59
|
+
|
|
60
|
+
- soumettre un decompte **lu sur un span** -- seulement celui que le fournisseur
|
|
61
|
+
a rendu ;
|
|
62
|
+
- mesurer un **second** appel de modele pendant qu'un premier est en attente : la
|
|
63
|
+
boite **refuse**, et `mailbox.refused` les compte. โ **Lire ce nombre** : non
|
|
64
|
+
nul, il signifie que des tours ont tourne **non mesures** ;
|
|
65
|
+
- differer une interaction dans laquelle l'**application a leve** ;
|
|
66
|
+
- **deviner** quel resultat d'outil un appel de modele a consomme quand plusieurs
|
|
67
|
+
sont candidats.
|
|
68
|
+
|
|
69
|
+
## Avant d'en tirer une conclusion
|
|
70
|
+
|
|
71
|
+
Lire [`LIMITATIONS.md`](LIMITATIONS.md). Le niveau de preuve est **E1** : des
|
|
72
|
+
tests hors ligne. ๐ด **Aucun appel reel n'a eu lieu.**
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Value โ adk-neomundi
|
|
2
|
+
|
|
3
|
+
## Ce que Google ADK garde
|
|
4
|
+
|
|
5
|
+
**Tout.** L'agent, les outils, le runner, sa propre telemetrie
|
|
6
|
+
OpenTelemetry, et le backend de traces que vous exploitez deja. ๐ด **Aucun
|
|
7
|
+
appel de modele n'est reecrit, bloque ni lu**, et aucune instrumentation n'est
|
|
8
|
+
remplacee.
|
|
9
|
+
|
|
10
|
+
## Ce que NeoMundi ajoute
|
|
11
|
+
|
|
12
|
+
Une **mesure comportementale signee et verifiable independamment** des tours de
|
|
13
|
+
modele que votre agent trace deja -- avec le `request_id` NeoMundi ecrit dans la
|
|
14
|
+
**meme trace**, donc un aller-retour entre votre backend et l'observation.
|
|
15
|
+
|
|
16
|
+
๐ข **Et une chose que la telemetrie seule ne donne pas** : le **resultat de
|
|
17
|
+
l'outil** que l'appel de modele a consomme, **joint depuis la trace** plutot que
|
|
18
|
+
devine -- par un attribut de **convention OpenTelemetry**, pas un champ
|
|
19
|
+
propietaire.
|
|
20
|
+
|
|
21
|
+
## ๐ด Ce qu'il ne pretend pas etre
|
|
22
|
+
|
|
23
|
+
| | |
|
|
24
|
+
|---|---|
|
|
25
|
+
| un juge de la qualite d'un modele | ๐ด **non.** Il mesure un appel, il ne note pas une reponse |
|
|
26
|
+
| une preuve de conformite | ๐ด **aucune.** Ni certification, ni determination juridique |
|
|
27
|
+
| un remplacement de la telemetrie de l'ADK | ๐ด **non** : il s'y ajoute, et il la lit |
|
|
28
|
+
| une reimplementation de `otel-neomundi` | ๐ด **surtout pas.** C'est exactement la duplication que ce paquet existe pour eviter |
|
|
29
|
+
|
|
30
|
+
## Pourquoi il est mince, et pourquoi c'est la valeur
|
|
31
|
+
|
|
32
|
+
Mesure : **16 lignes** de logique cote hote. Tout le reste est importe.
|
|
33
|
+
|
|
34
|
+
โ **Un paquet par hote qui recopierait le processeur, l'`Outcome` et les refus
|
|
35
|
+
serait plus gros, plus facile a livrer, et faux** : chaque copie derive, et la
|
|
36
|
+
garantie *ยซ un decompte lu sur un span n'est jamais soumis ยป* ne vaut que si
|
|
37
|
+
**une seule** implementation la tient.
|
|
38
|
+
|
|
39
|
+
## Usages typiques
|
|
40
|
+
|
|
41
|
+
- mesurer les tours de modele d'un agent ADK **sans** un second chronometre ni
|
|
42
|
+
une seconde instrumentation ;
|
|
43
|
+
- lire le **resultat d'un outil** a cote de la reponse de modele qui l'a
|
|
44
|
+
consomme, depuis la telemetrie seule ;
|
|
45
|
+
- savoir **gratuitement** lesquels de vos tours sont mesurables, avec
|
|
46
|
+
`submit=False` : aucune cle, aucun socket.
|