Getting Started
To get started with tracing, we need to create a tracing project on the Truefoundry UI, generate an API key for the tracing project and then add the tracing initialization code to our application along with the project name and the API key.
Tracing Projects are created in a Truefoundry Repository. You can configure which users have read/write access to a repository and hence to a trace project.
Create a tracing project
To create a tracing project from the UI:
- Navigate to your ML Repo.
- Go to the
Trace Projects
tab. - Click
New Trace Project
and enter the project name. - Click Submit.
Creating tracing projects
To create a tracing project from the UI:
- Navigate to your ML Repo.
- Go to the
Trace Projects
tab. - Click
New Trace Project
and enter the project name. - Click Submit.
Creating tracing projects
To publish traces, you need to use the Tracing Project FQN as mentioned in the subsequent steps.
Generate API Key
Generate API key following the steps here. Please save the value since we will need this in a later step.
You can also use a Virtual Account token with access to the Repository, in case you don’t want to use your personal token.
Install Traceloop SDK
Install Traceloop SDK using pip:
Copy the code from UI to add to your application
Navigate to the Tracing Project you created in the previous steps. Copy the code snippet to add to your application.
Click on Log Traces button to generate the code snippet
Add the code to your application
After adding the code snippet to your application, it should look something like this:
TFY_API_KEY
as the API key you generated in step 2. Run your application and view logged trace
Run your application and you should see traces on the TrueFoundry UI.
Add Tracing to your code based on framework
Annotate your Workflows, Agents and Tools
For complex workflows or chains, annotating them can help you gain better insights into their operations. With TrueFoundry, you can view the entire trace of your workflow for a comprehensive understanding.
Traceloop offers a set of decorators to simplify this process. For instance, if you have a function that renders a prompt and calls an LLM, you can easily add the @workflow
decorator to track and annotate the workflow. Let’s say your workflow calls more functions you can annotate them as @task
Similarly, when working with autonomous agents, you can use the @agent
decorator to trace the agent as a single unit. Additionally, each individual tool within the agent should be annotated with the @tool
decorator.