Skip to content

feat(k8s): add k8s_wait_for_condition tool#58

Open
mesutoezdil wants to merge 1 commit intokagent-dev:mainfrom
mesutoezdil:feat/k8s-wait-for-condition
Open

feat(k8s): add k8s_wait_for_condition tool#58
mesutoezdil wants to merge 1 commit intokagent-dev:mainfrom
mesutoezdil:feat/k8s-wait-for-condition

Conversation

@mesutoezdil
Copy link
Copy Markdown

@mesutoezdil mesutoezdil commented May 7, 2026

Adds a new MCP tool k8s_wait_for_condition that wraps kubectl wait and blocks until a Kubernetes resource reaches a specified condition or the timeout expires.

Agents that deploy resources currently have to poll with repeated kubectl get calls in a loop. Each iteration is a full LLM turn, wasting tokens and adding latency.

With this tool, a single blocking call replaces the loop:

Before:

[turn 1] kgp -n default   -> Pending
[turn 2] kgp -n default   -> Pending
[turn 3] kgp -n default   -> Running

After:

[turn 1] k8s_wait_for_condition deployment/myapp condition=Available -> condition met
Parameter Required Default Description
resource_type yes deployment, pod, job, etc.
resource_name yes Name of the resource
condition yes Available, Ready, Complete, etc.
namespace no default Namespace of the resource
timeout_seconds no 60 Max wait time in seconds

Seven unit tests cover: success path, custom namespace and timeout, missing required parameters, zero timeout rejection, and kubectl timeout propagation.

Closes #56

@mesutoezdil mesutoezdil force-pushed the feat/k8s-wait-for-condition branch 4 times, most recently from b8a975c to 33efb25 Compare May 7, 2026 21:37
Wraps kubectl wait so agents can block on a resource condition in one
call instead of polling with repeated kubectl get turns.

Closes kagent-dev#56

Co-authored-by: alexis-brettes <133014848+alexis-brettes@users.noreply.github.com>
Signed-off-by: mesutoezdil <mesudozdil@gmail.com>
@mesutoezdil mesutoezdil force-pushed the feat/k8s-wait-for-condition branch from 33efb25 to d157f4f Compare May 7, 2026 21:41
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.

[FEATURE] Built-in tool to wait for Kubernetes resource conditions

1 participant