For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Trust CenterStatusSupportGet a demoPlatform
DocumentationEvals API ReferenceIntegrations & OTELPlatform SettingsSelf-HostingGuidesChangelog
DocumentationEvals API ReferenceIntegrations & OTELPlatform SettingsSelf-HostingGuidesChangelog
    • Guides
  • End-to-End
    • Provision Projects for Agents on the Fly
LogoLogo
Trust CenterStatusSupportGet a demoPlatform
On this page
  • Overview
  • Build It
  • Next Steps
End-to-End

Provision Projects for Agents on the Fly

Spin up a dedicated Confident AI project for each agent your users build, then trace and evaluate every agent in isolation.
Was this page helpful?
Previous

Changelog

Next
Built with

Overview

This guide is for teams that want to create Confident AI projects programmatically instead of creating them manually in the platform UI. It is especially useful for internal agent-building platforms, multi-tenant products, and proofs of concept where each agent (or tenant or customer) should have its own isolated Confident AI project.

For example, imagine an enterprise platform where every user builds their own agents. Each agent should get its own Confident AI project so its traces and evaluations stay isolated from every other agent on the platform.

In this guide, you will:

  • Configure the Admin SDK with one Organization API Key.
  • Create a project in code for each agent the moment it is built.
  • Store the returned Project API Key with the project ID for later trace routing.
  • Route traces to the correct project by setting the Project API Key on each trace.

By the end, your platform will be able to provision an isolated Confident AI project per agent on demand and send each agent’s traces, datasets, and evaluations to the right workspace.

Build It

1

Install SDKs

The Admin SDK is available in both Python and TypeScript through confidentai. You also need deepeval to route traces into each project.

Python
TypeScript
$pip install confidentai deepeval
2

Configure Admin SDK

You need an Organization API Key before you start. Retrieve yours here.

Set CONFIDENT_ORG_API_KEY to your Organization API Key. The Admin SDK reads this variable by default when you create a client.

$export CONFIDENT_ORG_API_KEY="confident_us_org_..."
Python
TypeScript
app/confident.py
1from confidentai import ConfidentAI
2
3confident_ai = ConfidentAI()
3

Provision Project

Create a project for each application. The projects.create(...) call returns the new project and its first Project API Key. Store both values with that application so traces can be routed to the same project later.

The storage helpers in this example represent your own database or persistence layer.

Python
TypeScript
app/onboarding.py
1from app.confident import confident_ai
2from app.storage import save_application_project
3
4def onboard_application(application_slug: str):
5 new_project = confident_ai.projects.create(name=application_slug)
6
7 save_application_project(
8 application_slug,
9 project_id=new_project.project.id,
10 project_api_key=new_project.api_key.value,
11 )
12 return new_project.project.id

To grant project access after creation, invite members with project.invitations.create(...) and assign a role from the same Admin SDK client.

4

Route Traces

The Project API Key determines which project receives a trace. To keep applications isolated, set the key on the current trace inside the observed function.

Python
TypeScript
app/agent.py
1from openai import OpenAI
2from deepeval.tracing import observe, update_current_trace
3from app.storage import load_application_project
4
5client = OpenAI()
6
7@observe()
8def run_for_application(application_slug: str, query: str):
9 application = load_application_project(application_slug)
10 update_current_trace(confident_api_key=application.project_api_key)
11
12 return client.chat.completions.create(
13 model="gpt-4o",
14 messages=[{"role": "user", "content": query}],
15 ).choices[0].message.content
5

Verify Routing

Create a project for an application, execute the application, and confirm that the trace appears in the correct project.

Python
TypeScript
1from app.onboarding import onboard_application
2from app.agent import run_for_application
3
4onboard_application("support-bot")
5run_for_application("support-bot", "What's on my agenda today?")

Open the Observatory and switch to the support-bot project. The trace appears in that project, isolated from every other application.

Traces in the Observatory

Done ✅. The workflow now creates a dedicated project per application and routes traces using a single Organization API Key.

Next Steps

Now that each tenant or application can route traces to its own project, use these sections to extend the workflow:

Manage Projects

Manage the projects your application creates, including updates and cleanup.

Members & Invitations

Add users to the projects you create and assign the right project-level roles.

LLM Tracing

Customize the traces you route by setting span types, metadata, tags, and other trace attributes.

Online Evals

Run evaluations automatically as traces arrive in each isolated project.