Sharing
Sharing via API key
Share from CI, containers and scripts without an interactive login, including a GitHub Action.
Create a key
Namespace admins create keys in https://adtraces.adfactory.app/<namespace>/settings under API keys. A key
- starts with
trk_and is shown once, - belongs to one namespace and acts as the user who created it,
- can expire, and can be revoked on the same page,
- carries scopes. Grant only what the job needs.
| Scope | Allows |
|---|---|
traces:read |
Read traces and messages, use MCP |
traces:write |
Create, update and delete traces, upload messages |
namespace:read |
Read namespaces, members and the session |
surfaces:write |
Publish surfaces |
An upload job needs traces:write.
Use it
bash
export TRACES_HTTP_URL=https://adtraces.adfactory.app
export TRACES_URL=https://adtraces.adfactory.app
export TRACES_API_URL=https://adtraces.adfactory.app
export TRACES_API_KEY=trk_...
traces share --cwd . --agent auto --jsonOr pass it per call: traces share --cwd . --key trk_....
GitHub Actions
Store the key as the secret TRACES_API_KEY and the instance address as a variable TRACES_URL. The runner must be able to reach your instance.
yaml
name: Share trace
on: [push]
jobs:
share:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install traces CLI
run: npm i -g @traces-sh/traces
- name: Run agent task
env:
ANTHROPIC_API_KEY: ${{ secrets.ANTHROPIC_API_KEY }}
run: claude --print "Review this code for bugs"
- name: Share trace
env:
TRACES_HTTP_URL: ${{ vars.TRACES_URL }}
TRACES_URL: ${{ vars.TRACES_URL }}
TRACES_API_URL: ${{ vars.TRACES_URL }}
TRACES_API_KEY: ${{ secrets.TRACES_API_KEY }}
run: |
RESULT=$(traces share --cwd . --agent auto --json)
URL=$(echo "$RESULT" | jq -r '.data.sharedUrl')
echo "### Trace shared" >> "$GITHUB_STEP_SUMMARY"
echo "[$URL]($URL)" >> "$GITHUB_STEP_SUMMARY"Plain HTTP
No CLI needed. Send the key as a bearer token, see the API overview.
bash
curl -H "Authorization: Bearer $TRACES_API_KEY" https://adtraces.adfactory.app/v1/traces