Variations
The Quickstart keys every user's context by your own user id. Until that user links a real Configure account, that context is yours. It exists only in your namespace, and your secret key has full authority over it. It is not portable yet, and nobody else can see it.
Every snippet here uses the handle from the Quickstart, built once on your server. Reads and writes match the Quickstart too. Use profile.read() when the webhook says their context changed, and profile.commit({ messages }) at the end of every turn. There is no profile.write or profile.save.
ts
import { Configure } from "configure";
export const configure = new Configure({
apiKey: process.env.CONFIGURE_API_KEY, // sk_..., server only
agent: process.env.CONFIGURE_AGENT, // your agent handle
});
export const profileFor = (userId: string) => configure.profile({ externalId: userId });What changes the day they link
They can link at any time, through the same button. When they do, their context migrates in place. Nothing is lost, and the externalId you use does not change.
One thing does change. It matters if you run more than one agent.
Linking clears every agent's approval for that user. The connect page re-grants only the one agent the user approved. While the context was yours, it was auto-approved for every agent of yours that touched it. No person gave those approvals. Once the account is real, the user decides who gets it, not your key.
So your other agents are refused as soon as that user links:
ts
try {
const read = await profile.read({ sections: ["identity", "preferences", "summary"] });
} catch (err: any) {
// approval_required: 403, code ACCESS_DENIED, suggestedAction "complete_approval".
if (err.suggestedAction === "complete_approval") {
// Your key is no longer authority over this user. Ask them.
const { connect_url } = await profile.connect({ returnUrl: RETURN_URL });
return res.redirect(connect_url!); // always set on a minted link
}
throw err;
}RETURN_URL and the redirect are the ones from Quickstart, step 3. The SDK reports this refusal as ACCESS_DENIED with statusCode 403. Match on suggestedAction, not on code. profile.connect() and profile.mcpSession() keep working while approval is outstanding, so you can mint the link that fixes it. Everything else, reads and writes alike, waits for the user.
Handle approval_required once, in the code that wraps your Configure calls. The rest of your code then never sees it.
Sign in with Configure
Configure can be your account system, not only a source of context next to your own accounts. See Sign in with Configure.
Two other shapes
- Your agent has no screen (SMS, voice, a CLI, a scheduled job). The minted link takes the place of the button. See Message agents.
- You do not own the model loop (the user runs Claude, ChatGPT, or a coding agent). Point the host at
mcp.configure.devand stop. See MCP. This is the only case where connecting MCP is the whole integration, because the host has its own read and save behavior. In every other case, MCP alone is not enough. Nothing would inject context on the first turn or commit the turns.