Skip to main content

Persona Manager โ€” Function-call index

Seeded by migration 1746000000011-SeedPersonaManagerFunctions.ts. Versioned via the tavus_function_definitions table; new versions are published from the SuperAdmin UI at /ops/personas/function-calls.

Onboarding (6)โ€‹

NameDescription
record_environment_factCaptures one stable property of the operating environment. category โˆˆ {systems, process, data, vocabulary, metrics}.
record_guardrailA rule the Specialist must follow. kind โˆˆ {must_do, must_not_do, escalation_trigger, compliance}, severity โˆˆ {low, medium, high, critical}.
record_stakeholderA person or role the Specialist will interact with.
flag_follow_up_questionA question the Specialist couldn't fully resolve in the call.
generate_onboarding_summaryThe closing summary โ€” flips the EnvironmentProfile to pending_approval.
escalate_to_supervisorAn issue out of scope for the Specialist โ€” captured as a high-priority follow-up.

Handler implementations live at api/src/environment-profiles/handlers/onboarding-handlers.ts. Each writes to environment_profiles.data.<bucket> via EnvironmentProfilesService.appendToBucket or setBucket. Every mutation is audited via the existing AuditService.log.

Reporting (6)โ€‹

NameDescription
log_manager_decisionRecords a decision. Writes BOTH meeting_decisions AND the existing actions table (actorType=reporting_meeting, actionType=decision_logged).
update_prioritiesCaptures a fresh priority list. One meeting_priorities row per entry.
raise_escalationWhen conversation_id is supplied โ†’ routes through ExpertQueueService.createQueueItem. Without it โ†’ captured as a high-priority follow-up on the environment profile.
flag_environment_changeA change to the operating environment surfaced mid-meeting โ€” does NOT auto-edit the profile; recorded as a follow-up for the operator.
note_feedback_for_specialistCaptures feedback signal via AuditService.log (resourceType=meeting, action=meeting.feedback_noted).
schedule_next_checkinSets meeting.metadata.next_checkin_* and audits.

Handler implementations live at api/src/meetings/handlers/reporting-handlers.ts.

Action extension-point castโ€‹

The existing ActorType and ActionType are TypeScript union types over a VARCHAR DB column. Persona-manager handlers cast 'reporting_meeting' as unknown as ActorType and 'decision_logged' as unknown as ActionType at the write site. The cast is local to new code; api/src/common/entities.ts is not modified. This is documented in ADR-0001 and the integration spec ยง4.

Idempotencyโ€‹

Every function-call handler receives the Tavus idempotency key in its WebhookRouterService context. The router itself rejects duplicate deliveries before any handler runs (Redis SET NX EX with 24h TTL; in-memory fallback). Handlers additionally write the key to idempotency_key columns where present (meeting_decisions, meeting_priorities) so a second-delivery race that slips past the router still no-ops at the DB level via the partial unique index from migration 1746000000010.

Adding a new function callโ€‹

  1. Add a row to tavus_function_definitions (either via the SuperAdmin UI or a new seed migration).
  2. Implement the handler in api/src/environment-profiles/handlers/ (onboarding) or api/src/meetings/handlers/ (reporting).
  3. Register it in the corresponding *Handlers.registerAll() method.
  4. Cover it with a unit test against a mocked WebhookRouterService.
  5. Update this index.