Skip to content

Add validation for required character fields in agent.py #6

@coderabbitai

Description

@coderabbitai

Description

The agent.py file accesses character["prompt"] and character["name"] directly without validation (around lines 146-148). If these fields are missing from the character object retrieved from Convex, a KeyError will be raised at runtime.

Location

  • File: apps/live/src/agent.py
  • Lines: ~146-148 (and similar usage throughout the file)

Problem

Currently, the code validates voiceId but does not validate other required fields like name and prompt before using them in the Template rendering.

Suggested Approach

Add validation after retrieving the character object to ensure required fields (name, prompt) are present and non-empty, similar to the existing voiceId validation.

References

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions