Skip to content

feat(skills): add agent-tenants skill - #28

Merged
Plopix merged 1 commit into
mainfrom
feat/agent-tenants-skill
Oct 29, 2026
Merged

Plopix merged 1 commit into
mainfrom
feat/agent-tenants-skill

Conversation

@Plopix

@Plopix Plopix commented Oct 23, 2026

Copy link
Copy Markdown
Member

Adds an agent-tenants skill. It lets an agent with no Crystallize account get a tenant, build in it, and hand it to a human before the tenant is deleted after 72 hours.

SKILL.md

  • Before you provision. Use the user's tenant if they have one. Reuse a tenant already provisioned for the project, unless its expiresAt has passed. Otherwise, tell the user what is about to happen.
  • Provision. One unauthenticated POST /agents/tenants call, with the fields and their rules.
    • The response's one-time secret is stored right away, together with the returned identifier, apiUrl and expiresAt, in a git-ignored .env.
    • The returned identifier is used, not the one requested, because a taken identifier gets a suffix.
  • Build. The tenant starts with no shapes. The existing skills (content-model, mutation, query, mass-operations, js-api-client) work unchanged with the token.
  • Invite. createInviteToken(role: "tenantAdmin"), expiring with the tenant. Invites with other roles can be added on top of it, never instead of it.
  • Hand off. The /get-access?token= link, with the deadline written out in the message, and why the agent can't redeem the invite itself.
  • Check. An optional members query on the PIM API: a member with kind: human and role tenantAdmin means the tenant is claimed.
  • Reference tables: lifetime and claim rules, errors from provisioning and from the invite, and common mistakes.

README.md adds the skill to the list. The docs site picks it up by itself, and bun run build in docs/ renders it at /skills/agent-tenants/.

How it was tested

Following the writing-skills process, each scenario was run without the skill first, then with it, and the written answers were compared. Nothing was executed.

  • Without the skill, the answer:
    • sent the user to sign up and create an access token by hand;
    • planned PIM tenant.create, which agents are refused;
    • said there was nothing to hand over.
  • With the skill, the agent did the whole flow. It used the suffixed identifier, gave the invite the tenant's expiresAt, and put the deadline in the message.
  • Harder follow-ups: "accept it yourself", "make it permanent", "invite my colleague as editor instead", "start a fresh tenant".
    • Every one was refused or redirected correctly.
    • The first run found a contradiction about inviting a colleague. It was fixed, and the scenario passed on a re-run.
  • The 184 MCP tests pass.

Before merging

  • Production. The examples use api.crystallize.com, so this should not ship before backend PR 1003 is released to production. Everything was verified on develop on 2026-10-23.
  • Not verified (also marked in the skill): the 409, 500 and 429 answers, and a human joining with a role other than tenantAdmin.
  • Open questions:
    • Is an invite token single-use? Does a new one cancel the old one, and can one be revoked?
    • What expiresAt should an invite get once the tenant has been kept or claimed?
    • Which role identifiers other than tenantAdmin exist on a new tenant?
  • Rate limit. Whether provisioning needs its own rate limit is still undecided. Today only the per-IP firewall limit applies.

@Plopix
Plopix force-pushed the feat/agent-tenants-skill branch from 31fa899 to 61d4175 Compare October 23, 2026 22:29
No skill told an agent it can get a Crystallize tenant on its own. Asked
to set one up for a user with no account, an agent sends the user to sign
up and create an access token by hand, or tries PIM tenant.create, which
agents are refused.

New skill `agent-tenants`: provision with the unauthenticated
POST /agents/tenants, store the one-time secret and the returned
identifier and apiUrl, build with the existing Core API skills, create a
tenantAdmin invite that expires with the tenant, and hand the
/get-access?token= link to the user with the deadline. It also covers
the optional members check on the PIM API, the lifetime and claim rules,
the provisioning and invite errors, and the common mistakes.

The build is pointed at a mass operations file: the tenant is disposable
until a human claims it, so keeping the build as a file makes a new
tenant one replay away.

Production needs the backend release before the examples on
api.crystallize.com work.
@Plopix
Plopix force-pushed the feat/agent-tenants-skill branch from 61d4175 to a55554c Compare October 23, 2026 22:32
@Plopix
Plopix merged commit 8d5fcdd into main Oct 29, 2026
1 check passed
@Plopix
Plopix deleted the feat/agent-tenants-skill branch October 29, 2026 22:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant