Skip to content

theakshaypant/agents-as-code

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

71 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Agents as Code (AAC)

Proof of Concept — not production-ready. See the Roadmap for where it's heading.

Run AI agents on git events with declarative tool access and repo-aware context.

Why

AAC explores what it looks like to bring AI agents into the Tekton ecosystem — defining agents the same way you define pipelines: as YAML in your repo, triggered by git events, executed on Kubernetes infrastructure. Code review, issue triage, and implementation agents fit naturally into the same model that CI/CD pipelines already use.

Template variables ({{ pull_request_diff }}, {{ issue_comments }}, etc.) inject rich context into agent prompts. Every agent runs in an isolated K8s SIG Agent Sandbox pod with a PydanticAI-based runtime. The infra team controls what's allowed (LLM provider, MCP servers, budget caps, network policy); developers control what each agent does.

How It Works

  1. Define agents in .tekton/agents/ in your repository
  2. Configure a Repository CR with LLM settings, MCP server catalog, and credentials
  3. Trigger agents via git events or comment commands
  4. The controller matches events to agents, runs each in a sandbox, and executes the structured result (comments, reviews, labels, commits, PRs, status checks)

Working Examples

Three agents are live and producing real output on theakshaypant/yeet-test.

Triage Agent

Labels issues and posts a triage summary when someone comments /triage.

Agent definition
# .tekton/agents/triage.yaml
apiVersion: agent.tekton.dev/v1alpha1
kind: Agent
metadata:
  name: triage
  annotations:
    agent.tekton.dev/on-event: "issue_comment"
    agent.tekton.dev/on-comment: "/triage"
    agent.tekton.dev/result-hooks: "true"
spec:
  system_prompt: |
    You are an issue triage agent for {{ repo_owner }}/{{ repo_name }}.

    Analyze the issue below and perform these actions:
    1. Classify the issue by type and add appropriate labels
    2. Assess complexity and add a size label: "size/small", "size/medium", or "size/large"
    3. Post a triage summary comment

    ## Issue
    **{{ issue_title }}**
    {{ issue_body }}

    ## Current labels
    {{ issue_labels }}
  limits:
    max_tokens: 8000
    timeout_seconds: 120

Actual output on issue #1 ("Project setup and basic FastAPI app"):

Triage agent output

Implementer Agent

Clones the repo into the sandbox, reads the codebase, implements changes, commits them, and opens a PR — all from a /implement comment.

Agent definition
# .tekton/agents/implementer.yaml
apiVersion: agent.tekton.dev/v1alpha1
kind: Agent
metadata:
  name: implementer
  annotations:
    agent.tekton.dev/on-event: "issue_comment"
    agent.tekton.dev/on-comment: "/implement"
    agent.tekton.dev/clone-repo: "true"
    agent.tekton.dev/result-hooks: "true"
spec:
  system_prompt: |
    You are a coding agent for {{ repo_owner }}/{{ repo_name }}.
    The repo is cloned at {{ repo_clone_path }}.
    Use the workspace tools to explore the codebase and implement the requested changes.

    ## Issue context
    **{{ issue_title }}**
    {{ issue_body }}

    ## Instructions
    1. Read and understand the relevant code
    2. Implement the requested changes
    3. Produce a result with a "create-pr", "commit", and "comment" action
  limits:
    max_tokens: 200000
    timeout_seconds: 600

Actual output on issue #1:

The agent created branch aac/issue-1, committed 4 files, and opened PR #6.

Implementer agent comment on issue

Implementer agent PR

Reviewer Agent

Posts a PR review with inline comments on specific files and lines when someone comments /review or a PR is opened.

Agent definition
# .tekton/agents/reviewer.yaml
apiVersion: agent.tekton.dev/v1alpha1
kind: Agent
metadata:
  name: reviewer
  annotations:
    agent.tekton.dev/on-event: "[pull_request, issue_comment]"
    agent.tekton.dev/on-target-branch: "main"
    agent.tekton.dev/on-comment: "/review"
    agent.tekton.dev/result-hooks: "true"
spec:
  system_prompt: |
    You are a code review agent for {{ repo_owner }}/{{ repo_name }}.
    Review PR #{{ pull_request_number }} ("{{ pull_request_title }}").

    Focus on bugs, security vulnerabilities, performance issues,
    and code readability. Provide inline review comments on specific
    files and lines.

    ## Diff
    {{ pull_request_diff }}
  limits:
    max_tokens: 50000
    timeout_seconds: 300

Actual output on PR #6 ("Initial project setup with FastAPI"):

The agent submitted a review with 4 inline comments across the changed files.

Reviewer agent output

Documentation

About

Run AI agents on git events with repo-aware context. Extends the Pipelines-as-Code model with sandboxed agent execution.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors