How to

Update an Agent Configuration

Use the YAML upload route to push instruction changes safely.

Update an Agent Configuration

Agent configuration lives in agents.raw_config plus individual columns for description, instructions, FAQs, and language settings. Updating is handled by PUT /api/agents/:id/from-yaml (packages/server/src/routes/agents.route.ts).

When to use

  • You have a YAML file under source control (e.g., packages/agent/samples/onenine-agent.yaml) and want to roll out new instructions.
  • You need to tweak FAQs, opening hours, or transfer destinations without touching the database manually.
  • You want Drizzle to handle JSON serialization and audit logging (timestamps update automatically).

Endpoint details

  • Method: PUT /api/agents/{agentId}/from-yaml
  • Auth: Authorization: Bearer <API key>
  • Body: multipart/form-data with one yamlFile field.
  • Limits: Files larger than 1 MB or non-YAML extensions are rejected by Multer before reaching the service.
curl -X PUT http://localhost:3001/api/agents/$AGENT_ID/from-yaml \
  -H "Authorization: Bearer $TELLYO_API_KEY" \
  -F "yamlFile=@packages/agent/samples/onenine-agent.yaml"

Behind the scenes:

  1. The route validates file type and size.
  2. updateAgentFromYaml parses YAML via js-yaml, maps known keys (description, instructions, faqs, supportedLanguages, defaultLanguage), and stores the entire payload as JSON in rawConfig.
  3. The updated row is returned to the caller.

Verification

  • GET /api/agents/{agentId} – confirm textual fields changed.
  • GET /api/agents/by-phone/{phone} – ensure the LiveKit worker sees the new config (the response wraps the parsed JSON under agent.config).

If a malformed YAML file slips through, the service throws with a descriptive Invalid YAML format error so you can fix the file before retrying.