Ask for permission
Make the user approve a tool call before it does something they would want to check.
Ask first when a tool changes something the user cares about: it deploys, deletes, pays or sends. The user gets a card in the chat. Your tool waits for the answer.
Ask before the tool acts
Call ctx.permission.assert at the start of the tool, before it acts:
import {} from 'zod'
import {Plugin} from '@conciv/backend-plugin-api'
export default Plugin.({
: 'release',
async () {
await ..(() => {
.({
: 'release_ship',
: 'Ship a branch to production, once the user allows it.',
: .({: .()}),
: .({: .()}),
: {: false},
: async ({}, ) => {
await ..({
: 'release_ship', // <- a rule names this action
: [], // <- what the action touches; rules match on it
: [], // <- what "Allow always" remembers
: 'ask', // <- ask even when only a catch-all rule allows it
: {}, // <- shown on the card as the call's details
: .,
: .,
: {: 'tool', : ., : .},
})
return {: {: true}}
},
})
})
},
})import {} from 'effect'
import {} from 'zod'
import {Plugin} from '@conciv/backend-plugin-api/effect'
export default Plugin.({
: 'release',
: () =>
..(() => {
.
: 'release_ship',
: 'Ship a branch to production, once the user allows it.',
: .
: .
: {: false},
: ({},
.
.({
: 'release_ship', // <- a rule names this action
: [], // <- what the action touches; rules match on it
: [], // <- what "Allow always" remembers
: 'ask', // <- ask even when only a catch-all rule allows it
: {}, // <- shown on the card as the call's details
: .,
: .,
: {: 'tool', :
})
.
A few things to notice:
- The last three fields come from the tool context, the second argument of
execute. They tie the card to this call in this chat. agentis the engine's agent profile running the call. Its permission rules decide whether to ask. Learn more in the Agents and permissions documentation.metadatais optional. The card shows it under its title, so pass what helps the user decide.- Without
fallback: 'ask', an agent whose rules allow everything would never ask.
What the user sees
The chat shows a card titled with the action and its resources, here "release_ship main". It has three buttons:
- Allow once. This call runs.
- Allow always. This call runs, and the project remembers the
savevalues for this action. - Deny. The call fails, and conciv tells the agent.
Your tool asks for permission
A scripted session in the real panel. It plays in your browser, with no server.
Your tool asks for permission
You: Ship the release.
The agent calls
release_shipA permission card asks first: Allow once.
Shipped 1.2.0. The tool asked first, and ran only after you allowed it.
When the user picks Deny, the call fails. In the Promise tab assert rejects. In the Effect tab a plain Deny
interrupts your effect as a defect, so a typed handler never sees it. A deny rule, or a Deny with feedback, fails
with a Tool.Error. Either way the agent reads that the user refused.
Ask on every call
Leave out save for a call that must ask every time. The card then has no Allow always button, so no saved answer
can skip it later:
import {} from 'zod'
import {Plugin} from '@conciv/backend-plugin-api'
export default Plugin.
Next steps
- Add a tool: the tool this page guards.
- Test your plugin: check in a test that the call asks.
- Approvals: what the user does with the card.