Repository navigation
Description
Summary
kagent runs "bring your own" agents (Agent with type: BYO) as long as the image serves A2A the way kagent expects. That expectation isn't written down anywhere we could find — we reverse-engineered it from kagent 0.9.x while building a Kubernetes control plane that runs kagent-routed, sandboxed and BYO agents behind one gateway.
Two asks: document the contract, and forward a session identifier to the model.
1. The BYO contract, as we found it
These are the requirements our harnesses had to satisfy before kagent would route to them. We'd be glad to see them in kagent's docs in any form; the numbering is only for reference here.
Discovery
GET /.well-known/agent-card.jsonreturns200with a JSON object.- The card carries
name,description,version, andskills(an array, possibly empty). - The card advertises the address clients should invoke — a top-level
url(A2A v0.3) orsupportedInterfaces[].url(A2A v1.0). When something fronts the agent, this must be the externally reachable address, not the pod's. This is the requirement that cost us the most time: a card advertising its own in-cluster address is silently unroutable from outside, and nothing reports an error. - The card should carry
protocolVersionanddefaultInputModes/defaultOutputModes.
Invocation
5. POST / with a JSON-RPC 2.0 message/send returns a JSON-RPC 2.0 response whose id echoes the request's, carrying result (not error) on success.
6. The result is an A2A Message ("kind": "message", "role": "agent", at least one text part) or an A2A Task ("kind": "task") whose artifacts or history carry the agent's text.
7. An unknown method returns JSON-RPC error -32601.
8. A malformed request returns -32700.
Requirements 1–3 and 5–6 are the ones that actually gate interoperability; 4, 7 and 8 are quality-of-implementation.
2. Standardize how a BYO agent is configured
Today each platform invents its own environment for a BYO image. If kagent documented (or adopted) a small set of variables — model base URL, model name, system message, public URL, and per-tool URL/credential — one image could run under kagent and under any other platform that speaks the same contract, with no image changes. We're not attached to our names; we care that there is one set.
3. Forward a session identifier to the model
A Declarative agent's model calls currently carry no session identity. Anything metering model spend therefore cannot attribute cost per conversation for kagent-routed agents — only per agent. A single header forwarded from the A2A request to the model call (x-session-id, or whatever name kagent prefers) would close that gap.
This is the one we'd most like, and we're happy to implement it if you point us at the preferred place in the model client.
Evidence
We run an end-to-end suite on kind against kagent 0.9.12. A Declarative kagent agent, a Go BYO harness and a Python BYO harness all satisfy every requirement above, through a gateway that rewrites discovery. We verify each requirement with an executable checker rather than by inspection, so the list above is machine-checked, not aspirational.
Happy to share the checker, the harnesses, or a reproduction in whatever form is useful — say the word and we'll paste it here.
Questions for maintainers
- Would you accept a written BYO contract in kagent's docs? We'll open the PR if the shape above is close.
- Is there appetite for (3)? It's small, and it unblocks per-session cost attribution for every platform building on kagent.
- Is requirement 3 (the externally-reachable
url) intentional and stable? We depend on it; it would be good to know it's a contract rather than an accident.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsBacklog
Activity
ishangupta-ds commentedon Sep 22, 2026
A follow-up with new information, after reading the
v1.0.0-alpha1CRDs.The new
Harnesskind makes this proposal more concrete than when I filed it. Itsbyoruntime is described in the CRD as:That is the contract this issue asks to document, and
Harness.byonow looks like its natural home. The eight requirements in the issue body are still the draft I'd offer for that text; a Go BYO harness and a Python one both satisfy them today through 0.9.x, and I'd expect them to against v1 unchanged if the contract is what we reverse-engineered.Mapping our current
Agent(0.9/0.10,v1alpha2) rendering ontoAgentTemplate+Harness(v1alpha3), everything has an obvious home except two things, which I think are worth raising while the shape is still alpha:Per-template configuration for a BYO harness.
Harness.spec.envis per runtime, shared by every template the harness serves. A BYO image that needs to know which agent it is — its public URL for the card'surl, a system message, tool endpoints or credentials — has nowhere per-template to learn it.AgentTemplatehassystemPromptandtoolsfor the kagent runtime, but nothing a BYO image can read. Either anAgentTemplate.spec.env, or a documented convention for how a BYO runtime discovers its template at request time, would close this.Where
replicaswent.Agent.spec.declarative.deployment.replicas/byo.deployment.replicashave no counterpart; capacity seems to live entirely insubstrate.workerPoolRefnow. If sizing is intentionally a pool property rather than a per-agent one, saying so explicitly would save platforms that size per agent from looking for it.Item 3 from the original issue (forwarding a session identifier to the model) still applies — nothing in
v1alpha3addresses it as far as I can see.Two things I noticed and don't need anything for, just flagging that they overlap with what a platform on top of kagent would otherwise build:
isolateSessions(#2504) andtools[].mcp.requireApproval. Glad to see both.ishangupta-ds commentedon Sep 24, 2026
Follow-up after running 1.0.0-alpha2 end to end (Substrate 0.2.0-beta5 on kind, a platform operator rendering
AgentTemplate+Harness{kagent}and drivingAgentInstanceService+ A2A gRPC from outside). Everything below is from the running system, not the CRDs. Sharing in case any of it is useful as you shape 1.0:The BYO contract, as compiled. For
Harness.byothe ActorTemplate ends up as: digest-pinned image, explicitworkload.command, A2A gRPC on port 80, readiness HTTP/readyzon 8081, env =spec.env+KAGENT_CONFIG_JSON+KAGENT_AGENT_CARD_JSON+ trust-bundle vars (≤32 vars), credentials never in env (egress injection by hostname). Would you consider documenting exactly this on the CRD instead of "private"? It is what anyone bringing a harness has to hit. Related: is an HTTP JSON-RPC binding for BYO harnesses on the table, or is gRPC-only the intended 1.0 contract?Per-template env.
Harness.spec.envis per harness,KAGENT_CONFIG_JSONis per pair. A harness admitting many templates has no way to give one template one extra env var (say a tenant-specific base URL). Is aspec.env-shaped field onAgentTemplatesomething you would take?Credential injection over plain
http://works — confirmed with an in-cluster OpenAI-compatible proxy on:4000with no TLS: the ModelConfig key was added by the egress gateway and the proxy saw it. Worth a line in the docs, since people will assume injection needs TLS.WorkerPool per template namespace.
substrate.workerPoolRefresolves in theAgentTemplate's namespace:WorkerPool "<ns>/kagent-default" not foundwhen the pool lives inkagent/. Every namespace that hosts templates needs its own pool (and credential-provider policy). Intentional as a tenancy boundary? If so aworkerPoolRef.namespaceor a documented "one pool per namespace" would save people the hunt.replicas→ WorkerPool sizing. With no per-agent Deployment, the olddeployment.replicashas no home; the closest isWorkerPool.spec.replicas. Fine by us, but worth a migration note for 0.10 users.Declarative / idempotent
AgentInstancecreation.CreateAgentInstanceis idempotent onrequest_id, which is enough for a controller, but instances are only reachable through gRPC and are creator-scoped byx-user-id. A platform that brokers instances on behalf of many users has to pick one principal for all of them. Is anAgentInstanceCRD (or a service-principal concept) planned?Two things that cost us a day each, in case they are worth a doc line: forwarding the client's
context_idinSendMessageis rejected (message context does not match AgentInstance) — the instance owns the context; and unarySendMessagereturns asubmittedTask with no output (also afterGetTask), so a client has to useSendStreamingMessageand fold the artifact events. Also: the Go ADK requestsstream: truefrom the model, and an OpenAI-compatible backend that ignores it produces an empty reply through some proxies (LiteLLM fake-streams one empty delta).ishangupta-ds commentedon Nov 24, 2026
Still relevant, and I'd like to keep it open. Here's an update now that 1.0 has shipped. We've run kagent 1.0.0 with Substrate 1.0.0 since GA as the runtime under a platform operator. That operator renders
Harness+AgentTemplate+Agentunderapi.kagent.dev/v1alpha3and opens oneSessionper conversation overSessionService. A byo harness on it takes its config throughKAGENT_BOOTSTRAP_JSON/config.MaterializeFromBootstrap.What 1.0 already answered, so I'm dropping these:
replicaswent. Capacity belongs to the WorkerPool now. Clear enough from the design.What's still open:
Document the byo contract. In v1.0.1,
BYOHarnessis still described as implementing "kagent's private A2A contract". From running it, this is what a byo image has to satisfy:workload.imagewith an explicitworkload.command/readyz:8081KAGENT_BOOTSTRAP_JSON(fetch the bundle, verify its sha256)A2A-Version: 1.0on calls (a2a-go 2.7 treats a missing header as 0.3)Is
go/adk/examples/byomeant to be the reference for that? If so, I'd open a docs PR that writes the list above next to it. (The eight JSON-RPC requirements in the original issue describe 0.9.x. Treat them as superseded for 1.0.)A session identifier on model calls. Still not there as far as I can see. We work around it: a per-session model key sent as the A2A bearer, with
tokenPassthrough. But that only works when every caller goes through a gateway that mints keys. A forwarded header such asx-kagent-session-idon the model request would let anything metering model spend attribute cost per session directly. I'm happy to implement it if you point me at the model client you'd want it in.A question, not a request: is the byo/AgentTemplate tool rule (
self.kind == 'RemoteMCPServer') and the@sha256-only image pattern meant to stay for 1.x? We route harnesses that need other tool kinds or tag-pinned images elsewhere. Knowing whether that's permanent would settle how we plan around it.If it helps, I'd also be glad to retitle this to "Document the 1.0 byo harness contract, and forward a session id to the model".