flagon-io/g1t

public

Where people and agents ship software together. The open-source git platform for the whole job: issues, agents, checks and deploys to the edge.

g1t/apps/docs/src/content/docs/guides/g1t-agents.md

240 lines10,766 bytesCodeBlame
1---
2title: g1t agents
3description: Have g1t's own agents work on an issue.
4---
5
6g1t can do the work itself. Assign an open issue to the g1t agent and it
7opens a pull request for the issue, works in a sandbox and a fork of its
8own, and reports back as it goes. There is nothing to configure: you do not
9say how many agents or which model. Scale comes from assigning many issues,
10each to its own agent, all working at once.
11
12g1t agents are paid for by the workspace they work for; see
13[usage and billing](/guides/usage-and-billing/). Everyone can also
14[bring their own agent](/guides/bring-your-own-agent/), which costs
15nothing on g1t.
16
17To hand over a whole outcome rather than one issue at a time, have an agent
18plan it first: see [hand off an outcome](/guides/outcomes/).
19
20## Assigning agents
21
22One issue:
23
241. Open an issue on a repository.
252. In **Assign to g1t agent**, optionally add guidance for this run, on top
26 of the issue's description.
273. Choose **Assign**.
28
29Many issues:
30
311. Open the repository's **Issues** tab.
322. Tick the issues to hand over, up to ten at a time.
333. Choose **Assign to g1t agent**.
34
35From the API, an agent of your own, or a script:
36
37```sh
38curl -X POST https://api.g1t.sh/repos/<workspace>/<repo>/issues/12/assign \
39 -H "Authorization: Bearer $G1T_TOKEN"
40```
41
42The same thing is the `assign_issue` tool on the MCP server, so an agent
43planning work can hand issues to g1t agents itself.
44
45Each agent appears as a draft pull request on its issue within a few
46seconds. The pages update on their own while they work.
47
48An issue can still have more than one pull request: assign it again, or
49have your own agent open one alongside. That is for when you want a second
50attempt, not the normal way of working.
51
52## What an agent does
53
541. Clones its pull request's fork.
552. Is told what else is in progress: every other open pull request in the
56 repository, what it is for and which files it changes. Its session
57 starts with a note of what it was told.
583. Reads the code and makes the change the issue asks for, keeping clear of
59 the other work where it can.
604. Commits its work.
615. Pushes to the fork and marks the pull request ready for review, with a
62 summary as its description.
63
64Everything it reads, runs and decides is recorded in the pull request's
65**Session** as it happens; see [sessions and why-blame](/guides/why-blame/).
66The **Changes** tab shows the resulting diff.
67
68If an agent fails, or finishes without changing anything, its pull request
69is closed and its session says why.
70
71## Seeing it through
72
73Making the change is the first step. g1t takes the rest itself, and you
74get the pull request back ready to merge:
75
761. **Checks.** The issue's
77 [acceptance checks](/concepts/overview/#acceptance-checks) run against
78 the change in a separate, clean sandbox. The agent has no say in the
79 result.
802. **Review.** A different agent reads the change and posts comments on
81 lines, a summary and a verdict.
823. **Revision.** If the checks fail or the review asks for changes, the
83 author is sent back with exactly what was found, and steps 1 and 2 run
84 again on the result. This happens at most twice.
854. **Ready to merge.** Checks passed and approved. Merging is yours,
86 unless the repository says otherwise (below).
87
88If `main` has moved in the meantime, that does not hold the pull request
89up. Merging it brings it up to date first: g1t merges `main` in, an agent
90resolves any conflict, and it lands. A repository that wants every pull
91request caught up and checked again before it may merge turns on **Require
92pull requests to be up to date before merging** in its settings; catching
93up is then a step of its own, before "ready".
94
95The pull request's page shows which step it is at. If g1t cannot finish,
96because the checks still fail after two revisions, a review could not be
97written, or a conflict could not be resolved while bringing it up to date,
98it stops and the page says
99**Needs you**, with the reason. Pushing to the pull request yourself starts
100it moving again.
101
102### What a repository can ask for
103
104Under a project's **Settings → Repository**, a member of its workspace sets the
105rules its pull requests follow:
106
107| Setting | Default | What it does |
108| --- | --- | --- |
109| Require a pull request to change `main` | Off | Refuses pushes to the default branch. |
110| Required approvals | None | How many reviewers must approve before a merge. A reviewer who asked for changes blocks it. |
111| A g1t agent's approval counts | On | Off means approvals have to come from people. |
112| Require acceptance checks to pass | Off | On means nobody can merge with failed checks. |
113| Require pull requests to be up to date | Off | On means catching up is a step of its own and the checks run again. |
114| Review by a second agent | On | Off leaves review to people. |
115| Revisions before asking you | 2 | How often an agent is sent back before g1t stops. |
116| Merge automatically when ready | Off | Lands a g1t agent's pull request once every rule is met. |
117| Merge through a queue | Off | Merging tests a pull request together with those ahead of it; `main` only moves to a combination that passed. See [merge queue](/guides/merge-queue/). |
118
119A g1t agent's pull request follows the same rules as anyone's. If the
120repository wants approvals from people, it waits for them, and shows
121**Needs you** until they arrive.
122
123### Talking to an agent
124
125While a g1t agent works, you can steer it with **Message the agent** on its
126pull request; it reads the message at its next step, without starting
127over. Once it is done, a review with **Request changes** sends it back to
128make them, and the checks and review run again. g1t agents working at the
129same time can also ask each other questions and hand each other work. See
130[talk to agents](/guides/talking-to-agents/).
131
132### Merging automatically
133
134A repository can land a g1t agent's pull request by itself once it is
135ready. A member of the workspace turns this on under the repository's
136**Settings → Repository**; it is off to begin with. The merge is recorded as made by
137`g1t`, the issue closes naming the pull request, and nothing short of
138ready is ever merged this way. One that is behind `main` is brought up to
139date as part of the merge. Pull requests from people and from other
140agents always wait for a member.
141
142Every step is recorded: revisions and catch-ups in the pull request's
143**Session**, reviews in its conversation.
144
145This applies to pull requests made by g1t agents. One you or your own
146agent opened is yours to drive; the same checks run on it, and you can ask
147for a review or a catch-up from its page.
148
149## Choosing between pull requests
150
151Each pull request on the issue's page shows whether its checks passed. Open
152the ones that did, read their descriptions and changes, and merge the one
153you want. Merging lands it on `main` and closes the issue, which records
154that pull request as the one that resolved it. The other pull requests for
155the issue close as superseded. See
156[merging](/concepts/overview/#merging) for what happens when `main` has moved.
157
158## Other things g1t agents do
159
160- **Review.** On a pull request that is ready, **Review by a g1t agent**
161 has an agent read the change and post comments on lines, a summary and a
162 verdict.
163- **Catch up.** When `main` has moved under a pull request, **Catch up with
164 main** has an agent merge it in and resolve any conflict.
165
166Both run in sandboxes of their own.
167
168## Which model runs
169
170You do not pick one. You assign the work to `g1t-agent`, the way you would
171assign an issue to a colleague, and g1t routes it. The kind of work decides:
172
173| Work | Model today |
174| --- | --- |
175| Making a change for an issue, and revising it | Claude Sonnet 5.5 |
176| Reviewing a pull request | Claude Sonnet 5.5 |
177| Catching up with `main` and resolving conflicts | Claude Sonnet 5.5 |
178| Planning an outcome | Claude Sonnet 5.5 |
179
180Every session opens with a note naming the model that ran, and an agent's
181review says which model wrote it, so what you got is always on the record.
182When a better model for a kind of work appears, g1t changes the route and
183nothing you have set up needs to change.
184
185A pull request made by a g1t agent carries the label `g1t-agent`, and its
186commits are authored by `g1t agent`.
187
188## How model traffic is routed
189
190g1t agents send model requests through
191[Cloudflare AI Gateway](https://developers.cloudflare.com/ai-gateway/). The
192gateway is where an operator sees each request, caps spend, caches, and
193holds the provider's key so that no sandbox does. Each request is tagged
194with the kind of work, the repository and the pull request, so spend can be
195read per pull request.
196
197If you run your own copy of g1t, these settings on the runner control it:
198
199| Setting | What it does |
200| --- | --- |
201| `AGENT_ROUTES` | The model for each kind of work: `implement`, `review`, `update` and `plan`. |
202| `AI_GATEWAY_ID` | The gateway to route through. Empty sends requests to the provider directly. |
203| `AI_GATEWAY_TOKEN` | Secret. Authenticates to the gateway. With the provider's key stored in the gateway, this is the only credential a sandbox gets. |
204| `ANTHROPIC_API_KEY` | Secret. The provider's key, if the gateway does not hold it. |
205
206## What it costs
207
208A workspace pays for the g1t agents that work on its repositories, after
209they run: each run is charged what AI Gateway priced its model requests
210at, plus 20%, and its sandbox by the second past the free minutes. See
211[Usage and billing](/guides/usage-and-billing/) for how prices are set and
212the limits on usage not yet paid for.
213The workspace's **Usage** page shows what its agents have cost, by day,
214kind of work, repository, model and pull request. See
215[usage and billing](/guides/usage-and-billing/).
216
217## What a sandbox has
218
219Git, common shell tools, and toolchains for Node.js, Python, Go and Rust, so
220an agent can build and test most projects. If your project needs something
221else, the agent will say in its summary what it could not run.
222
223## Limits in the preview
224
225- g1t's agents, and the sandboxes that run acceptance checks and the merge
226 queue, work in any workspace that has
227 [its own model provider](/guides/models/), and, until October 22, in any
228 workspace on its free $1 of g1t's own models. See
229 [the free allowance](/guides/usage-and-billing/#the-free-allowance).
230- An agent is given one fork and the issue. Its credential, though, is your
231 account's for the length of the run; credentials limited to the pull
232 request are planned.
233- A run has two hours. After that its credential expires and it can no
234 longer push or report.
235
236## What a sandbox can reach
237
238A sandbox holds one fork and a credential that expires two hours after the
239run starts. That credential, and the model key the agent runs on, are
240removed from anything recorded in the session.