Collaborative Workflows
Agents are more useful when they can actually run and test code, not just suggest edits. In collaborative mode, you stay in control of the development session while the agent executes commands, runs tests, and debugs issues inside your live Okteto environment.
You manage the dev session with okteto up. The agent runs commands in the active dev container using okteto exec. Code changes sync automatically, so when the agent edits a file, it's running in the container within seconds. No rebuilds between iterations.
How it works
- The agent runs
okteto deploy --waitto set up the environment (or you do this yourself) - You run
okteto up <service>in your terminal to start the dev session - The agent uses
okteto exec -- <command>to run commands in the dev container - Code changes sync to the container automatically via file sync
- The agent checks results with
okteto logsandokteto test - You iterate together until the task is complete
okteto up is an interactive command that requires a human terminal. The agent must never run it, as it will hang indefinitely. In collaborative mode, you always start the dev session yourself.
Workflow example: fixing a bug
You start the dev environment:
okteto up api
You ask the agent:
The /api/orders endpoint returns a 500 error when the cart is empty.
Can you investigate and fix it?
The agent investigates:
# Check recent logs for the error
okteto logs api --since 10m
# Run the failing test to reproduce
okteto exec -- npm test -- --grep "empty cart"
# After reading the code and making a fix...
# Run the tests again to verify
okteto exec -- npm test
Since file sync is active, the agent's code changes are immediately available in the running container. No rebuild needed.
CLI commands for agents
These commands are safe for agents to use in collaborative mode:
| Command | Purpose |
|---|---|
okteto deploy --wait | Deploy all services in the environment |
okteto exec -- <command> | Run a command in the active dev container |
okteto logs <service> | View container logs |
okteto logs <service> --since 5m | View recent logs |
okteto test <name> | Run a test container defined in okteto.yaml |
okteto endpoints | List public URLs for the environment |
okteto down | Stop dev mode and restore the original deployment |
For full flag details on any command, see the CLI Reference.
Commands agents must not run
| Command | Why |
|---|---|
okteto up | Interactive. Requires a human terminal and will hang if run by an agent. |
okteto destroy | Tears down the entire environment. Should only be run by the developer or with explicit policy. |
File sync
When okteto up is running, Okteto syncs file changes between your local machine and the dev container. The agent edits files locally, changes appear in the container within seconds, and the running application picks them up immediately (assuming hot-reload or similar). There's no need to run okteto build or okteto deploy for code changes during development.
The agent makes a change, runs a test with okteto exec, sees the result, and iterates. No waiting on builds.
When to use collaborative mode
- You want to stay in control of the development session
- You're pair-programming with the agent on a feature or bug fix
- You need the fast feedback loop of file sync and hot-reload
- You want to review changes as they happen, not after the fact
- The task requires judgment calls that the agent should check with you
For tasks where the agent can handle the full lifecycle without human input, see Autonomous Workflows.