CREATE AGENT Statement in Confluent Cloud

Confluent Intelligence enables creating Streaming Agents using declarative SQL syntax. Agents can reason over streaming data, invoke tools, and produce structured outputs.

Syntax

CREATE AGENT [IF NOT EXISTS] [catalog.][database.]agent_name
  USING MODEL <model_identifier>
  USING PROMPT <prompt_string>
  USING TOOLS <tool1>, <tool2>
  [COMMENT <comment_string>]
  WITH (<option_list>)

Description

Create a new Streaming Agent that can process streaming data using LLM reasoning and tool invocation capabilities. The agent uses a specified model, prompt, and optional tools to process input data.

Parameters

  • model_identifier (STRING): Reference to a registered model
  • prompt_string (STRING): System prompt for the agent
  • tool1, tool2 (STRING): Comma-separated list of tool names
  • comment_string (STRING): Optional comment describing the agent

Agent Options

  • max_consecutive_failures: Maximum consecutive failures (Optional, default: 3)
  • max_iterations: Maximum loop iterations (Optional, default: 10)

Examples

Basic agent

CREATE AGENT weather_agent
  USING MODEL openai
  USING PROMPT 'Find weather info for provided city'
  USING TOOLS mcp_server, get_weather_tool
  WITH (
    'max_iterations' = '5'
  );

Complete example

-- Create MCP server connection
CREATE CONNECTION mcp_connection
WITH (
  'type' = 'mcp_server',
  'api-key' = '<your-api-key>',
  'endpoint' = 'https://mcp.example.com',

);

-- Create tools
CREATE TOOL mcp_server
USING CONNECTION mcp_connection
WITH (
  'type' = 'mcp_server',
  'allowed_tools' = 'tool1,tool2',
  'request_timeout' = '30'
);

-- Register a function.
CREATE FUNCTION convert_to_celsius
USING JAR 'celsius.jar'
COMMENT 'function to convert degree to celsius';

-- Create a tool based on the function.
CREATE TOOL convert_to_celsius_tool
USING FUNCTION convert_to_celsius
WITH (
  'type' = 'function',
  'description' = 'This function can be used by model to convert degree to celsius'
);

-- Create a connection to the model provider.
CREATE CONNECTION openai_connection
WITH (
  'type' = 'openai',
  'endpoint' = 'https://api.openai.com/v1/chat/completions',
  'api-key' = 'your-openai-key'
);

-- Register a remote model.
CREATE MODEL openai
INPUT(text STRING)
OUTPUT (res STRING)
WITH (
  'provider' = 'openai',
  'openai.model' = 'gpt-4o',
  'openai.connection' = 'openai_connection'
);

-- Create an agent that uses the model and tools.
CREATE AGENT weather_agent
USING MODEL openai
USING PROMPT 'Find weather info for provided city'
USING TOOLS mcp_server, convert_to_celsius_tool;