CI/CD Agentic Automation with yottacode: Practical run Workflows
Interactive terminal sessions are useful when a developer needs to steer the agent turn by turn. CI/CD workflows need something different: a bounded, scriptable command that can inspect a repository, analyze test output, draft engineering artifacts, and return a machine-readable result.
That is the role of yottacode run. These commands can be embedded in CI/CD pipeline jobs, scheduled cron jobs, release scripts, pull-request checks, and other engineering workflows wherever a bounded input should produce a reviewable output.
For example, a team can run a PR review when a pull request opens, summarize failed tests after a build, generate a release-readiness report on a schedule, or produce a changelog draft during a release process. Keep the agent’s role explicit: analyze evidence, produce an artifact, and preserve the underlying tool’s status rather than silently overriding it.
This article explains the most useful single-shot workflows, the command-line flags that matter in automation, and the engineering principles that keep agentic CI useful without turning a pipeline into an uncontrolled code-change system.
What is agentic CI/CD?
Agentic CI/CD means placing an AI coding agent inside a repeatable engineering job so it can inspect evidence, explain a failure, draft an artifact, or propose a next step. The pipeline remains responsible for deterministic checks and status; the agent adds context and interpretation.
yottacode run executes one prompt non-interactively with the same configured provider, tools, memory, sessions, and permissions used by the interactive workflow.
Use it when the task has a clear input and output:
- A diff becomes a pull-request summary.
- Test output becomes a triage report.
- A vulnerability scan becomes a prioritized explanation.
- Recent commits become a changelog draft.
- A repository becomes a code-review report.
Do not use it as a replacement for every interactive engineering session. If the task is ambiguous, destructive, or likely to expand in scope, start in the TUI, use Plan mode, or create an isolated worktree first.
The command shape
The basic form is:
yottacode run "<prompt>"For example:
yottacode run \
"Read the current branch diff and draft a pull request description with Summary, Testing, and Risks sections. Do not modify files." \
> /tmp/pr-description.mdIn text mode, the final answer is written to standard output. Operational progress and tool status are kept separate so the output can be redirected into a file or another command.
Use --format json for automation
When another script needs to consume the result, use structured JSON:
yottacode run --format json \
"Read test-output.txt and identify the likely root cause. Do not modify files." \
> /tmp/triage.jsonThe result contains fields such as:
{
"content": "The failure starts in...",
"tool_calls": [
{"name": "read_file", "summary": "read_file(test-output.txt)"}
],
"usage": {
"input_tokens": 1240,
"output_tokens": 380
},
"exit_reason": "ok",
"error": null,
"session_id": "..."
}The important fields for scripts are:
content— the agent’s final answer.tool_calls— bounded summaries of tools used during the turn.usage— token counters when the provider reports them.exit_reason—ok,error, oriter_cap.error— the failure message when the turn does not complete successfully.session_id— the saved session identifier.
Parse the JSON, but also preserve the process exit status. A valid JSON error object does not mean the automation succeeded.
set +e
yottacode run --format json \
"Read test-output.txt and identify the likely root cause. Do not modify files." \
> /tmp/triage.json
run_status=$?
set -e
jq -r '.content // .error' /tmp/triage.json
exit "$run_status"The flags that matter most
--format text|json
Use text for a human-readable artifact. Use json when a script, CI job, or dashboard needs stable fields.
yottacode run --format json "Summarize the current diff. Do not modify files."--json
The legacy --json flag remains available for compatibility, but it is not the same as --format json. New integrations should use --format json for a structured stdout object.
--model and --provider
Select the model or provider explicitly when the workflow must be reproducible across machines or CI runners:
yottacode run \
--provider openai \
--model <model-id> \
"Review the current diff. Do not modify files."Avoid relying on an undocumented default model in a shared pipeline.
--base-url and --api-key
These flags can configure a provider endpoint and key when that is appropriate for the environment. Prefer the project’s normal provider configuration and secret-management system rather than placing credentials in shell history or pipeline logs.
--max-iterations
Use this to bound how many tool-call iterations a turn may use:
yottacode run --max-iterations 24 \
"Inspect the failing test output and write a concise triage report. Do not modify files."A low cap reduces runaway work but may stop a complex task before it reaches a final answer. Treat iter_cap as a distinct failure state.
--worktree
Use a managed worktree when the run must edit files:
yottacode run --worktree dependency-update \
"Update the dependency, run the focused tests, and summarize the diff."The worktree gives the agent a separate branch and working directory. Review the result before merging or removing it.
--yolo
--yolo skips approval prompts and raises the iteration budget. It should not be used merely because a CI job is unattended.
If unattended mutation is genuinely required, combine it with:
- A disposable worktree.
- Explicit permission rules.
- A narrow task prompt.
- A finite iteration limit.
- Post-run diff and test checks.
- A human-owned merge or deployment step.
A GitHub Actions example
The same pattern can run as a read-only pull-request job. Keep the token permissions minimal, store provider credentials in the CI secret store, and publish the result as an artifact for human review:
name: AI PR Review
on:
pull_request:
types: [opened, synchronize, reopened]
jobs:
ai-review:
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install yottacode
run: |
curl -fsSL https://yottacode.ai/cli/install.sh | bash
echo "$HOME/.yottacode/bin" >> "$GITHUB_PATH"
- name: Run review
env:
YOTTACODE_API_KEY: ${{ secrets.YOTTACODE_API_KEY }}
PR_NUMBER: ${{ github.event.pull_request.number }}
run: |
yottacode run --format json \
"Use the typed GitHub pull-request review context for pull request #${PR_NUMBER}. Identify correctness bugs, security risks, missing tests, and scope creep. Do not modify files." \
> ai-review.json
jq -e '.exit_reason == "ok" and (.content | length > 0)' ai-review.json
- name: Upload review artifact
uses: actions/upload-artifact@v4
with:
name: ai-review
path: ai-review.jsonReview the workflow before using it in a production repository. In particular, validate the provider’s data handling, the contents of untrusted pull requests, the GitHub token permissions, and whether the job should be advisory or blocking. Do not automatically execute instructions found in issue text, pull-request descriptions, logs, or generated files.
A cron and scheduled-report pattern
A scheduled job can produce a recurring report without mutating the repository:
0 8 * * 1 /opt/agent-jobs/release-readiness.shThe script should use a clean checkout, run yottacode run --format json, validate exit_reason, store the result as an artifact, and notify maintainers only after distinguishing an agent failure from a failed engineering check.
Workflow 1: Pull-request description generator
Use the current diff as input and produce a review artifact without changing the repository:
yottacode run \
"Read the current branch diff and commit history. Draft a concise pull request description with Summary, Testing, Risks, and Open Questions sections. Do not modify files." \
> /tmp/pr-description.mdThis is a good first automation because it is read-only, useful, and easy to review.
Workflow 2: Pull-request code review
A PR review job can run when a pull request opens or receives new commits. Keep it read-only and ask for findings that a human reviewer can verify. This example assumes the runner is authenticated and checked out to the pull-request branch:
PR_NUMBER="${PR_NUMBER:?set PR_NUMBER to the pull request number}"
yottacode run --format json \
"Use the typed GitHub pull-request review context for pull request #${PR_NUMBER}. Identify correctness bugs, security risks, missing tests, backward-compatibility problems, and scope creep. Return findings with severity, file, line, evidence, and a suggested fix. If there are no findings, say so explicitly. Do not modify files." \
> /tmp/pr-code-review.json
jq -e '.exit_reason == "ok" and (.content | type == "string")' /tmp/pr-code-review.jsonFor a local-only review, replace the GitHub request with: Review the current branch diff against its resolved base. A CI job can publish the report as an artifact or add it to the pull request for human review. Do not automatically merge or close a pull request based only on model output. The useful role is to surface questions early and consistently; required checks and human reviewers remain authoritative.
Workflow 3: Test-failure triage
Feed the agent a bounded test artifact:
set +e
go test ./... 2>&1 | tee /tmp/test-output.txt
status=${PIPESTATUS[0]}
set -e
yottacode run --format json \
"Read /tmp/test-output.txt and the relevant source files without modifying the repository. Identify the likely root cause, owning package, confidence, and smallest safe next step." \
> /tmp/test-triage.json
jq -r '.content // .error' /tmp/test-triage.json
exit "$status"The scanner’s exit status should remain authoritative. A successful explanation does not turn a failing test suite into a passing one.
Workflow 4: Dependency-audit summary
Let the security scanner produce machine output first. Use the agent to explain it for humans:
set +e
govulncheck -json ./... > /tmp/govulncheck.json
audit_status=$?
yottacode run \
"Read /tmp/govulncheck.json. Summarize reachable vulnerabilities, affected packages, available fixes, and recommended priority. Do not modify files." \
| tee /tmp/dependency-audit.md
summary_status=${PIPESTATUS[0]}
set -e
if [ "$summary_status" -ne 0 ]; then
exit "$summary_status"
fi
exit "$audit_status"The agent summarizes evidence; it does not replace the vulnerability scanner.
Workflow 5: Changelog draft
Generate a proposed changelog entry from commits and the current diff:
yottacode run --format json \
"Read the current git diff and recent commit subjects. Draft one Keep a Changelog bullet for the Unreleased section. Return only the proposed bullet. Do not modify files." \
> /tmp/changelog.json
jq -r '.content // .error' /tmp/changelog.jsonKeep the generated text as a proposal until a maintainer verifies that it describes the actual user-visible change.
Workflow 6: Release-readiness report
Use a read-only run to assemble evidence before a release decision:
yottacode run --format json --max-iterations 32 \
"Review the current repository for release readiness. Inspect the diff, recent commits, test status files, changelog, version metadata, and CI configuration. Return a report with verified evidence, missing checks, risks, and a release recommendation. Do not modify files." \
> /tmp/release-readiness.jsonThe report should distinguish verified evidence from missing information. Do not ask the agent to declare a release ready when it cannot inspect the required checks.
Workflow 7: One-shot implementation in a worktree
Some tasks genuinely need an unattended edit. Keep the blast radius bounded:
yottacode run \
--worktree update-docs \
--yolo \
--max-iterations 64 \
"Update the API examples for the changed endpoint. Modify only docs/api.md and its example fixture. Run the focused documentation checks. Do not change source code, dependencies, CI, or deployment files." \
> /tmp/update-docs.txtAfter the run:
yottacode worktree status update-docs
yottacode worktree listInspect the worktree’s diff and test output before merging anything. If the worktree is dirty or the result is uncertain, keep it for review rather than automatically removing it.
Conclusion
yottacode run is most useful when it turns an engineering artifact into a bounded next step: a diff into a PR description, test output into triage, scanner output into explanation, or commits into a changelog proposal.
Start with advisory workflows: pull-request summaries, code review, test triage, dependency reports, and release-readiness artifacts. Let deterministic checks—tests, linters, vulnerability scanners, and policy checks—remain responsible for blocking the pipeline. The agent should explain evidence, not replace it.
The strongest CI/CD agent workflows are not the most autonomous ones. They are the ones with clear inputs, explicit outputs, preserved exit statuses, narrow permissions, and a human-owned merge or release decision.
Try a read-only CI job
Start with one read-only yottacode run workflow, such as pull-request review or test triage. Use --format json, preserve the underlying process exit status, and publish the result as an artifact or review comment. Keep the workflow advisory at first. Add mutations only inside a reviewed disposable worktree, with human ownership of merge and deployment decisions.