Repository navigation
fix(py): show prompt calls as their own span with render and generate in the Dev UI - #66
Merged
Merged
Conversation
cabljac
approved these changes
Nov 10, 2026
…ailed render traces
huangjeff5
force-pushed
the
fix/py-trace-prompt-span
branch
from
November 10, 2026 19:47
fd373e5 to
30bfe01
Compare
This was referenced Nov 15, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Calling a prompt now shows in Dev UI traces as its own span, with
renderandgenerateunder it. Before, the template step was invisible and the model call hung straight off the caller, so you couldn't tell which prompt ran or what it rendered.Main Changes
__call__andstreamwrap render + generate in a span named with the registry key (greeting_prompt,greeting_prompt.formal,ns/name). Input is the prompt input, output is theModelResponse. A response with.errormarks the span failed; it still returns, same asgenerate.rendershows what the template produced: Arenderspan (typepromptTemplate,genkit:metadata:promptName= the same key) records the input and the resultingGenerateActionOptions.prompt.render(), prompt agent turns (define_agent), and both Dev UI runners (/prompt/...,/executable-prompt/...) emit it too.renderandgeneratesit under the caller. JS has no unnamed prompts.Behavior changes
No API or return-type changes. Trace shape changes:
generateand model spans under a prompt now have the prompt in theirgenkit:path. Anything filtering exported spans by path will see the extra segment.Cross-SDK
Span names,
genkit:typevalues, andpromptNamematch JSprompt.ts(including prompt agents rendering throughrender_promptso agent turns emit arenderspan). Two intentional differences from JS:.stream()ondefine_prompthandles: Python wraps.stream()in thedotpromptspan on bothai.define_prompt(...)andai.prompt(...)handles so the trace tree does not depend on how the caller obtained the prompt handle, whereas JS only wrapsai.prompt('name').stream()(wrapExecutablePromptPromise) and omits the prompt span ondefinePrompt().stream().LoadPromptDirFromFSwithnamespace="") both registerfile_prompt.promptasfile_promptwithout JS's defaultdotprompt/namespace prefix, matchingai.prompt('file_prompt')and preserving/prompt/...and/executable-prompt/...action keys.