Start tasks from CI
A CI job or your own integration needs a token that keeps working. Leave out expiresInSeconds for a token without an expiry. When you create one, devboxes warns that the token works until you revoke it. Delegations describes token lifetimes. Delegation tokens have fine-grained permissions, so grant a CI token only the operations it needs. A token needs the operations of the Blueprint that it starts: publication.commit for a Blueprint that publishes, and the operations of its capabilities.
Your own integration can run operations with the CLI, or call the HTTP API with the token.
This prompt sets up a GitHub Actions workflow that starts a devboxes task once a week:
Set up a GitHub Actions workflow in this repository that starts a devboxes task every Monday at 06:00 UTC. The task updates the dependencies of this repository and runs the tests.
With my own sign-in, look up my devboxes Organization, the devboxes Project for this repository, and a Blueprint that publishes its commits.
Create a devboxes delegation token for the workflow in my devboxes Organization. Name it after this repository and give it no expiry. Allow only sessions.dispatch and the operations of that Blueprint: publication.commit for its publish node, and the operations of its capabilities, for example repositories.github-write. Show me the warning that devboxes gives for a token without an expiry.
Save the token as the GitHub Actions secret DEVBOXES_TOKEN of this repository with gh secret set. Do not print the token.
In the workflow, install the devboxes CLI with these two commands:
curl -fsSLO https://devboxes.ai/install
printf "%s install\n" 07727182ac5362fe5345beb5b88999a4973b5a6c127acf205e3540c419977b14 | $(command -v sha256sum || echo shasum -a 256) -c - && sh install
Then start the task with devboxes invoke sessions.dispatch, with the secret in the environment variable DEVBOXES_TOKEN. The token cannot look anything up, so write the IDs of the Organization and the Project into the workflow's input for sessions.dispatch. Also write that Blueprint's name into it as blueprint, so the job keeps using the Blueprint that its token allows.
Commit the workflow on a new branch and open a pull request. Tell me how to revoke the token when I no longer need it.
To set it up yourself:
-
Create a delegation without
expiresInSecondsthat allowssessions.dispatchand the operations of the Blueprint that the job starts. For a Blueprint that publishes, this ispublication.commit:ci-delegation.json { "organizationId": "<organization id>", "name": "GitHub Actions", "operations": ["sessions.dispatch", "publication.commit"] }devboxes invoke delegations.create --input @ci-delegation.json -
Save the
tokenfrom the result as a secret in your CI, namedDEVBOXES_TOKEN. -
In the job, install the CLI as shown in Install the CLI. Set
DEVBOXES_TOKENfrom the secret, and start a task withdevboxes invoke sessions.dispatch. -
When you no longer need the token, revoke it with
delegations.revoke.
Create the token in the dashboard
A token made in the devboxes dashboard can start Blueprints that don't publish. The dashboard can't grant publication.commit, so a job that starts a Blueprint that publishes needs a token from step 1. For a Blueprint that doesn't publish, you can create the token in the dashboard in place of step 1:
- Open Settings > Tokens and choose Create a token.
- Under What is this token for?, choose A CI job or a script.
- On Review your token, check the token's access under Access. The token needs the operations of the Blueprint's capabilities, such as
repositories.github-write. To add them, choose Change access. Choose when the token Expires, for example Never, then choose Create token. - Copy the token from Copy your token. devboxes shows it only once. Continue at step 2.
To revoke the token, choose Revoke next to its name under Settings > Tokens.
Set up Personas and memory
Create a Persona that shapes how devboxes answers, add to Organization memory, store your own preferences, correct how devboxes answers, and deactivate a Persona.
Erase data
Erase a Session, an Organization memory entry, Chat messages, or a Chat conversation with the work it started.