AgentTool CRD lets you expose any HTTP API as a callable tool for your AI agents. Each AgentTool is backed by an OpenAPI specification — the operator stores this schema and makes it available to agents so their underlying LLM framework knows exactly which operations are available, what parameters each operation accepts, and what responses to expect. You can target external URLs or internal Kubernetes services, and you can share a single AgentTool across many agents in different namespaces.
API reference
Basic structure
description field is critical — the LLM reads it to decide when and whether to invoke the tool. Write it as a clear, one-sentence summary of what the API does.
OpenAPI schema sources
The OpenAPI schema is required for everyAgentTool. It tells the LLM what operations are available and what shape the request and response payloads take. You can supply the schema in three ways:
- endpointPath
- value (inline)
- valueFrom (ConfigMap)
The simplest option: the operator fetches the schema directly from a path on the target service. Use this when your service already serves its own OpenAPI spec.
Target configuration
- External URL
- Internal Kubernetes service
Point the tool at any publicly reachable or VPN-accessible HTTP endpoint. You can attach custom headers and a timeout:
Using tools in agents
You can attach tools to anAgent either by referencing an existing AgentTool CR or by defining the tool inline in the Agent spec.
Referencing an AgentTool CR (recommended):
Inline tool definitions cannot be reused across multiple agents. Extract frequently used tools into standalone
AgentTool CRs and share them by reference.Status fields
The operator validates and stores each tool’s OpenAPI spec. The resulting status looks like:| Field | Description |
|---|---|
conditions[Validated] | Whether the OpenAPI spec passed schema validation |
conditions[Stored] | Whether the spec was successfully written to a ConfigMap |
observedGeneration | The last spec generation reconciled by the operator |
Security
API credentials via secrets
Never embed API keys or bearer tokens as plain strings in tool headers. Instead, inject them as environment variables in the agent container and reference them at runtime:Network policies
Use aNetworkPolicy to restrict which services your agents may reach through their tools:
Troubleshooting
Tool is not appearing as callable in the agent
Tool is not appearing as callable in the agent
- Confirm the
ValidatedandStoredconditions are bothTrue. - Check that
toolRef.nameandtoolRef.namespacematch the actualAgentToolmetadata exactly. - Ensure the OpenAPI spec contains at least one operation (
pathsentry).
Timeout errors when the tool is called
Timeout errors when the tool is called
OpenAPI schema validation failures
OpenAPI schema validation failures
- For
endpointPath: verify the path returns a valid JSON or YAML OpenAPI document. - For
valueFrom: confirm the ConfigMap exists in the same namespace and the key contains valid YAML or JSON. - For
value: check that the inline object is well-formed YAML with no tab characters. - Use an online validator (e.g.,
editor.swagger.io) to confirm spec correctness before applying.
Service resolution failures for internal services
Service resolution failures for internal services
- Ensure
serviceRef.namespacematches the namespace where the Service lives. - Confirm
serviceRef.portmatches a port defined on the Service spec. - Check that NetworkPolicies in the target namespace allow ingress from the agent pod.
Best practices
- Write a precise
description— the LLM relies entirely on this text to decide when to call the tool, so be specific about what the API does and what inputs it expects. - Prefer
endpointPathwhen your service serves its own OpenAPI spec — it keeps theAgentToolmanifest minimal and the spec always up to date. - Use
valueFromfor large or shared specs — storing the spec in a ConfigMap allows it to be managed independently and rolled back separately. - Use
serviceReffor in-cluster targets — it avoids external DNS round-trips and integrates naturally with Kubernetes NetworkPolicies. - Set conservative timeouts — a stuck tool call blocks the entire agent turn; use
timeoutSecondsthat match the API’s p99 latency plus a buffer. - Share tools via a dedicated namespace — create reusable
AgentToolCRs inshared-toolsand reference them withtoolRef.namespacerather than duplicating definitions. - Store API credentials in Secrets — inject them into the agent container environment rather than hard-coding them in tool headers.
- Test tools in isolation before attaching them to agents — verify the target endpoint is reachable and returns a valid OpenAPI spec independently.
- Version your tool manifests alongside application code so schema changes are auditable.
