Gleanex.Client.Agents (Gleanex v0.1.0)

Copy Markdown View Source

Provides API endpoints related to agents

Summary

Functions

Create an agent run and stream the response

Create an agent run and wait for the response

List an agent's schemas

Functions

create_agent(body, opts \\ [])

@spec create_agent(
  body :: Gleanex.Client.CreateWorkflowRequest.t(),
  opts :: keyword()
) ::
  {:ok, Gleanex.Client.CreateWorkflowResponse.t()} | {:error, Gleanex.Error.t()}

Create an agent

Create an agent.

Options

  • locale: The client's preferred locale in rfc5646 format (e.g. en, ja, pt-BR). If omitted, the Accept-Language will be used. If not present or not supported, defaults to the closest match or en.
  • timezoneOffset: The offset of the client's timezone in minutes from UTC. e.g. PDT is -420 because it's 7 hours behind UTC.

Request Body

Content Types: application/json

create_and_stream_run(body, opts \\ [])

@spec create_and_stream_run(
  body :: Gleanex.Client.AgentRunCreate.t(),
  opts :: keyword()
) ::
  {:ok, String.t()} | {:error, Gleanex.Error.t()}

Create an agent run and stream the response

Executes an agent run and returns the result as a stream of server-sent events (SSE). Note: If the agent uses an input form trigger, all form fields (including optional fields) must be included in the input object.

Request Body

Content Types: application/json

create_and_wait_run(body, opts \\ [])

@spec create_and_wait_run(
  body :: Gleanex.Client.AgentRunCreate.t(),
  opts :: keyword()
) ::
  {:ok, Gleanex.Client.AgentRunWaitResponse.t()} | {:error, Gleanex.Error.t()}

Create an agent run and wait for the response

Executes an agent run and returns the final response. Note: If the agent uses an input form trigger, all form fields (including optional fields) must be included in the input object.

Request Body

Content Types: application/json

edit_agent(agent_id, body, opts \\ [])

@spec edit_agent(
  agent_id :: String.t(),
  body :: Gleanex.Client.EditWorkflowRequest.t(),
  opts :: keyword()
) :: :ok | {:error, Gleanex.Error.t()}

Edit an agent

Creates a draft or publishes an agent. Use isDraft=true to save a draft, or isDraft=false (or omit) to publish immediately. Only draft and publish modes are supported.

Options

  • locale: The client's preferred locale in rfc5646 format (e.g. en, ja, pt-BR). If omitted, the Accept-Language will be used. If not present or not supported, defaults to the closest match or en.
  • timezoneOffset: The offset of the client's timezone in minutes from UTC. e.g. PDT is -420 because it's 7 hours behind UTC.

Request Body

Content Types: application/json

get_agent(agent_id, opts \\ [])

@spec get_agent(agent_id :: String.t(), opts :: keyword()) ::
  {:ok, Gleanex.Client.Agent.t()} | {:error, Gleanex.Error.t()}

Retrieve an agent

Returns details of an agent created in the Agent Builder.

Options

  • locale: The client's preferred locale in rfc5646 format (e.g. en, ja, pt-BR). If omitted, the Accept-Language will be used. If not present or not supported, defaults to the closest match or en.
  • timezoneOffset: The offset of the client's timezone in minutes from UTC. e.g. PDT is -420 because it's 7 hours behind UTC.

get_agent_schemas(agent_id, opts \\ [])

@spec get_agent_schemas(agent_id :: String.t(), opts :: keyword()) ::
  {:ok, Gleanex.Client.AgentSchemas.t()} | {:error, Gleanex.Error.t()}

List an agent's schemas

Return agent's input and output schemas. You can use these schemas to detect changes to an agent's input or output structure.

Options

  • locale: The client's preferred locale in rfc5646 format (e.g. en, ja, pt-BR). If omitted, the Accept-Language will be used. If not present or not supported, defaults to the closest match or en.
  • timezoneOffset: The offset of the client's timezone in minutes from UTC. e.g. PDT is -420 because it's 7 hours behind UTC.

import_agent(agent_id, body, opts \\ [])

@spec import_agent(
  agent_id :: String.t(),
  body :: Gleanex.Client.ImportAgentRequest.t(),
  opts :: keyword()
) :: {:ok, Gleanex.Client.ImportAgentResponse.t()} | {:error, Gleanex.Error.t()}

Import an agent

Imports an agent from its on-disk folder representation (spec.yaml, instructions.md, skills/, subagents/) packaged as a zip, and creates or updates the agent. Inverse of the export flow: the folder-to-schema conversion runs server-side. The bundle must contain only regular files; symlinks are resolved by the caller at packaging time.

Options

  • locale: The client's preferred locale in rfc5646 format (e.g. en, ja, pt-BR). If omitted, the Accept-Language will be used. If not present or not supported, defaults to the closest match or en.
  • timezoneOffset: The offset of the client's timezone in minutes from UTC. e.g. PDT is -420 because it's 7 hours behind UTC.

Request Body

Content Types: multipart/form-data

search_agents(body, opts \\ [])

@spec search_agents(body :: Gleanex.Client.SearchAgentsRequest.t(), opts :: keyword()) ::
  {:ok, Gleanex.Client.SearchAgentsResponse.t()} | {:error, Gleanex.Error.t()}

Search agents

Search for agents by agent name.

Request Body

Content Types: application/json