Kapten
All guides

Agents & MCP

Working with a coding agent on Kapten

How a coding agent uses the Kapten skill, the kapten MCP tools and the docs server, what a request turns into, and how to read runs when something fails.

Cover illustration for Working with a coding agent on Kapten, intermediate levelAgents & MCPIntermediate · 855a
On this page6 sections
  1. 01From prompt to tool calls
  2. 02Three sources the agent draws on
  3. 03When a step fails
  4. 04Reading runs
  5. 05Writing better requests
  6. 06Where to go next

From prompt to tool calls

When your coding agent is connected to Kapten, a request in plain language becomes a sequence of tool calls you can watch, and confirm, one by one. Take a typical request:

Deploy the api from ghcr.io/acme/api:1.5.0 to staging in storefront,
then check that it came up.
  1. Confirm
    Organization and context.
  2. Discover
    Projects, environments, components.
  3. Act
    Create, update or deploy.
    Gate: Your confirmation
  4. Verify
    Run status and logs.
Figure 1. The loop the Kapten skill teaches: confirm where you are, look before you change, change, then check the result.

1. Confirm the organization

The kapten skill teaches the agent to check where it is before changing anything. The MCP server runs with one context, fixed when it starts, so the organization is known; a careful agent still states it before its first change.

2. Discover

Nothing can be deployed to an environment that has not been found yet. The agent reads before it writes: listProjects, then listEnvironments for storefront, then listEnvironmentComponents for staging to find the api application and its current image.

3. Act

With the target in hand, the agent makes the change: updateApplication to point api at the new tag, then deployApplication. These calls change something, so your client shows each one with its arguments and waits for you.

4. Verify

A deployment is a run. The agent reads it back with listApplicationRuns and getApplicationRun, and queryApplicationRunLogs if the run did not succeed, then tells you what happened, with the evidence.

Three sources the agent draws on

kapten skill, kapten MCP, kapten-docs MCP feed into Your agent, which produces Reads, Changes, Answer.
kapten skillResource model, habits
kapten MCPPlatform operations
kapten-docs MCPsearch_docs, get_page
Your agentPlans the callstool calls
ReadsRun on their own
ChangesWait for you
AnswerWith the evidence
Figure 2. The agent combines what the skill taught it, what the platform says and what the docs say into one answer.
  • The skill explains Kapten’s objects (organization, project, environment, component, pipeline) and how to work with them.
  • The kapten server exposes the Platform API’s operations as tools, each named by its operation ID: listEnvironments, createEnvironmentVariable, runPipeline and so on.
  • The kapten-docs server lets the agent search and read the docs with search_docs, get_page and list_pages, so how-to questions are answered from the documentation rather than from memory.

A good request often uses all three: “using the docs, build a pipeline that runs the migrate job before the api and worker” sends the agent to search_docs first, then to createPipeline and createPipelineStage.

When a step fails

Failures are expected. What matters is that they stop cleanly and leave a record.

  • A tool call fails. The API returns an error, such as 403 Forbidden when the agent’s roles do not allow the operation. The agent should report it, not look for another way around it.
  • A deployment fails. The run is marked failed, with the step that failed in its timeline and the reason in its logs. A readiness check that never passes keeps the new instances from receiving traffic.
  • A pipeline stage fails. With Stop the pipeline (STOP_PIPELINE), the stages after it are skipped and the running versions stay in place. With Continue with the next step (CONTINUE_PIPELINE), the pipeline goes on and is reported as failed at the end.
Failing closed
Something fails duringWhat stopsWhat staysWhere to look
A tool callThat callNothing changedThe error returned
A deploymentThe runInstances that were readyRun timeline and logs
A pipeline stageWith STOP_PIPELINEThe next stagesRunning versionsPipeline run
Figure 3. Each failure stops at a known point and leaves a record the agent, or you, can read.

Reading runs

Every deployment of a component is a run, and every pipeline start is a pipeline run. Together they are the record of what was deployed, when, and why it failed:

  • Status, with the start and end time.
  • Timeline, the steps of the run, such as the build and the deployment.
  • Logs, for the build and the running containers.
  • Pipeline runs, with the status of each stage and each component, and a message explaining any failure.
  1. 10:02
    Context confirmed
    Organization acme, context agent.
  2. 10:02
    Target found, Live
    storefront · staging · api on 1.4.2.
  3. 10:03
    Image updated, Queued
    updateApplication, confirmed by you.
  4. 10:03
    Deployment started, In progress
    deployApplication, confirmed by you.
  5. 10:05
    Run failed, Failed
    Readiness check timed out on /healthz.
  6. 10:06
    Logs read
    queryApplicationRunLogs: missing DATABASE_URL.
Figure 4. A sample session for the request above, read top to bottom.Illustrative · sample data

When something surprises you, start with the run: its timeline tells you which step failed, and its logs tell you why. The organization’s activity log tells you who changed what, and when.

Writing better requests

Your agent does its best work with a clear brief:

  • Name the project and environment. “storefront staging” is better than “somewhere to test”.
  • State the constraints. Which image or branch, which components, what must stay untouched.
  • Say what you want back. A summary, a list of findings, a change made and verified.
  • Say what not to do. “Don’t change anything” is a perfectly good instruction for an investigation.

Where to go next

Build with Kapten

Start with one service.
Build from there.

Tell us what you want to deploy. We review each request and follow up about fit and onboarding on your preferred cloud.

Free during early access. No card required. Cloud usage billed separately.