Skip to content

Move the five OpenRouter workflows to Agent Router - #426

Merged
theletterf merged 7 commits into
mainfrom
feat/move-workflows-to-agent-router
Oct 26, 2026
Merged

theletterf merged 7 commits into
mainfrom
feat/move-workflows-to-agent-router

Conversation

@theletterf

@theletterf theletterf commented Oct 15, 2026 •

Copy link
Copy Markdown
Member

This moves the five OpenRouter workflows to Agent Router. It is a draft, and it is an alternative to #424, which moves the same five to Copilot as a fallback. Both rewrite the same engine blocks, so whichever lands second needs a rebase and a recompile.

IT built the identity and the allowlist in elastic/centralized-it-infra#1636. I have tested most of this in elastic/docs-actions-sandbox. The rate limit is what stops it from working in real use.

What changes

In gh-aw-issue-triage, gh-aw-issue-auto-triage, gh-aw-issue-scope, gh-aw-project-metadata and gh-aw-docs-review:

  • A first step runs google-github-actions/auth and mints a Google ID token for https://llm.idea.elastichosting.ai with the service account's email. The token goes to the engine as its key. The provider and the service account are public, so the workflows carry them as defaults, and callers need no repository variables.
  • The Claude engine (triage, auto-triage, docs-review) uses ANTHROPIC_BASE_URL=https://llm.idea.elastichosting.ai/anthropic. The AWF sidecar sends the Anthropic key in x-api-key, and the gateway only reads Authorization: Bearer, so the workflows set AWF_ANTHROPIC_AUTH_HEADER=Authorization and the key value starts with Bearer .
  • The Codex engine (scope, project-metadata) uses OPENAI_BASE_URL pointing at /v1. The sidecar sends Bearer natively.
  • gh-aw checks the Claude key in the activation job, where the auth step does not exist, so the key has a fallback literal there. The agent job always gets the real token.
  • Models are the IDs IT onboarded: claude-haiku-5-5, claude-sonnet-5-5 and gpt-5.6-luna.
  • The workflows ask for id-token: write, and the network allowlists swap openrouter.ai for the gateway host.
  • Callers that still pass ANTHROPIC_API_KEY or OPENROUTER_API_KEY keep working, because the workflows still declare those secrets as optional and unused.
  • The docs are updated: a new Agent Router section in DEVELOPING.md (how the auth works, the engine settings, how to add a repo, the shared limit, troubleshooting, sandbox testing), the index README, and the per-workflow READMEs and examples.

Sandbox results

Workflow Model Result Counted tokens per run
Docs review claude-sonnet-5-5 Passed, with detection about 379k
Auto-triage claude-haiku-5-5 Passed, correct labels about 293k
Triage claude-haiku-5-5 Failed with 429 111k before the limit
Scope gpt-5.6-luna Passed on Oct 21; failed with 429 on Oct 22 95k to 180k; 266k before the limit
Project-metadata gpt-5.6-luna Passed on Oct 22, as a dry run in docs-content-internal with its own ADD_TO_BOARD_TOKEN (four requests, no 429) 65k

Everything works end to end. The gateway first capped our account at 1,000,000 tokens per hour and counted cached tokens: one run of each of four workflows used about 1,049,000 tokens in ten minutes, and the rest got 429. IT removed the cap in elastic/centralized-it-infra#1663. After that, six sandbox runs counted about 1.9M tokens in one hour with no 429.

What blocks merging

  1. Caller edits. Every caller job needs id-token: write. oblt-aw already has it. For the three docs repos, I opened Grant id-token: write to the agentic workflow callers docs-content#8991, elastic/docs-content-internal#2075 and elastic/docs-eng-team#1121. They are safe to merge now and must merge before the release moves v1.
  2. A live check of project-metadata on a real label event. The dry run passed, but real events change board fields, so I would watch the first one after the release.
  3. Cost data. Per-run cost from OpenRouter generation records goes away. We have the AIC estimate in each run, and I asked IT for read access to the gateway's usage data in elastic/centralized-it-infra#1638.

Other things to know

  • Threat detection still runs on Copilot, so callers keep copilot-requests: write, and detection spends Copilot allowance.
  • The AWF_ANTHROPIC_AUTH_HEADER setting depends on AWF. If AWF changes how it sends the Anthropic key, the Claude workflows would fail with 401 Jwt is missing.
  • Merging changes nothing for callers. They pick it up when a release moves v1.

Related to elastic/docs-eng-team#1056

🤖 Generated with Claude Code

Authenticate with a Google ID token from google-github-actions/auth, point the
Claude engine at llm.idea.elastichosting.ai/anthropic and the Codex engine at
llm.idea.elastichosting.ai/v1, and drop the OpenRouter keys, headers and base
URLs. This assumes the Workload Identity pool, the allowlisted service account
and the 5.5 models exist. Not tested.

Related to elastic/docs-eng-team#1056

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@theletterf
theletterf force-pushed the feat/move-workflows-to-agent-router branch from 115fa32 to 73db17d Compare October 21, 2026 08:03
theletterf and others added 5 commits October 21, 2026 13:07
The Workload Identity provider and the service account exist in
elastic/centralized-it-infra#1636. Both identifiers are public and the same for
every caller, so the workflows use them as fallbacks and callers need no
repository variables.

Related to elastic/docs-eng-team#1056

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
gh-aw validates the engine key in the activation job, where the auth step does
not exist, so the key needs a fallback literal there. The 5.5 Claude models are
not onboarded yet, so use claude-haiku-4-5 and claude-sonnet-5 for now.

Related to elastic/docs-eng-team#1056

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
The AWF sidecar sends the Anthropic key in x-api-key by default and the gateway
answers 401 Jwt is missing. AWF_ANTHROPIC_AUTH_HEADER renames the header, and the
key value carries the Bearer scheme because the sidecar adds no prefix.

Related to elastic/docs-eng-team#1056

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
The platform team onboarded claude-haiku-5-5 and claude-sonnet-5-5.

Related to elastic/docs-eng-team#1056

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Add an Agent Router section to DEVELOPING.md: how the auth step works, the engine
settings, the models, how to add a repo, the shared rate limit, usage data,
troubleshooting and sandbox testing. Update the index and per-workflow READMEs.

Related to elastic/docs-eng-team#1056

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
@theletterf theletterf self-assigned this Oct 26, 2026
@theletterf theletterf added the enhancement New feature or request label Oct 26, 2026
@theletterf
theletterf marked this pull request as ready for review October 26, 2026 10:01
@theletterf
theletterf requested a review from a team as a code owner October 26, 2026 10:01
@theletterf
theletterf requested a review from akira28 October 26, 2026 10:01
@theletterf theletterf changed the title Draft: move the five OpenRouter workflows to Agent Router Move the five OpenRouter workflows to Agent Router Oct 26, 2026
@theletterf
theletterf merged commit 9edafb0 into main Oct 26, 2026
5 of 6 checks passed
@theletterf
theletterf deleted the feat/move-workflows-to-agent-router branch October 26, 2026 10:05
alexandra5000 pushed a commit to alexandra5000/docs-content that referenced this pull request Oct 26, 2026
## Summary

IT is moving our docs agentic workflows from OpenRouter to Agent Router,
and the new versions of the reusable workflows in `elastic/docs-actions`
(elastic/docs-actions#426, still a draft) reach the gateway with a
Google ID token. That token comes from the job's GitHub OIDC token, and
GitHub only issues one to a job that has `id-token: write`.

A reusable workflow cannot get more permissions than the calling job
grants. So once `v1` moves to the new versions, a caller without this
permission would fail at startup, even for runs that would not need it.
I checked all the callers, and none of the three docs repos grant it
today.

This PR adds `id-token: write` next to `copilot-requests: write` in the
callers of the five workflows that use Agent Router:

- `docs-triage.yml`, `docs-auto-triage.yml`, `docs-scope.yml` and
`docs-project-metadata.yml` (workflow-level permissions)
- `docs-ai-menu.yml` (the `run-docs-issue-scope` job)
- `docs-pr-ai-menu.yml` (the `run-docs-review` job)

It is safe to merge now. The current `v1` workflows do not use the
permission, so nothing changes until the release. The permission only
lets a job ask for a token that describes itself. Google decides what
that token can do, and IT's identity pool only accepts tokens from
`gh-aw-*` workflows in `elastic/docs-actions`, from the repos on the
service account's list (elastic/centralized-it-infra#1636).

Where a file keeps its permissions at the workflow level, the new line
sits in that block and covers every job that inherits it. I only added
it to the jobs or blocks that call the reusable workflow.

Related to elastic/docs-eng-team#1056

## Generative AI disclosure

1. Did you use a generative AI (GenAI) tool to assist in creating this
contribution?
- [x] Yes  
- [ ] No  

Tool(s) and model(s) used: Claude Code (Claude Sonnet 5.5)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-authored-by: Claude Sonnet 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants