Repository navigation
feat(prompts): introduce provider-agnostic prompt provenance metadata - #155
Conversation
Add PromptProvenance and ResolvedPrompt domain models with deterministic SHA-256 source content hashing. Introduce load_file_with_provenance in prompting module while preserving full backward compatibility for load_file. Part of extra-org#130
Preview approval requiredThis pull request comes from a fork, so Mintlify won't build a preview until someone with write access approves commit |
|
Thanks for the contribution. The provider-agnostic provenance model and the separation between source templates and rendered content look like a good foundation. Keeping runtime/trace propagation and remote prompt loading for follow-up PRs makes sense for this scope. I found one blocker that needs to be fixed before approval: Windows-style string paths are not normalized correctly on POSIX systems. In There is a related issue in Please normalize supported path separators consistently for both file lookup and provenance identifiers, add coverage for a plain backslash-separated string passed to Local validation of commit
|
I'll work on it and see that everything is normalized |
|
@Asaf-prog I've pushed a follow-up fix that normalizes Windows-style relative paths consistently for both file lookup and provenance identifiers, with additional regression tests. I also set up Ubuntu 24.04 under WSL2 with Python 3.14.2 to reproduce and verify the issue in a POSIX environment. Validation results:
The fix is included in the existing PR. Ready for another review. Thanks! |
|
please make star to the project |
Problem
As the platform expands to support remote prompt management systems such as Langfuse (issue #130), agent runs need to record the exact prompt revision and fingerprint that produced each model invocation. Storing only a prompt name or mutable label (e.g.
production) makes historical executions difficult to reproduce when prompt labels change.Proposed Changes
This PR introduces the foundational, provider-agnostic prompt provenance contract without altering existing runtime behavior:
PromptProvenanceModel (agent_engine.core.provenance):source,identifier,content_hash,requested_ref, andresolved_revision.to_dict().Deterministic Source Content Hashing (
compute_prompt_hash):sha256:<digest>over the raw UTF-8 source template.ResolvedPrompt& Local File Loading (load_file_with_provenance):PromptProvenance.load_file(base_dir, relative_path) -> strbehavior as a backward-compatible wrapper.Documentation & Unit Tests:
docs/PROMPT_RENDERING.md.Scope
Part of #130. This PR intentionally focuses on establishing the typed contract, deterministic hashing, and local file loading. It does not implement Langfuse remote prompt fetching or runtime propagation, which will follow in subsequent PRs.
Verification
ruff format --check src testspassed.ruff check src testspassed.mypy src/agent_engine tests/core/test_provenance.py tests/engine/test_prompt_loading.pypassed.pytest tests/core tests/enginepassed (145 passed).agentctl validate examples/starter/agents.yamlandagentctl validate examples/enterprise-knowledge-assistant/agents.yamlpassed.