Skip to main content

agent

function

Declare a reusable agent: a name, a system prompt, and optionally a model. This describes an agent, it does not run one. There is no handler, and nothing executes when the mod activates. Put the result under `ai.agents` and the host registers it so the user or another agent can call it by id, `<extensionId>/<name>`. That is the line between this and the rest of the AI surface. To actually run something, use `ctx.ai.ask` for a single answer or `ctx.ai.sessions` for a conversation. To give the model a capability it can invoke, write a `tool`, which does have a handler.

function agent(input: AgentInput): Agent

Import

import { agent } from '@modular/sdk';

Notes

example
```ts const reviewPrompt = prompt({ name: 'review-checklist', description: 'Insert the standard review checklist.', content: 'Review correctness, cancellation, and cleanup.', }); const reviewer = agent({ name: 'reviewer', description: 'Reviews a change and reports concrete defects.', prompt: reviewPrompt, }); ```
category
Authoring