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.
On this page6 sections
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.
- ConfirmOrganization and context.
- DiscoverProjects, environments, components.
- Gate: Your confirmationActCreate, update or deploy.
- VerifyRun status and logs.
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
- The skill explains Kapten’s objects (organization, project, environment, component, pipeline) and how to work with them.
- The
kaptenserver exposes the Platform API’s operations as tools, each named by its operation ID:listEnvironments,createEnvironmentVariable,runPipelineand so on. - The
kapten-docsserver lets the agent search and read the docs withsearch_docs,get_pageandlist_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 Forbiddenwhen 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.
| Something fails during | What stops | What stays | Where to look |
|---|---|---|---|
| A tool call | That call | Nothing changed | The error returned |
| A deployment | The run | Instances that were ready | Run timeline and logs |
| A pipeline stageWith STOP_PIPELINE | The next stages | Running versions | Pipeline run |
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.
- 10:02Context confirmedOrganization acme, context agent.
- 10:02Target found, Livestorefront · staging · api on 1.4.2.
- 10:03Image updated, QueuedupdateApplication, confirmed by you.
- 10:03Deployment started, In progressdeployApplication, confirmed by you.
- 10:05Run failed, FailedReadiness check timed out on /healthz.
- 10:06Logs readqueryApplicationRunLogs: missing DATABASE_URL.
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
- Read Guardrails for agents that touch production before giving an agent write access to production.
- Connect Kapten to your assistant if you have not yet.
- See how Kapten works and pipelines in the docs.
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.