An example of a Restate agent in TypeScript that emits traces to Braintrust.
Install Restate and launch it:
npm install --global @restatedev/restate-server@latest @restatedev/restate@latestCreate 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.tomlInstall the dependencies for the example:
npm installExport your OpenAI API key and run the agent:
export BRAINTRUST_API_KEY=sk-...
export BRAINTRUST_PROJECT_ID=...
export OPENAI_API_KEY=sk-...
npm run devRegister the agent with Restate via the UI or CLI:
restate deployments register http://localhost:9080 --force --yesGo to the Restate UI localhost:9070 and click on your handler to run it via the playground.