Add Talaria with an agent
Agent playbook: detect stack, fetch docs, wire API key and init, then verify ingest.
What you're setting up
A developer connects Talaria MCP and says “Add Talaria to this project.” You combine local project context, these docs, and live Talaria tools.
Why use this
Cursor and Grok Bot agents can use talaria-instrument from the Talaria plugin for guided install. This playbook is the detailed how-to that skills reference. See Agent skills overview.
Before you start
Do not automate these:
- Creating billing orgs / paying plans
- Committing API keys
- Creating projects or minting keys without announcing identity and asking first
- Enabling replay/analytics without consent guidance
- Claiming features the stack does not support (e.g. browser session replay on Flutter)
- Switching Talaria accounts via tools (reconnect MCP instead)
Steps
1. Load this playbook and detect the stack
get_docpathagents/add-talaria(public).- Inspect the local repo with IDE tools. Map the stack:
| Signal | Likely SDK |
|---|---|
| Flutter | talaria_flutter → sdk/flutter |
| Dart | talaria → sdk/dart |
| Serverpod | talaria_serverpod → sdk/serverpod |
| Next.js | @newtalaria/nextjs → sdk/nextjs |
| React | @newtalaria/react → sdk/react |
| Node | @newtalaria/node → sdk/node |
| Browser | @newtalaria/browser → sdk/javascript |
| Laravel | talaria/laravel → sdk/laravel |
| Silverstripe | talaria/silverstripe → sdk/silverstripe |
| PHP | talaria/talaria → sdk/php |
search_docswithsdkfilter and queryinstall/init/bootstrap, thenget_docthe stack README and configuration. Alsoget_docsdk/<id>/errorsandsdk/<id>/tracingfor that stack (javascript,react,nextjs,node,php,laravel,silverstripe,dart,flutter,serverpod).
2. Authenticate and announce identity
- If org tools fail with Unauthorized, run MCP auth / reconnect with install scopes (
mcp:read mcp:write mcp:keys). - Call
get_connectionimmediately after auth. - Announce to the user (mandatory, before any mutate):
You’re connected as {name} (
{email}) under organisation {orgName}.
This connection can {install capabilities}.
You also belong to {otherOrganizations}. Wrong org? Say which to switch to. Wrong account? Disconnect Talaria MCP and sign in as the other user.
- Wrong org →
switch_organizationwith thatorganizationId→ callget_connectionagain → re-announce. - Wrong account → stop mutating; tell them to reconnect MCP as the other Talaria user.
3. Ask before creating
- Suggest a project name from the local app (e.g. package name / folder).
- List existing projects from
get_connection.projectsorlist_projects. - Ask (never auto-create):
Create a new Talaria project named {suggested} in {orgName}, wire the SDK, mint a publishable key, and send a first test event?
Or reuse an existing project?
4. Bootstrap only after yes
- On yes / reuse →
setup_projectwithconfirmed: trueand eithernameorprojectId. Prefer this over separatecreate_project+create_api_key. This mints a development key. Production shipping is a second key, created when someone is actually shipping. - Put the one-time
apiKeyonly in env /--dart-define/ ignored local config. Never committal_pk_prod_nz1_…. Do not echo the key later. The key decides the environment. Do not passenvironmentin SDK init. - Edit the app from the SDK docs (dependency, init, framework hooks). Local runs still send a version or SHA as
release. - If Node or Next.js server code talks to a database,
get_docpathsdk/node/tracingand follow the snippet for that library. Wrap the object that runs the SQL, afterTalaria.init:pg→wrapPgon thePoolorClient.mysql2→wrapMysql2on the pool.redisorioredis→wrapRedis. The span uses the command name. Leave the key and the value off the span.@duckdb/node-api→wrapDuckDBon the connection frominstance.connect(). LeaveDuckDBInstanceunwrapped.- Prisma with
@prisma/adapter-pg→wrapPgthe pool, then pass it toPrismaPg. A defaultPrismaClientdoes not callquery. Without an adapter, timefindManywithTalaria.startSpanand do not copy thewhereobject onto the span. - Drizzle and Kysely → wrap the pool you pass into
drizzle()orPostgresDialect/MysqlDialect. - Knex and Sequelize open their own connections. Use the Knex query events or the Sequelize
beforeQuery/afterQueryhooks from that page. Do not wrap a separate pool and expect those queries to appear. - MongoDB,
better-sqlite3, andnode:sqlitehave no wrapper. Open a CLIENT span around the call. Leave bound values, documents, and result rows in the app.
- Call
send_test_eventon the realprojectId.
5. Source maps for browser, React, and Next
After init, a minified stack stays minified until maps are uploaded for the same release.
get_docpathguides/upload-javascript-source-maps.- Set
Talaria.init({ release: 'local' })for a local run, or the git SHA in CI. The release string on events must match the upload. - Ask before minting a second key. Call
create_api_keywithscopes: ["releases:write"]and a name likesource maps. Do not add that scope to the browser key fromsetup_project. - Put the raw key only in
TALARIA_RELEASE_KEY. Then runnpx talaria source-maps upload ./dist. LeaveTALARIA_URLunset on Talaria Cloud. The default release islocal. - Open the event with
get_event. If a frame is still a hashed*.jsfile, callget_source_mapand upload thefileNameit returns.
6. App init vs Project settings
| In app init | In Project settings (the project config fetch) |
|---|---|
| URL / base URL | Tracing on/off + sample rate |
| API key (this chooses the environment) | Analytics on/off |
| release (version or SHA) | Heatmaps on/off |
| minLevel, beforeSend, tags | Session replay on/off + rates |
setup_project enables tracing by default. Leave analytics / heatmaps / replay alone unless the user opts in with consent guidance.
Until remote config arrives, SDKs send errors only. Flutter does not support browser session replay.
7. Production loop
search_issueswithenvironment: production(the default once a production key exists) →get_issue→ optionalget_trace/search_sessionsin that same environment.- Fix code locally.
- Instrument more using docs.
search_docswith the stacksdkfilter fortracing,errors, oranalytics, thenget_docthe top hit. Analytics and feature flags are onsdk/<id>/configuration. - Re-verify with stats and search tools.
Check it worked
Verify with search_events / search_issues, passing environment: development. A just-installed project has no production key, and these tools default to development in that case; pass development anyway so a later production key does not hide the local traffic. Install success is search_issues or search_events on development.
Close with the dashboardUrl and how to run the app with the key. The dashboard shell reads one environment at a time and defaults to production when a production key exists, otherwise development. Switch to Development to see this install.
Do not claim “Talaria is wired” until that search returns the test event.
Troubleshooting
Stats stay at zero after the test event
Cause: get_project_stats countsByEnvironment is analytics volume and stays 0 when analytics is off.
Fix: Confirm install with search_issues or search_events on environment: development. Do not treat a zero analytics count as a failed install.