Skip to content

feat: Add unified agent configuration system#23

Open
marklubin wants to merge 1 commit into
mainfrom
feature/unified-agent-config
Open

feat: Add unified agent configuration system#23
marklubin wants to merge 1 commit into
mainfrom
feature/unified-agent-config

Conversation

@marklubin

Copy link
Copy Markdown
Owner

Summary

Implements a single agents table as the source of truth for all agent configuration, replacing scattered config across agent_definitions, agent_voice_settings, and hardcoded values in code.

This is Phase 1 of the Unified Agent Configuration design.

Key Changes

  • New agents table with comprehensive config:

    • Primary LLM config (inference_model, inference_provider_url, context_window, etc.)
    • Background LLM config (for summarizer, insights agents)
    • Block schema (JSONB defining all memory blocks with KP3 ref suffixes)
    • Voice (FK to voices table)
    • KP3 integration (ref prefix, hooks enabled)
    • Letta sync state (agent_id, sync_hash for change detection)
  • SQLAlchemy model + Pydantic schemas + CRUD service

    • Full type safety with pyright strict mode
    • Hash-based sync detection to avoid unnecessary Letta updates
  • agent-admin CLI commands:

    • list - List all configured agents
    • show <name> - Show detailed configuration
    • create - Interactive agent creation
    • delete <name> - Delete from config DB
    • export <name> - Export config as JSON
    • migrate - Migrate existing Letta agents to unified config
  • Voice service updated:

    • Falls back to agents table if not found in legacy agent_voice_settings
    • TTS provider selection now uses voice.provider from database instead of env var

Migration Path

  1. Run ./kx migrate to create the new table
  2. Run agent-admin migrate --dry-run to preview what will be migrated
  3. Run agent-admin migrate to create unified config from existing Letta agents
  4. Voice lookup automatically checks both tables

Deferred to Follow-up PR

  • Phase 2: BlockManagerAgent → KP3 refs integration (requires KP3 ref hooks)

Test plan

  • Run migrations locally: ./kx migrate
  • Test agent-admin CLI commands
  • Verify voice lookup works from both legacy and new tables
  • Test TTS provider selection uses voice.provider from DB

🤖 Generated with Claude Code

Implements a single `agents` table as the source of truth for all agent
configuration, replacing scattered config across agent_definitions,
agent_voice_settings, and hardcoded values.

Key changes:
- New agents table with full LLM config, block schema, voice, KP3 integration
- SQLAlchemy model, Pydantic schemas, and CRUD service
- agent-admin CLI: list, show, create, delete, export, migrate commands
- Voice service falls back to agents table for voice lookup
- TTS provider selection now uses voice.provider from database

The migration command discovers agents from Letta and creates unified
config entries. Voice lookup checks both legacy agent_voice_settings
and the new agents table for backward compatibility.

Phase 2 (BlockManagerAgent KP3 refs) deferred to follow-up PR.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant