Setup
1
Obtain your API Key
Create your LangWatch account and project to obtain your API Key from the dashboard
2
Environment Variables
Add the following key to Langflow .env file:Or export in in your terminal:
3
Restart Langflow
Restart Langflow using
langflow run --env-file .env
4
Test the integration
Run a message through your Langflow project and check the LangWatch dashboard for monitoring and observability.
That’s it! You should now see your Langflow component traces on the LangWatch dashboard.


Defining custom input and output
You can customize what LangWatch captures as the final input and output of your Langflow component for better observability. To do this, you can add this two lines of code in the execution function of any Langflow component:<> Code
button in any appropriate component:

def
responsible for execution of that component and paste the code above, mapping the variables as needed for your case:


Capturing additional metadata
You can also capture additional metadata from your Langflow component. This can be useful for capturing information about the user, the conversation, or any specific information from your system. Just like for the input and output, you can capture metadata by updating the trace, two very useful cases to capture for example are the user_id and trace_id that groups messages from the same conversation, but you can also capture any other information that you want to track.For more information, check out Langflow docs.