Tools and code mode
How the agent calls tools: directly by name, or from a short program in code mode.
A tool is one action the agent can take through conciv, such as reading the page or running the tests. Code mode is how the agent calls most of them. It writes a short TypeScript program that calls the tools, and conciv runs it.
Pick a mode per tool
import {} from 'zod'
import {Plugin} from '@conciv/backend-plugin-api'
export default Plugin.({
: 'tickets',
async () {
await ..(() => {
.({
: 'ticket_read', // <- code mode: the agent calls it as external_ticket_read
: 'Read a ticket by its id, such as OPS-42.',
: .({: .()}),
: async ({}) => ({: `${} is open.`}),
})
.({
: 'ticket_close', // <- direct: the agent calls ticket_close by name
: 'Close a ticket by its id.',
: .({: .()}),
: {: false}, // <- turns code mode off for this tool
: async ({}) => ({: `${} is closed.`}),
})
})
},
})A tool called directly, then from code mode
A scripted session in the real panel. It plays in your browser, with no server.
A tool called directly, then from code mode
You: Which version is this project?
The agent calls
project_versionCalled directly: vite-project 0.0.0.
You: Read it again from code mode.
The agent calls
project_versionFrom a code mode program.
Same answer. In code mode the call runs inside a TypeScript program, and its card sits inside the program card.
Code mode
Code mode is the default for every tool. The agent gets one tool, execute_typescript, and writes a program for it.
The program can call several tools, wait for each result and work with the values. The agent reads only what the program
returns, not every tool's whole output.
Tool names in code mode
Inside a code-mode program, a tool is a function named external_ plus the tool's name. A tool in a namespace joins
the two names with _, so read in the ticket namespace is external_ticket_read. These are the names you see in
the code card. Learn more in Add a tool.
The catalog
The agent's instructions list the code-mode tools it can call. When the list is too long, they show part of it. The
agent finds the rest with a search(...) function inside the program. It never guesses a name.
Direct tools
A direct tool has codemode: false. The agent calls it by its name, one call at a time, as it calls its CLI's own
tools. Pick direct when the user should see each call, or when your plugin draws a card for it.
The code card
A code-mode run shows as one code card in the chat. The card holds the program, its console output, its result and any error. Every tool the program called ran inside it, so a plugin's own card never shows for a code-mode call.
A tool's own card
A direct call gets a card of its own. Without a plugin card, it is a generic card with the input and the output. A plugin can draw its own card for its direct tools. Learn more in Build your first plugin.
Turn code mode off
A deny rule for the execute action turns code mode off: every tool becomes direct. A deny rule for one tool's
action, on every resource, hides that tool. Learn more in Agents and
permissions.
Next steps
- Add a tool: write a tool, pick its mode and draw its card.
- Agents and permissions: what makes a tool call ask you first.
- Page control: the page tools the agent drives your app with.