Skip to content

Agents

Overview

Create and manage reusable agent definitions.

Available Operations

listAgents

List agents

Example Usage

typescript
import { SDK } from "@meetkai/mka1";

const sdk = new SDK();

async function run() {
  const result = await sdk.agents.listAgents({
    bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
  }, {});

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

typescript
import { SDKCore } from "@meetkai/mka1/core.js";
import { agentsListAgents } from "@meetkai/mka1/funcs/agentsListAgents.js";

// Use `SDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const sdk = new SDKCore();

async function run() {
  const res = await agentsListAgents(sdk, {
    bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
  }, {});
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("agentsListAgents failed:", res.error);
  }
}

run();

React hooks and utilities

This method can be used in React components through the following hooks and associated utilities.

Check out this guide for information about each of the utilities below and how to get started using React hooks.

tsx
import {
  // Query hooks for fetching data.
  useAgentsListAgents,
  useAgentsListAgentsSuspense,

  // Utility for prefetching data during server-side rendering and in React
  // Server Components that will be immediately available to client components
  // using the hooks.
  prefetchAgentsListAgents,
  
  // Utilities to invalidate the query cache for this query in response to
  // mutations and other user actions.
  invalidateAgentsListAgents,
  invalidateAllAgentsListAgents,
} from "@meetkai/mka1/react-query/agentsListAgents.js";

Parameters

ParameterTypeRequiredDescription
requestoperations.ListAgentsRequest✔️The request object to use for the request.
securityoperations.ListAgentsSecurity✔️The security requirements to use for the request.
optionsRequestOptionsUsed to set various options for making HTTP requests.
options.fetchOptionsRequestInitOptions that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retriesRetryConfigEnables retrying HTTP requests under certain failure conditions.

Response

Promise<components.AgentList>

Errors

Error TypeStatus CodeContent Type
errors.ErrorEnvelope401application/json
errors.APIError4XX, 5XX*/*

createAgent

Create an agent

Example Usage

typescript
import { SDK } from "@meetkai/mka1";

const sdk = new SDK();

async function run() {
  const result = await sdk.agents.createAgent({
    bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
  }, {
    createAgentRequest: {
      name: "release-research-agent",
      description: "Looks up current release information before answering.",
      model: "functionary-pt",
      instructions: "Use web search when the question depends on current external information.",
      tools: [
        {
          type: "web_search",
          searchContextSize: "medium",
        },
      ],
      toolChoice: "auto",
    },
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

typescript
import { SDKCore } from "@meetkai/mka1/core.js";
import { agentsCreateAgent } from "@meetkai/mka1/funcs/agentsCreateAgent.js";

// Use `SDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const sdk = new SDKCore();

async function run() {
  const res = await agentsCreateAgent(sdk, {
    bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
  }, {
    createAgentRequest: {
      name: "release-research-agent",
      description: "Looks up current release information before answering.",
      model: "functionary-pt",
      instructions: "Use web search when the question depends on current external information.",
      tools: [
        {
          type: "web_search",
          searchContextSize: "medium",
        },
      ],
      toolChoice: "auto",
    },
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("agentsCreateAgent failed:", res.error);
  }
}

run();

React hooks and utilities

This method can be used in React components through the following hooks and associated utilities.

Check out this guide for information about each of the utilities below and how to get started using React hooks.

tsx
import {
  // Mutation hook for triggering the API call.
  useAgentsCreateAgentMutation
} from "@meetkai/mka1/react-query/agentsCreateAgent.js";

Parameters

ParameterTypeRequiredDescription
requestoperations.CreateAgentRequest✔️The request object to use for the request.
securityoperations.CreateAgentSecurity✔️The security requirements to use for the request.
optionsRequestOptionsUsed to set various options for making HTTP requests.
options.fetchOptionsRequestInitOptions that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retriesRetryConfigEnables retrying HTTP requests under certain failure conditions.

Response

Promise<components.Agent>

Errors

Error TypeStatus CodeContent Type
errors.ErrorEnvelope400, 401application/json
errors.APIError4XX, 5XX*/*

getAgent

Retrieve an agent

Example Usage

typescript
import { SDK } from "@meetkai/mka1";

const sdk = new SDK();

async function run() {
  const result = await sdk.agents.getAgent({
    bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
  }, {
    agentId: "<id>",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

typescript
import { SDKCore } from "@meetkai/mka1/core.js";
import { agentsGetAgent } from "@meetkai/mka1/funcs/agentsGetAgent.js";

// Use `SDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const sdk = new SDKCore();

async function run() {
  const res = await agentsGetAgent(sdk, {
    bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
  }, {
    agentId: "<id>",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("agentsGetAgent failed:", res.error);
  }
}

run();

React hooks and utilities

This method can be used in React components through the following hooks and associated utilities.

Check out this guide for information about each of the utilities below and how to get started using React hooks.

tsx
import {
  // Query hooks for fetching data.
  useAgentsGetAgent,
  useAgentsGetAgentSuspense,

  // Utility for prefetching data during server-side rendering and in React
  // Server Components that will be immediately available to client components
  // using the hooks.
  prefetchAgentsGetAgent,
  
  // Utilities to invalidate the query cache for this query in response to
  // mutations and other user actions.
  invalidateAgentsGetAgent,
  invalidateAllAgentsGetAgent,
} from "@meetkai/mka1/react-query/agentsGetAgent.js";

Parameters

ParameterTypeRequiredDescription
requestoperations.GetAgentRequest✔️The request object to use for the request.
securityoperations.GetAgentSecurity✔️The security requirements to use for the request.
optionsRequestOptionsUsed to set various options for making HTTP requests.
options.fetchOptionsRequestInitOptions that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retriesRetryConfigEnables retrying HTTP requests under certain failure conditions.

Response

Promise<components.Agent>

Errors

Error TypeStatus CodeContent Type
errors.ErrorEnvelope401, 404application/json
errors.APIError4XX, 5XX*/*

updateAgent

Update an agent

Example Usage

typescript
import { SDK } from "@meetkai/mka1";

const sdk = new SDK();

async function run() {
  const result = await sdk.agents.updateAgent({
    bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
  }, {
    agentId: "<id>",
    updateAgentRequest: {
      model: "functionary-pt",
    },
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

typescript
import { SDKCore } from "@meetkai/mka1/core.js";
import { agentsUpdateAgent } from "@meetkai/mka1/funcs/agentsUpdateAgent.js";

// Use `SDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const sdk = new SDKCore();

async function run() {
  const res = await agentsUpdateAgent(sdk, {
    bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
  }, {
    agentId: "<id>",
    updateAgentRequest: {
      model: "functionary-pt",
    },
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("agentsUpdateAgent failed:", res.error);
  }
}

run();

React hooks and utilities

This method can be used in React components through the following hooks and associated utilities.

Check out this guide for information about each of the utilities below and how to get started using React hooks.

tsx
import {
  // Mutation hook for triggering the API call.
  useAgentsUpdateAgentMutation
} from "@meetkai/mka1/react-query/agentsUpdateAgent.js";

Parameters

ParameterTypeRequiredDescription
requestoperations.UpdateAgentRequest✔️The request object to use for the request.
securityoperations.UpdateAgentSecurity✔️The security requirements to use for the request.
optionsRequestOptionsUsed to set various options for making HTTP requests.
options.fetchOptionsRequestInitOptions that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retriesRetryConfigEnables retrying HTTP requests under certain failure conditions.

Response

Promise<components.Agent>

Errors

Error TypeStatus CodeContent Type
errors.ErrorEnvelope400, 401, 404application/json
errors.APIError4XX, 5XX*/*

deleteAgent

Delete an agent

Example Usage

typescript
import { SDK } from "@meetkai/mka1";

const sdk = new SDK();

async function run() {
  const result = await sdk.agents.deleteAgent({
    bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
  }, {
    agentId: "<id>",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

typescript
import { SDKCore } from "@meetkai/mka1/core.js";
import { agentsDeleteAgent } from "@meetkai/mka1/funcs/agentsDeleteAgent.js";

// Use `SDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const sdk = new SDKCore();

async function run() {
  const res = await agentsDeleteAgent(sdk, {
    bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
  }, {
    agentId: "<id>",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("agentsDeleteAgent failed:", res.error);
  }
}

run();

React hooks and utilities

This method can be used in React components through the following hooks and associated utilities.

Check out this guide for information about each of the utilities below and how to get started using React hooks.

tsx
import {
  // Mutation hook for triggering the API call.
  useAgentsDeleteAgentMutation
} from "@meetkai/mka1/react-query/agentsDeleteAgent.js";

Parameters

ParameterTypeRequiredDescription
requestoperations.DeleteAgentRequest✔️The request object to use for the request.
securityoperations.DeleteAgentSecurity✔️The security requirements to use for the request.
optionsRequestOptionsUsed to set various options for making HTTP requests.
options.fetchOptionsRequestInitOptions that are passed to the underlying HTTP request. This can be used to inject extra headers for examples. All Request options, except method and body, are allowed.
options.retriesRetryConfigEnables retrying HTTP requests under certain failure conditions.

Response

Promise<operations.DeleteAgentResponseBody>

Errors

Error TypeStatus CodeContent Type
errors.ErrorEnvelope401, 404application/json
errors.APIError4XX, 5XX*/*