Port API AI icon

Port API AI

Invoke Port AI agents, call general AI interactions, and fetch invocation results

Actions3

AI Interaction → Invoke

AI-generated

Summary

Invokes a general-purpose AI interaction via the Port API, optionally managing approval workflows.

Inputs

  • userPrompt (required) — The text prompt to send to the AI interaction.
  • tools (required) — Array of tool names as a JSON string (supports regex patterns).
  • executionMode — Optional execution mode: 'Automatic' or 'Approval Required'.
  • invocation_identifier — Optional invocation identifier for tracking.
  • labels — Optional labels object as JSON.
  • model — Optional AI model: 'gpt-5', 'claude-sonnet-4-20250514', or 'claude-haiku-4-5-20251001'.
  • provider — Optional provider: 'anthropic', 'azure-openai', 'bedrock', 'openai', or 'port'.
  • systemPrompt — Optional system prompt to guide the AI's behavior.

Output shape

An object containing invocationIdentifier, events, executionMessages, finalData, executionMessage, and data.

The response is parsed from Server-Sent Events (SSE). If the Tools field is not a valid JSON array, an error is thrown.

Examples

Example 1: Invoke an AI interaction with approval required

User Prompt: 'Analyze the user permissions', Tools: ['^(list|get|search|track|describe|count|run_*)_.*'], Execution Mode: 'Approval Required'

Example 2: Invoke an AI interaction using a regex for tool matching

User Prompt: 'Summarize recent tasks', Tools: '["^(list|get|search|track|describe|count|run_*)_.*"]', Model: 'claude-sonnet-4-20250514', Provider: 'anthropic'

Links

Discussion