Skip to content

Conversation

@ilackarms
Copy link
Collaborator

initializes the kube controller component of kagent

// ONEOF: maxMessageTermination, textMentionTermination, orTermination
MaxMessageTermination *MaxMessageTermination `json:"maxMessageTermination,omitempty"`
TextMentionTermination *TextMentionTermination `json:"textMentionTermination,omitempty"`
OrTermination *OrTermination `json:"orTermination,omitempty"`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

including OrTermination here creates a recursive datastructure. is that the intent?

// AutogenModelConfigSpec defines the desired state of AutogenModelConfig.
type AutogenModelConfigSpec struct {
Model string `json:"model"`
APIKeySecret string `json:"apiKeySecret"`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this be a ref to a secret?

ModelConfig string `json:"modelConfig"`
}

type TerminationCondition struct {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe "TerminationType" and add validation:

// +kubebuilder:validation:XValidation:message="There must one termination type set",rule="1 == (self.maxMessageTermination != null?1:0) + (self.textMentionTermination != null?1:0) + (self.orTermination != null?1:0)"


// AutogenToolSpec defines the desired state of AutogenTool.
type AutogenToolSpec struct {
Description string `json:"description,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tool is a placeholder for now; we can fill it out once we have some examples of user-created tools to support

metav1.ObjectMeta `json:"metadata,omitempty"`

Spec AutogenToolSpec `json:"spec,omitempty"`
Status AutogenToolStatus `json:"status,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What would a tool status contain? (Which agents are using it?)

Name string `json:"name,omitempty"`
Description string `json:"description,omitempty"`
SystemMessage string `json:"systemMessage,omitempty"`
Tools []string `json:"tools,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would match the built-in tools name? (ie. k8s.apply_manifest, istio.generate_resource, etc.)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes or it could also refer to the name of a user-provided tool (defined as a crd)

Copy link
Contributor

@EItanya EItanya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason we're not starting our controllers off with krt? It will handle a lot of the boiler plate in terms of finding the dependents etc @yuval-k


type SelectorTeamConfig struct {
SelectorPrompt string `json:"selectorPrompt"`
ModelConfig string `json:"modelConfig"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a reference to a ModelSpec? I think this may be overcomplicated for the first go. Agreed that eventually it might be nice to have this defined in one spot, but in 99% of cases defining it inline here is probably easier for the user. What do you think?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, will this be the model config used for the whole run, or just for the selector itself?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

its a reference to model config
i dont see why users would want to redefine this in every single team cr when the config will be the same when they are using a single llm / api key

ModelConfig string `json:"modelConfig"`
}

// +kubebuilder:validation:XValidation:message="There must one termination type set",rule="1 == (self.maxMessageTermination != null?1:0) + (self.textMentionTermination != null?1:0) + (self.orTermination != null?1:0)"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this API may be a tad overcomplicated, we don't need to fix it now but it may be worth simplifying it in the future. Realistically we can just list the termination conditions, and then have a join_condition or something like that which defaults to or, but can set to and.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's modeled directly off of autogen. we can always change in the future but i think to keep it simple not overthink / redefine their api with new abstractions

@yuval-k
Copy link
Collaborator

yuval-k commented Feb 10, 2025

Any reason we're not starting our controllers off with krt? It will handle a lot of the boiler plate in terms of finding the dependents etc @yuval-k

How many dependencies are we talking about?
My understanding is that we have very few, so my hunch is to stay the course and use controller-runtime.

@ilackarms ilackarms merged commit 7121300 into main Feb 11, 2025
@EItanya EItanya deleted the kube-controller branch March 17, 2025 17:01
mukundkumarjha pushed a commit to mukundkumarjha/kagent that referenced this pull request May 6, 2025
lets-call-n-walk pushed a commit to lets-call-n-walk/kagent that referenced this pull request Nov 5, 2025
Implements all 16 review comments from inFocus7's code review to improve
code quality, test consistency, and validation reliability for the TLS
configuration feature.

Changes:

1. Fix CEL validation syntax (comment kagent-dev#16 - CRITICAL)
   - Replace != "" with size(field) > 0 for non-empty checks
   - Replace == "" with size(field) == 0 for empty checks
   - Fixes validation syntax errors that blocked CRD deployment

2. Remove task tracking comments (comments #1, kagent-dev#13, kagent-dev#14, kagent-dev#15)
   - Remove "(Task X.Y)" references from test docstrings
   - Remove obsolete implementation notes about env vars vs agent config
   - Remove test_openai_client_tls_parameters_override_environment (obsolete)

3. Fix copyright headers (comment #3)
   - Replace incorrect "Google LLC" copyright with Kagent project copyright
   - Apply consistent headers across test_ssl.py, test_tls_e2e.py, test_tls_integration.py

4. Migrate Go tests to testify (comments kagent-dev#5, kagent-dev#6)
   - Add testify/assert and testify/require imports
   - Replace manual error checks with testify assertions
   - Add envVarToMapHelper() for O(n) environment variable validation

5. Add golden tests for TLS scenarios (comment kagent-dev#12)
   - Create tls-with-custom-ca.yaml input
   - Create tls-with-disabled-verify.yaml input
   - Create tls-with-system-cas-disabled.yaml input
   - Generate golden outputs to catch TLS mounting regressions

6. Improve Python test quality (comments #2, kagent-dev#4, kagent-dev#9)
   - Remove redundant test case from test_ssl.py
   - Add test_e2e_openai_client_fails_without_custom_ca (negative test)
   - Simplify E2E_TEST_SUMMARY.md (72% reduction, remove task references)

7. Use OpenAI SDK's DefaultAsyncHttpxClient (comments kagent-dev#7, kagent-dev#8)
   - Replace custom httpx.AsyncClient with DefaultAsyncHttpxClient
   - Preserves OpenAI SDK defaults for timeout, pooling, and redirects
   - Add tests to verify SDK defaults are maintained

8. Fix documentation links (comment kagent-dev#10)
   - Update broken troubleshooting links to https://kagent.dev/docs

9. Document future enhancement (comment kagent-dev#11)
   - Created GitHub issue kagent-dev#1091 for automatic agent redeployment on secret changes

Test results:
- All Go tests pass (11 golden tests including 3 new TLS scenarios)
- All Python tests pass (15 tests including 2 new tests)
- CRD validation working correctly with proper error messages

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

Co-Authored-By: Claude <noreply@anthropic.com>
lets-call-n-walk pushed a commit to lets-call-n-walk/kagent that referenced this pull request Nov 5, 2025
Implements all 16 review comments from inFocus7's code review to improve
code quality, test consistency, and validation reliability for the TLS
configuration feature.

Changes:

1. Fix CEL validation syntax (comment kagent-dev#16 - CRITICAL)
   - Replace != "" with size(field) > 0 for non-empty checks
   - Replace == "" with size(field) == 0 for empty checks
   - Fixes validation syntax errors that blocked CRD deployment

2. Remove task tracking comments (comments #1, kagent-dev#13, kagent-dev#14, kagent-dev#15)
   - Remove "(Task X.Y)" references from test docstrings
   - Remove obsolete implementation notes about env vars vs agent config
   - Remove test_openai_client_tls_parameters_override_environment (obsolete)

3. Fix copyright headers (comment #3)
   - Replace incorrect "Google LLC" copyright with Kagent project copyright
   - Apply consistent headers across test_ssl.py, test_tls_e2e.py, test_tls_integration.py

4. Migrate Go tests to testify (comments kagent-dev#5, kagent-dev#6)
   - Add testify/assert and testify/require imports
   - Replace manual error checks with testify assertions
   - Add envVarToMapHelper() for O(n) environment variable validation

5. Add golden tests for TLS scenarios (comment kagent-dev#12)
   - Create tls-with-custom-ca.yaml input
   - Create tls-with-disabled-verify.yaml input
   - Create tls-with-system-cas-disabled.yaml input
   - Generate golden outputs to catch TLS mounting regressions

6. Improve Python test quality (comments #2, kagent-dev#4, kagent-dev#9)
   - Remove redundant test case from test_ssl.py
   - Add test_e2e_openai_client_fails_without_custom_ca (negative test)
   - Simplify E2E_TEST_SUMMARY.md (72% reduction, remove task references)

7. Use OpenAI SDK's DefaultAsyncHttpxClient (comments kagent-dev#7, kagent-dev#8)
   - Replace custom httpx.AsyncClient with DefaultAsyncHttpxClient
   - Preserves OpenAI SDK defaults for timeout, pooling, and redirects
   - Add tests to verify SDK defaults are maintained

8. Fix documentation links (comment kagent-dev#10)
   - Update broken troubleshooting links to https://kagent.dev/docs

9. Document future enhancement (comment kagent-dev#11)
   - Created GitHub issue kagent-dev#1091 for automatic agent redeployment on secret changes

Test results:
- All Go tests pass (11 golden tests including 3 new TLS scenarios)
- All Python tests pass (15 tests including 2 new tests)
- CRD validation working correctly with proper error messages
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.

5 participants