Kernel MCP services
Konstera agents reach back to the platform through
kernel MCP services. Instead of integrating LLM
provider SDKs, vector databases, or secrets stores yourself, your
agent calls ctx.llm, ctx.vector, ctx.credentials, and the kernel does the right thing
— including cost metering, tenant scoping, and audit.
Ten services today. Each one is a scoped capability the agent
declares in its manifest's needs array. The
kernel enforces that an agent can only use what it declared.
The services at a glance#
| Service | You call | The kernel handles for you |
|---|---|---|
llm | ctx.llm | Routing, fallback chains, cost metering, prompt caching, model substitution — no provider SDKs in your code |
vector | ctx.vector | Embedding storage + similarity search; pgvector per tenant by default, or your own vector DB as a connector |
state | ctx.state | Durable per-agent, per-tenant key-value that survives restarts |
credentials | ctx.credentials | Secrets encrypted at rest, per-tenant — never in your agent container |
cost | ctx.cost (read-only) | Attributes every LLM call to tenant / agent / model / user automatically |
log | ctx.log | Structured JSON into the audit trail and reviewer inbox context, searchable per invocation |
tool | ctx.tool | Connector-provided actions, scoped per agent by the connector framework (ADR-009) |
agents | ctx.agents | Invokes another agent as a child workflow with its own audit trail |
human | ctx.human | Pauses the workflow, shows the draft in the HITL inbox, resumes on approval |
prompt | ctx.prompt | Versioned, A/B-testable prompts, editable without a redeploy |
llm — model inference#
Call any configured LLM through a unified interface. No provider SDKs in your agent code. Routing, fallback chains, cost metering, prompt caching, and model substitution happen in the kernel.
# Python
reply = await ctx.llm.complete(
system="You are a cheerful retail assistant.",
user="Draft a return approval for order #12345",
model="claude-sonnet-4",
)
// .NET
var reply = await ctx.Llm.CompleteAsync(
system: "You are a cheerful retail assistant.",
user: "Draft a return approval for order #12345",
model: "claude-sonnet-4" // optional; falls back to tenant default
);
vector — RAG / embeddings#
Store and query embeddings. Default backend is pgvector per tenant; bring your own vector DB (Pinecone, Weaviate, Qdrant) as a connector.
// Index documents
await ctx.Vector.UpsertAsync("product-catalog", items);
// Query by similarity
var hits = await ctx.Vector.SearchAsync("product-catalog", query, topK: 5);
state — durable key-value per agent#
Per-agent, per-tenant state. Survives restarts. Scoped so one agent cannot read another agent's state. Use for memoisation, counters, long-running cursor positions.
await ctx.State.SetAsync("last-processed-batch", batchId);
var lastBatch = await ctx.State.GetAsync<string>("last-processed-batch");
credentials — tenant secrets#
Fetch secrets your agent needs — API keys, OAuth tokens, database connection strings. Secrets live in the credentials MCP service (encrypted at rest, per-tenant), never in your agent container.
var stripeKey = await ctx.Credentials.GetAsync("stripe-api-key");
cost — metering (implicit)#
You don't call this directly — the kernel attributes every LLM call to tenant / agent / model / user automatically. Your agent can read its own cost ledger for self-governance:
var monthly = await ctx.Cost.GetMonthToDateAsync();
if (monthly.TokensIn > budgetLimit) {
return new Result { Status = "deferred", Reason = "monthly budget cap" };
}
log — structured logging#
Agent-side logging that lands in the platform's audit trail and reviewer inbox context. Structured JSON, searchable per invocation.
await ctx.Log.InfoAsync("Classified invoice", new {
invoiceId = input.Id,
category = result.Category,
confidence = result.Confidence,
});
tool — connector-provided actions#
Tools are agent-facing operations exposed by connectors — "send an email via Klaviyo", "create a PO in NetSuite", "update a Shopify order". The connector framework (ADR-009) scopes which tools which agent can call.
await ctx.Tool.InvokeAsync("klaviyo.send-campaign", new {
segment = "VIP-returns",
templateId = "return-ack-v3",
});
agents — call other agents#
Multi-agent coordination. One agent invokes another through the kernel; the call becomes a child workflow with its own audit trail. Explicit, not implicit — no "autonomous agent swarms".
var forecast = await ctx.Agents.InvokeAsync("demand-forecaster", new {
sku = input.Sku,
horizonDays = 30,
});
human — request a reviewer#
Pause the workflow and request human review. The reviewer sees the draft in the HITL inbox with full context (thread, prior turns, agent rationale). On approval the workflow resumes.
var decision = await ctx.Human.RequestAsync(new ReviewerRequest {
Draft = reply.Text,
Rationale = "Customer loyalty tier: Gold. Second return this month.",
Thread = ctx.Thread,
Actions = new[] { "send", "edit", "redraft", "reject" },
});
prompt — centrally-managed prompts#
Prompts live in the platform (versioned, A/B-testable, editable without a redeploy). Your agent references them by ID.
var systemPrompt = await ctx.Prompt.GetAsync("cs-triage.system.v3");
var reply = await ctx.Llm.CompleteAsync(systemPrompt, userInput);
capability (ADR-013)#
Alongside the ten services, ctx also exposes capability — canonical,
vendor-neutral operations such as orders.lookup_by_id that the operator binds
to a connection at install time. Agents must not import vendor SDKs (shopify,
stripe, …); call ctx.capability.call(...) instead, so vendor-specific logic
lives in the connector, not the agent.
Browse the full set in the capability catalogue — every canonical name an agent can call, with its request + response schema.
Capabilities are declared in the manifest's
capabilities.needs[]:
| Declared as | Install | In your code |
|---|---|---|
"required": true | Fails if the operator hasn't bound it | ctx.capability.call() is guaranteed to succeed — no guard needed |
"required": false (default) | Succeeds either way | Guard with await ctx.capability.available(name) first — otherwise CapabilityUnbound raises |
The operator does the binding per instance, on the agent's Bindings tab — connections for capabilities, and a model for each LLM purpose:
# Optional capability — guard before calling to avoid CapabilityUnbound
customer = None
if await ctx.capability.available("customers.lookup_by_email"):
customer = await ctx.capability.call(
"customers.lookup_by_email", email=order["customer_email"]
)
# If unbound, customer stays None and the draft falls back to generic phrasing
// Optional capability — guard before calling to avoid CapabilityUnbound
let customer: { tier?: string } | null = null;
if (await ctx.capability.available("customers.lookup_by_email")) {
customer = await ctx.capability.call("customers.lookup_by_email", {
email: order.customer_email,
}) as { tier?: string } | null;
}
// If unbound, customer stays null and the draft falls back to generic phrasing
// Optional capability — guard before calling to avoid CapabilityUnbound
CustomerDetail? customer = null;
if (await ctx.Capability.AvailableAsync("customers.lookup_by_email"))
{
customer = await ctx.Capability.CallAsync<CustomerDetail>(
"customers.lookup_by_email", new { email = order.CustomerEmail });
}
// If unbound, customer stays null and the draft falls back to generic phrasing
How these show up in your manifest#
"needs": ["llm", "state", "credentials", "tool", "human", "prompt"]
An agent that doesn't list a service in needs
cannot call it at runtime — the kernel returns a permission
error. Keep needs minimal.
- List only the services your handler actually calls.
- Re-check
needswhenever you add or remove actx.*call.
- Add services "just in case" —
needsis a permission list, and over-declaring broadens the capability footprint shown in the portal (see Build with Claude Code).