DOC: <Issue related to /observability/how_to_guides/trace_with_api> #56

Closed
opened 2026-02-21 17:17:04 -05:00 by yindo · 1 comment
Owner

Originally created by @jamescraig-cl on GitHub (Mar 7, 2025).

Hello! I have multiple tracing projects in my workspace and need to send data via API traces to a specific project. I looked at the API documentation for creating a run and do not see any project/workspace/other options. I can add tags, which does help segment out the data, but I'd prefer to specify a tracing project. Can the API accept project names?

Originally created by @jamescraig-cl on GitHub (Mar 7, 2025). Hello! I have multiple tracing projects in my workspace and need to send data via API traces to a specific project. I looked at the API documentation for creating a run and do not see any project/workspace/other options. I can add tags, which does help segment out the data, but I'd prefer to specify a tracing project. Can the API accept project names?
yindo closed this issue 2026-02-21 17:17:04 -05:00
Author
Owner

@angus-langchain commented on GitHub (Mar 24, 2025):

Hi @jamescraig-cl, You can specify a session name or session id within each run object.

def post_run(run_id, name, run_type, inputs, parent_id=None):
    """Function to post a new run to the API."""
    data = {
        "id": run_id.hex,
        "name": name,
        "run_type": run_type,
        "inputs": inputs,
        "start_time": datetime.utcnow().isoformat(),
        "session_name: "<your project name>" <---- Add this line (or session_id)
    }
   
    requests.post(
        "https://api.smith.langchain.com/runs", # Update appropriately for self-hosted installations or the EU region
        json=data,
        headers=headers
    )
@angus-langchain commented on GitHub (Mar 24, 2025): Hi @jamescraig-cl, You can specify a session name or session id within each run object. ``` def post_run(run_id, name, run_type, inputs, parent_id=None): """Function to post a new run to the API.""" data = { "id": run_id.hex, "name": name, "run_type": run_type, "inputs": inputs, "start_time": datetime.utcnow().isoformat(), "session_name: "<your project name>" <---- Add this line (or session_id) } requests.post( "https://api.smith.langchain.com/runs", # Update appropriately for self-hosted installations or the EU region json=data, headers=headers ) ```
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/langsmith-docs#56