feat: Configuration System Migration for Go (Ticket 1.2)#20
Open
devin-ai-integration[bot] wants to merge 6 commits intodemo-go-migrationfrom
Open
feat: Configuration System Migration for Go (Ticket 1.2)#20devin-ai-integration[bot] wants to merge 6 commits intodemo-go-migrationfrom
devin-ai-integration[bot] wants to merge 6 commits intodemo-go-migrationfrom
Conversation
- Add github.com/spf13/viper for YAML parsing and env var binding - Add github.com/go-playground/validator/v10 for struct validation - Add gopkg.in/yaml.v3 for YAML unmarshaling - Add github.com/stretchr/testify for testing utilities - Go automatically upgraded from 1.21 to 1.24 to meet Viper requirements Co-Authored-By: Jude Partovi <jude@partovi.org>
- Convert all models from models.py, ska_types.py, and config files - Add common.go with enums (ModelType, ContentType, SseEventType, TaskStatus, Role) - Add models.go with data models (UserMessage, AgentTask, TealAgentsResponse, etc.) - Add config.go with all configuration types for each orchestrator - Add env_config.go with environment variable configuration (24+ vars) - Add validation tags for field constraints (temperature 0-1, required fields, etc.) - Support all orchestrator types (Sequential, Chat, Team, Planning, Assistant) - Maintain backward compatibility with Python structures Co-Authored-By: Jude Partovi <jude@partovi.org>
- Use Viper for YAML parsing and env var binding with TA_ prefix - Support all orchestrator types (Sequential, Chat, Team, Planning, Assistant) - Implement TA_ENV_STORE and TA_ENV_GLOBAL_STORE JSON parsing - Add comprehensive validation using go-playground/validator - Ensure backward compatibility with existing YAML files - Auto-detect config type by 'kind' field for flexible loading - Properly handle optional fields with pointer types Co-Authored-By: Jude Partovi <jude@partovi.org>
- Unit tests for env var loading with defaults and JSON stores - Unit tests for YAML parsing (Sequential, Chat, TeamOrchestrator) - Validation tests for field constraints (e.g., temperature range) - Integration tests with 5 real config files from repository: * Getting Started Sequential * Chat with Plugins * Team Orchestrator * Planning Orchestrator * Assistant Orchestrator - Test LoadConfigByKind auto-detection functionality - All tests pass, confirming backward compatibility Co-Authored-By: Jude Partovi <jude@partovi.org>
- Document features (Viper, validation, orchestrator support) - Provide usage examples for env vars and YAML loading - List all required environment variables - Include testing commands for unit and integration tests Co-Authored-By: Jude Partovi <jude@partovi.org>
- Add go-test-config for unit tests - Add go-test-integration for integration tests with real configs Co-Authored-By: Jude Partovi <jude@partovi.org>
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR implements Ticket 1.2: Configuration System Migration for the Go migration of Teal Agents. It converts the Python Pydantic-based YAML configuration and environment variable handling system to Go, maintaining full backward compatibility with all existing configuration files.
Link to Devin run: https://app.devin.ai/sessions/5f271213c82c46f4900bd7fa6dc3f441
Requested by: @jpartovi
Changes
Dependencies
github.com/spf13/viperfor YAML parsing and environment variable bindinggithub.com/go-playground/validator/v10for struct validationgopkg.in/yaml.v3for YAML unmarshalinggithub.com/stretchr/testifyfor testing utilitiesType Definitions (
pkg/config/types/)ModelType,ContentType,SseEventType,TaskStatus,RoleUserMessage,AgentTask,TealAgentsResponse, etc.) converted from Python Pydantic modelsConfiguration Loader (
pkg/config/loader/)TA_prefixTA_ENV_STORE,TA_ENV_GLOBAL_STORE)kindfieldTests (
pkg/config/loader/tests/)Build System
go-test-configandgo-test-integrationType of Change
Key Implementation Details
Type Mapping Strategy
Optional[T]→ Go*T(pointer for optional fields)Literal["a", "b"]→ Go custom type with const valuesField(ge=0, le=1)→validate:"gte=0,lte=1"ChatHistoryuseanyfor flexibilityEnvironment Variable Handling
"TA"inNewConfigLoader()TA_prefix (e.g.,mapstructure:"API_KEY")TA_API_KEYenv var maps toAPI_KEYfieldBackward Compatibility
All 5 integration tests passed, confirming that existing YAML files load correctly without modification.
Important Review Points
CRITICAL: Please verify the following:
Type mappings: Cross-reference Go structs in
pkg/config/types/*.goagainst Python Pydantic models in:src/sk-agents/src/sk_agents/tealagents/models.pysrc/sk-agents/src/sk_agents/ska_types.pysrc/sk-agents/src/sk_agents/configs.pyEnvironment variable handling: Test that
TA_API_KEYand other env vars are correctly loaded with the Viper prefix configurationValidation constraints: Verify validation tags (especially
Temperaturefield withvalidate:"omitempty,gte=0,lte=1")Default values: Confirm
DefaultEnvConfig()matches PythonConfigManager.load()defaultsManual testing: Try loading a real YAML config file using the new Go loader to verify integration tests are accurate
Go version: Deployment environments must support Go 1.24+ (auto-upgraded from 1.21)
Testing
All tests pass:
The integration tests verify backward compatibility by loading actual config files from:
src/sk-agents/docs/demos/01_getting_started/config.yamlsrc/sk-agents/docs/demos/10_chat_plugins/config.yamlsrc/orchestrators/collab-orchestrator/orchestrator/conf/config_team.yamlsrc/orchestrators/collab-orchestrator/orchestrator/conf/config_planning.yamlsrc/orchestrators/assistant-orchestrator/orchestrator/conf/config.yaml