Agent in Production
IntegrationsLong read

Routing Different GitHub Events to Different Agent Configurations

Agent routing is a risk-scoping job, not a webhook wiring job.

· 10 min read · Updated
Cover illustration for “Routing Different GitHub Events to Different Agent Configurations”
Integrations · September 30, 2026 · 10 min read · 2,210 words

Most teams building agent fleets start with a webhook diagram: this event fires that agent, here is the curl call, ship it. The wiring is the easy part and treating it as the whole job gets the causality backwards. Whether an agent fleet is safe to run depends on what a given agent should be allowed to do, know, and spend when an event fires. Scope, tools, permissions, and budget are the substance of agent routing. The event trigger only starts the clock.

The amux routing guide makes this concrete. The endpoint treats the two names as identical, which is exactly the problem. GitHub describes the emerging model as Event → AI Agent → Automatic task, and this is a deliberate move away from a human prompting the AI directly. An interactive tool has a person watching each step, ready to stop a bad action before it lands. An autonomous, event-triggered agent has no one in the loop at the moment it acts. Routing design has to assume that absence, not quietly depend on someone catching the mistake.

What GitHub Agentic Workflows leaves unspecified

GitHub Agentic Workflows combines GitHub Actions with AI coding agents, natural language instructions, and full repository context, and the event surface available to trigger it is already comprehensive. There is no shortage of hooks to route from.

What the platform does not specify is the behavioral contract attached to each named agent: which tools it may call, which credentials it can see, how much it may spend before something stops it, and whether a human has to approve its actions before they take effect. None of that comes bundled with the trigger. The routing mechanism is GitHub's to provide; the configuration design that fills it is an engineering discipline the platform leaves entirely to the team building on top of it. That gap is the permanent division of labor between infrastructure and the judgment calls infrastructure can't make for you, and it's the reason the rest of this argument exists.

How event type signals an agent configuration's risk profile

The event type that triggers an agent is a proxy for blast radius, the amount of damage a misconfigured or misbehaving agent can do before anyone intervenes. Configuration should be calibrated to that radius rather than to the nominal task the agent is supposed to perform.

Consider pull_request:opened firing a reviewer agent. It reads a diff and posts a comment. The worst plausible outcome is a bad review comment, which a human can ignore or delete in seconds. Low stakes, read-heavy, forgiving of mistakes.

Compare that to issues:labeled "needs-tests" firing a test-writer agent. This one writes files, pushes a branch, and opens a draft PR. The blast radius extends to one branch, and that branch sits in front of a human reviewer before it can merge anywhere. More consequential than a comment, but still contained.

Push to main firing a documentation bot sits a tier higher. It touches documentation across the repository on every merge, so if this agent is under-specified, it accumulates drift silently over weeks instead of failing loudly once.

The highest-risk profile in a typical fleet is a nightly bugfixer running on a schedule. These events carry risk because nothing gates the agent's first action on a person being present to see it.

That risk profile should drive three configuration dimensions directly: tool access, meaning what the agent is permitted to call; credential scope, meaning what systems it can actually reach; and a budget cap, meaning how much it can spend before being halted automatically. A reviewer agent and a nightly bugfixer should never inherit the same defaults on any of the three, because they do not carry the same blast radius if something goes wrong.

What goes wrong when that calibration fails has a documented example. An incident reported in April 2026 described an AI agent wiping a Railway database in a matter of seconds. The lesson generalizes past Railway: a high-risk trigger paired with an under-scoped configuration doesn't fail gracefully. It fails in whatever way the missing boundary happened to leave open.

What each named agent configuration needs to contain

A named agent configuration is a behavioral contract, and a complete one needs at least four components: behavioral intent, capability boundaries, credential scope, and spend limits. Skip any one of them and the configuration is incomplete regardless of how well the prompt reads.

Behavioral intent lives in files like CLAUDE.md and AGENTS.md, which define what the agent is trying to accomplish and, just as importantly, what it should refuse to do. GitHub's own governance guidance requires human review for changes to these files, because a single instruction change can alter agent behavior across many sessions and many repositories at once. It reflects how much leverage a few lines of behavioral intent carry once an agent is running unattended across a fleet.

Claude Code's configuration model separates this cleanly into layers: CLAUDE.md carries behavioral guidance, while settings.json, which can be set at user, project, local, and managed scopes, carries enforced configuration including capability boundaries. The split mirrors how IAM policies work in cloud infrastructure: application code defines business logic, and IAM enforces what's actually permitted at the infrastructure layer beneath it. Behavioral intent tells the agent what it's trying to do; capability boundaries determine what it's allowed to do regardless of what it's trying to accomplish.

You need to declare capability boundaries explicitly for each configuration rather than inherit them from some global default that happens to be convenient. The specificity here is the entire point: capability boundaries that are declared loosely because "the agent might need it" defeat the purpose of naming the agent in the first place.

Credential scope follows the same logic at the identity layer. Every agent session should receive credentials minted for that session and scoped to what that configuration legitimately needs. Shared or long-lived credentials undercut per-configuration design even if every other component is built correctly, because a leaked or misused credential then carries the reach of whatever else was using it.

Spend limits round out the contract. You set a budget cap at the session level as a configuration decision before the agent runs. Observability tools record spend as it happens; they don't intercept it. The cap has to live in the configuration itself.

Configuration files belong in the repository, reviewed like any other code

Agent configuration files are arguably the most consequential code in a given repository, because they define what an automated system is permitted to do on that repository's behalf. When you treat them as deployment artifacts, dropped into place without the scrutiny applied to application code, the configuration goes live without the review that would have caught a bad permission or instruction.

Files like CLAUDE.md, AGENTS.md, mcp.json, and agents.yaml do for AI agents roughly what Terraform configurations did for cloud infrastructure: they separate what a system does from how it's built, and they make that separation something a reviewer can actually inspect before it takes effect. There's nothing exotic about the mechanism. The mechanism has to be applied, not just available.

GitHub's enterprise governance guidance states that changes to agent configuration files need human review, and the reasoning is one of speed as much as correctness. Review is the control that keeps humans meaningfully in charge of systems that act faster than a person can watch in real time.

The Git-Native Agent Protocol pattern extends this same logic to coordination, not just to behavioral intent. GNAP coordinates teams of AI agents using four JSON files stored in a git repository, with no server and no database required. That it works at the coordination layer, not only at the level of a single agent's instructions, suggests the version-control-native approach generalizes well beyond any one configuration file.

Version control does not solve everything, though, and the gap it leaves shows up elsewhere: reproducibility. An AI agent running from the identical CLAUDE.md on two different days reasons differently, chooses different tool calls, and produces different outputs because of LLM non-determinism, model version drift, or effects that accumulate in context over a long session. Configuration versioning is necessary for governance. It isn't sufficient for reproducibility, and no amount of git history resolves that gap by itself.

Sandbox isolation as the enforcement layer for configuration boundaries

A well-designed configuration file states what an agent is allowed to do. Stating it is not the same as enforcing it, and the mechanism that turns a declared boundary into an actual one is sandbox isolation at the execution layer.

If agents execute shell commands, install packages, read files, or make network requests, they need isolated environments to run in. Without that isolation, a misconfigured agent can reach the host system, another team's infrastructure, or a sensitive data store regardless of what its configuration file claims it's restricted to. The file is policy. The sandbox is what makes the policy binding rather than advisory.

Parallel agent work inside a single repository raises the same question in a different shape, and it comes up whenever multiple event types fire at once. The sound design here gives each agent its own isolated git worktree, so their edits can't collide with each other mid-session, then merges the resulting branches using ordinary git tooling with a human reviewing before anything lands on a shared branch.

Credentials minted fresh for each session and revoked once that session completes are the runtime counterpart to scoped configuration described earlier. If a session is compromised or an agent misbehaves inside it, the damage stays bounded to whatever that session's credentials permitted, nothing more. That boundary is what the configuration file describes on paper and what sandbox isolation turns into something an attacker, or a bug, actually has to contend with.

Observability and audit trails as a check on configuration assumptions

Observability is the mechanism by which the people who designed a configuration learn whether their behavioral contract is producing the behavior they intended, or something quietly different from it.

Observability and audit trails answer two related but distinct questions. Observability asks whether an agent is behaving correctly and performing well. An audit trail asks what an agent actually did and who was accountable for it. Both questions matter, and neither substitutes for the other.

In GitHub Enterprise, audit log fields such as agent_session_id, actor_is_agent, and user let a team correlate events across an entire session rather than examining isolated actions out of context. Alerts should be configured for unusual session volume, changes to MCP policy, agent modifications to workflow files, and attempts to bypass a ruleset. Each of those signals points at a different way a configuration's assumptions might be wrong in practice.

The transcript shows the agent's reasoning, the commands it actually ran, and the point where something broke, which is the most direct evidence available for deciding whether a boundary was set too broad or too narrow for the agent carrying it.

The limit here connects straight back to the configuration anatomy you saw earlier. Observability tools record what happened; they do not intercept it before it happens. Alerts fire asynchronously, and if nobody is watching when one fires, especially off-hours, spend continues and the action has already occurred by the time anyone notices. That's the argument for keeping budget caps inside the configuration itself rather than relying on a dashboard to catch an overrun after the fact. Observability tells a team whether its assumptions held. It can't substitute for having built the right boundary into the configuration from the start.

Putting the routing map together: a practical event-to-configuration decision framework

Designing a routing map is the practice of applying the risk-profile taxonomy, the four-part configuration anatomy, sandbox enforcement, and observability together, consistently, across every event type a fleet needs to handle, rather than treating any one of them as sufficient on its own.

Start from the event type and name its blast radius honestly: a reviewer reading a diff carries a different radius than a nightly bugfixer running unattended, and the configuration for each should reflect that difference rather than share a convenient default. Commit those configuration files to the repository and route changes to them through the same pull request review applied to any other code with this much leverage over production behavior, because a single edited instruction can ripple across sessions and repositories faster than a reviewer working without that process in place.

Enforce what the configuration declares with sandbox isolation, whether that means microVM-backed environments with dedicated kernels or isolated git worktrees for agents working in parallel, so that the boundary written into a file is the boundary an agent actually encounters at runtime. Close the loop with audit logs correlated by session and periodic transcript review, so a team can see whether it set a capability boundary correctly or needs to tighten it after watching the agent operate against it.

None of these four layers substitutes for the others. A configuration file without sandbox enforcement is a boundary that exists only on paper. Sandbox isolation without observability leaves a team blind to whether its boundaries were calibrated correctly. The event that fires an agent was never the hard problem. The contract that agent operates under, and the enforcement and observation that make that contract real, is the engineering work routing actually requires.

Sources

  1. GitHub Boldly Maps Out The Agentic Development Universe - Futurum
  2. Code Inside Blog | GitHub Agentic Workflows: Schedule-driven and Event-driven AI Agents
  3. GitHub brings agentic workflows to GitHub Actions
  4. An AI Agent in Your CI: Self-Hosted Coding Agents with GitHub Actions | Dipjyoti Metia
  5. Introducing the Agent Governance Toolkit: Open-source runtime security for AI agents | Microsoft Open Source Blog
Filed underIntegrations

More in Integrations