15 Commits

Author SHA1 Message Date
Stephen Chu d9eeb9cb28 Simplify examples: Remove example 1, update project name
- Consolidate to single example showing cross-workspace workflow
- Change project name from "shared-trace-123" to "debug-project"
- Mark scrubbing as optional in the example

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-23 22:10:03 -05:00
Stephen Chu 232f123346 Allow uploading to existing projects
Instead of failing when a project exists, look up the existing project and
upload to it. This allows:
- Re-running uploads to the same project (adds duplicate runs)
- Uploading multiple traces to the same project for debugging

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-23 22:01:33 -05:00
Stephen Chu f51d737fac Detect and report when project name already exists
- Show clear error when project name is already taken (409 conflict)
- Display actual API error messages instead of hiding them
- Suggest user action: choose different name or delete existing project

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-23 22:00:15 -05:00
Stephen Chu 42a6d8c452 Remove "simple" from description
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-23 21:55:59 -05:00
Stephen Chu 3d92ad1aea Improve README clarity and workflow flexibility
- Make PII scrubbing optional instead of required
- Clarify that project names are user-defined placeholders
- Remove prescriptive "common fields" list (let users decide)
- Explain that API keys may differ between extract and upload workspaces
- Add two complete workflow examples (same workspace vs cross-workspace)
- Clarify regional endpoint usage (US default, EU option)
- Update title to reflect general purpose tools

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-23 21:55:49 -05:00
Stephen Chu bc83dcbc38 Fix shell compatibility: Remove bash-specific process substitution
Replace process substitution syntax with temp file to support zsh and other shells.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-23 21:42:25 -05:00
Stephen Chu a99f8cb5de Fix dotted_order and trace_id when regenerating run IDs
The dotted_order field embeds run IDs in the format:
  TIMESTAMP+UUID.TIMESTAMP+UUID...

When regenerating run IDs, we must also:
- Replace all old IDs in dotted_order with their new mapped IDs
- Update trace_id to use the new root run ID

This fixes HTTP 400 validation errors about dotted_order mismatches.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-23 21:40:55 -05:00
Stephen Chu 82674d7695 Add detailed error messages to upload failures
Show actual API error messages when uploads fail instead of just HTTP codes.
This helps debug 400/422 validation errors.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-23 21:38:46 -05:00
Stephen Chu 3eb2b29924 Fix upload: Regenerate run IDs to avoid conflicts
**Problem:** When uploading traces with run IDs that already exist in
LangSmith (e.g., from a previous upload), the API returns 409 conflict
and the runs don't get added to the new project. The script incorrectly
treated this as success.

**Solution:**
- Regenerate all run IDs before upload to ensure uniqueness
- Build ID mapping to preserve parent-child relationships
- Remove 409 handling since conflicts should no longer occur
- Add note about workspace determination via API key

This allows traces to be uploaded multiple times to different projects
without conflicts.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-23 21:37:23 -05:00
Stephen Chu c7af2e379d Make documentation more general for trace sharing
- Remove customer/support-specific language
- Use generic examples (debug-trace-123 vs customer-acme-issue-5678)
- Change "send to support" to "share" for broader use cases
- Update all examples to reflect general trace sharing workflow

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-23 18:46:40 -05:00
Stephen Chu 66f98654bb Clarify that upload creates a new tracing project
- Made it explicit that upload_trace.sh creates a new tracing project
- Added note that projects can be deleted later if needed
- Improved clarity throughout upload documentation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-23 18:46:00 -05:00
Stephen Chu 5b31b79331 Improve PII scrubbing: Use recursive field name matching
- Changed scrub_trace.sh to match field names recursively at any depth
- Works with arrays and nested objects (e.g., "content" finds all content fields)
- Simpler interface: just field names instead of dotted paths
- Safer for PII: catches sensitive data in unexpected locations
- Updated README with new usage examples and field list

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2025-12-23 18:42:56 -05:00
Stephen Chu d785edb9eb Update README structure: Extract and Scrub PII, Upload
Changed from 'Customer Workflow' and 'LangChain Team Workflow' to:
- Extract and Scrub PII (customer actions)
- Upload (LangChain team action)

Clearer separation of responsibilities.
2025-12-23 18:34:32 -05:00
Stephen Chu 277112478b Rename extract_langsmith_run.sh to extract_trace.sh for consistency
All three scripts now follow consistent naming:
- extract_trace.sh
- scrub_trace.sh
- upload_trace.sh
2025-12-23 18:30:30 -05:00
Stephen Chu 1500a96b36 Initial commit: LangSmith trace export and PII scrubbing scripts
- extract_langsmith_run.sh: Extract traces from LangSmith by trace ID
- scrub_trace.sh: Redact PII fields from traces
- upload_trace.sh: Upload scrubbed traces to LangSmith
- README.md: Complete documentation and usage examples
2025-12-23 18:26:19 -05:00