Skip to content

AI Agents & MCPs & AI Workflow Automation • (~400 MCP servers for AI agents) • AI Automation / AI Agent with MCPs • AI Workflows & AI Agents • MCPs for AI Agents

1.2 KB
Raw Blame
import { createAction, Property } from "@activepieces/pieces-framework";
import { raiaAiAuth } from "../common/auth";
import { httpClient, HttpMethod } from "@activepieces/pieces-common";
import { BASE_URL } from "../common/constants";

export const promptAgentAction = createAction({
    name: 'prompt-agent',
    displayName: 'Prompt Agent',
    description: 'Sends a prompt to a Raia Agent.',
    audience: 'both',
    aiMetadata: { description: 'Send a text prompt to the connected Raia AI agent and get its response. Use to query or instruct the agent inline within a flow. Not idempotent: each call creates a new prompt/conversation turn on the agent.', idempotent: false },
    auth: raiaAiAuth,
    props: {
        prompt: Property.LongText({
            displayName: 'Prompt',
            required: true
        })
    },
    async run(context) {
        const response = await httpClient.sendRequest({
            method: HttpMethod.POST,
            url: BASE_URL + '/prompts',
            headers: {
                'Agent-Secret-Key': context.auth.secret_text,
                'Content-Type': 'application/json'
            },
            body: { prompt: context.propsValue.prompt }
        })

        return response.body
    }
})