Skip to content

Latest commit

 

History

History
50 lines (34 loc) · 1.13 KB

File metadata and controls

50 lines (34 loc) · 1.13 KB

Restate TypeScript Agent + Braintrust tracing

An example of a Restate agent in TypeScript that emits traces to Braintrust.

Run the example

Install Restate and launch it:

npm install --global @restatedev/restate-server@latest @restatedev/restate@latest

Create a Restate configuration file restate.toml:

tracing-endpoint="otlp+https://api.braintrust.dev/otel/v1/traces"

[tracing-headers]
authorization="Bearer your-braintrust-api-key"
x-bt-parent="project_id:your-project-id"

Then run Restate with the configuration file:

restate-server --config-file restate.toml

Install the dependencies for the example:

npm install

Export your OpenAI API key and run the agent:

export BRAINTRUST_API_KEY=sk-...
export BRAINTRUST_PROJECT_ID=...
export OPENAI_API_KEY=sk-...
npm run dev

Register the agent with Restate via the UI or CLI:

restate deployments register http://localhost:9080 --force --yes

Go to the Restate UI localhost:9070 and click on your handler to run it via the playground.