Skip to content
Konstera
Docs · Build agents
Konstera documentation.

Getting started, SDK quickstart, manifest reference, kernel MCP services, deploy guide and FAQ — everything you need to build and run agents on Konstera.

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.

ArchitectureThe ten kernel services, grouped by what your agent uses them for Interactive — click a block

The services at a glance#

ServiceYou callThe kernel handles for you
llmctx.llmRouting, fallback chains, cost metering, prompt caching, model substitution — no provider SDKs in your code
vectorctx.vectorEmbedding storage + similarity search; pgvector per tenant by default, or your own vector DB as a connector
statectx.stateDurable per-agent, per-tenant key-value that survives restarts
credentialsctx.credentialsSecrets encrypted at rest, per-tenant — never in your agent container
costctx.cost (read-only)Attributes every LLM call to tenant / agent / model / user automatically
logctx.logStructured JSON into the audit trail and reviewer inbox context, searchable per invocation
toolctx.toolConnector-provided actions, scoped per agent by the connector framework (ADR-009)
agentsctx.agentsInvokes another agent as a child workflow with its own audit trail
humanctx.humanPauses the workflow, shows the draft in the HITL inbox, resumes on approval
promptctx.promptVersioned, A/B-testable prompts, editable without a redeploy
SequenceEvery call goes through the kernel — and only declared services are allowed
Your agentKernelService1ctx.llm callis llm in the manifest's needs?2scoped to tenant3result4meter cost · write audit5reply6service not in needs7permission error

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
# 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",
)

vector — RAG / embeddings#

Store and query embeddings. Default backend is pgvector per tenant; bring your own vector DB (Pinecone, Weaviate, Qdrant) as a connector.

C#
// 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.

C#
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.

C#
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:

C#
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.

C#
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.

C#
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".

C#
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.

C#
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.

C#
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 asInstallIn your code
"required": trueFails if the operator hasn't bound itctx.capability.call() is guaranteed to succeed — no guard needed
"required": false (default)Succeeds either wayGuard 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:

Agent → Bindings: which connection serves each capability and which model serves each purpose · example data
Python
# 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

How these show up in your manifest#

JSON
"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.

Do
  • List only the services your handler actually calls.
  • Re-check needs whenever you add or remove a ctx.* call.
Avoid
  • Add services "just in case" — needs is a permission list, and over-declaring broadens the capability footprint shown in the portal (see Build with Claude Code).

What next#