MCPcopy
hub / github.com/CopilotKit/CopilotKit / runAgent

Method runAgent

packages/bot/src/thread.ts:287–313  ·  view source on GitHub ↗
(input?: {
    context?: ContextEntry[];
    tools?: BotTool[];
    /**
     * A user message to inject before running. Needed when the input isn't
     * already in the conversation history the adapter reconstructs — e.g. a
     * slash command, whose args are never posted to the channel. A
     * `AgentContentPart[]` carries multimodal content (e.g. inbound image/file
     * attachments) the model can read.
     */
    prompt?: string | AgentContentPart[];
    /**
     * Auto-bridge cross-platform transcripts for this run. When truthy AND the
     * thread has a resolved `userKey` AND a `Transcripts` instance, this:
     *   1. injects prior history (`transcripts.list`, default limit 20) as a
     *      context entry,
     *   2. appends the current user turn,
     *   3. runs the agent,
     *   4. captures the assistant reply and appends it.
     * This flag OWNS the bridge — callers using it should NOT also manually
     * append the same user/assistant turn via `bot.transcripts.append`.
     * No-ops with a one-time warning when identity/transcripts aren't configured.
     */
    transcript?: boolean | { limit?: number };
  })

Source from the content-addressed store, hash-verified

285 }
286
287 async runAgent(input?: {
288 context?: ContextEntry[];
289 tools?: BotTool[];
290 /**
291 * A user message to inject before running. Needed when the input isn't
292 * already in the conversation history the adapter reconstructs — e.g. a
293 * slash command, whose args are never posted to the channel. A
294 * `AgentContentPart[]` carries multimodal content (e.g. inbound image/file
295 * attachments) the model can read.
296 */
297 prompt?: string | AgentContentPart[];
298 /**
299 * Auto-bridge cross-platform transcripts for this run. When truthy AND the
300 * thread has a resolved `userKey` AND a `Transcripts` instance, this:
301 * 1. injects prior history (`transcripts.list`, default limit 20) as a
302 * context entry,
303 * 2. appends the current user turn,
304 * 3. runs the agent,
305 * 4. captures the assistant reply and appends it.
306 * This flag OWNS the bridge — callers using it should NOT also manually
307 * append the same user/assistant turn via `bot.transcripts.append`.
308 * No-ops with a one-time warning when identity/transcripts aren't configured.
309 */
310 transcript?: boolean | { limit?: number };
311 }): Promise<MessageRef | undefined> {
312 return this.run(undefined, input);
313 }
314
315 async resume(value: unknown): Promise<MessageRef | undefined> {
316 return this.run({ resume: value });

Callers

nothing calls this directly

Calls 1

runMethod · 0.95

Tested by

no test coverage detected