feat: Update local agent documentation to reflect changes in user_id and session_id handling; add marketing strategy document; update skills-lock.json with new Remotion best practices; update website subproject commit.
This commit is contained in:
@@ -220,13 +220,22 @@ if lf:
|
||||
|
||||
**Pattern V3 corretto nel codice produzione (`agent_runner.py`, `deep_agent.py`, `agent_setup.py`):**
|
||||
```python
|
||||
# user_id e session_id vanno in metadata, NON come kwarg diretti
|
||||
lf.start_as_current_observation(
|
||||
# user_id e session_id propagati come attributi first-class Langfuse
|
||||
# tramite langfuse_context() che wrappa propagate_attributes()
|
||||
from app.core.langfuse_client import langfuse_context
|
||||
|
||||
_lf_ctx = langfuse_context(user_id=user_id, session_id=session_id)
|
||||
_lf_ctx.__enter__()
|
||||
|
||||
# user_id viene hashato con SHA-256 prima dell'invio a Langfuse
|
||||
# session_id arriva dal renderer (home/floating) o dal run_id (batch)
|
||||
|
||||
_span_ctx = lf.start_as_current_observation(
|
||||
as_type="span",
|
||||
name="my-span",
|
||||
metadata={"user_id": user_id, "session_id": session_id},
|
||||
input=...,
|
||||
)
|
||||
# NON mettere user_id/session_id in metadata — propagate_attributes li gestisce
|
||||
```
|
||||
|
||||
### compile_prompt — non usare template.format() direttamente
|
||||
|
||||
Reference in New Issue
Block a user