Skip to content

AgentSchedules

Overview

Create and manage scheduled or recurring saved agent runs.

Available Operations

listAgentSchedules

List schedules for an agent

Example Usage

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

const sdk = new SDK({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await sdk.agentSchedules.listAgentSchedules({
    agentId: "<id>",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

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

// Use `SDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const sdk = new SDKCore({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const res = await agentSchedulesListAgentSchedules(sdk, {
    agentId: "<id>",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("agentSchedulesListAgentSchedules 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.
  useAgentSchedulesListAgentSchedules,
  useAgentSchedulesListAgentSchedulesSuspense,

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

Parameters

ParameterTypeRequiredDescription
requestoperations.ListAgentSchedulesRequest✔️The request object 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.AgentScheduleList>

Errors

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

createAgentSchedule

Creates a Temporal-backed one-time, interval, or cron schedule that starts normal saved agent runs.

Example Usage

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

const sdk = new SDK({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await sdk.agentSchedules.createAgentSchedule({
    agentId: "<id>",
    createAgentScheduleRequest: {
      schedule: {
        type: "interval",
        intervalSeconds: 581769,
        timezone: "UTC",
      },
      input: [],
    },
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

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

// Use `SDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const sdk = new SDKCore({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const res = await agentSchedulesCreateAgentSchedule(sdk, {
    agentId: "<id>",
    createAgentScheduleRequest: {
      schedule: {
        type: "interval",
        intervalSeconds: 581769,
        timezone: "UTC",
      },
      input: [],
    },
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("agentSchedulesCreateAgentSchedule 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.
  useAgentSchedulesCreateAgentScheduleMutation
} from "@meetkai/mka1/react-query/agentSchedulesCreateAgentSchedule.js";

Parameters

ParameterTypeRequiredDescription
requestoperations.CreateAgentScheduleRequest✔️The request object 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.AgentSchedule>

Errors

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

getAgentSchedule

Retrieve an agent schedule

Example Usage

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

const sdk = new SDK({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await sdk.agentSchedules.getAgentSchedule({
    agentId: "<id>",
    scheduleId: "<id>",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

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

// Use `SDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const sdk = new SDKCore({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const res = await agentSchedulesGetAgentSchedule(sdk, {
    agentId: "<id>",
    scheduleId: "<id>",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("agentSchedulesGetAgentSchedule 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.
  useAgentSchedulesGetAgentSchedule,
  useAgentSchedulesGetAgentScheduleSuspense,

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

Parameters

ParameterTypeRequiredDescription
requestoperations.GetAgentScheduleRequest✔️The request object 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.AgentSchedule>

Errors

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

updateAgentSchedule

Update an agent schedule

Example Usage

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

const sdk = new SDK({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await sdk.agentSchedules.updateAgentSchedule({
    agentId: "<id>",
    scheduleId: "<id>",
    updateAgentScheduleRequest: {},
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

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

// Use `SDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const sdk = new SDKCore({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const res = await agentSchedulesUpdateAgentSchedule(sdk, {
    agentId: "<id>",
    scheduleId: "<id>",
    updateAgentScheduleRequest: {},
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("agentSchedulesUpdateAgentSchedule 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.
  useAgentSchedulesUpdateAgentScheduleMutation
} from "@meetkai/mka1/react-query/agentSchedulesUpdateAgentSchedule.js";

Parameters

ParameterTypeRequiredDescription
requestoperations.UpdateAgentScheduleRequest✔️The request object 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.AgentSchedule>

Errors

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

deleteAgentSchedule

Delete an agent schedule

Example Usage

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

const sdk = new SDK({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await sdk.agentSchedules.deleteAgentSchedule({
    agentId: "<id>",
    scheduleId: "<id>",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

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

// Use `SDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const sdk = new SDKCore({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const res = await agentSchedulesDeleteAgentSchedule(sdk, {
    agentId: "<id>",
    scheduleId: "<id>",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("agentSchedulesDeleteAgentSchedule 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.
  useAgentSchedulesDeleteAgentScheduleMutation
} from "@meetkai/mka1/react-query/agentSchedulesDeleteAgentSchedule.js";

Parameters

ParameterTypeRequiredDescription
requestoperations.DeleteAgentScheduleRequest✔️The request object 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.DeleteAgentScheduleResponseBody>

Errors

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

pauseAgentSchedule

Pause an agent schedule

Example Usage

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

const sdk = new SDK({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await sdk.agentSchedules.pauseAgentSchedule({
    agentId: "<id>",
    scheduleId: "<id>",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

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

// Use `SDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const sdk = new SDKCore({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const res = await agentSchedulesPauseAgentSchedule(sdk, {
    agentId: "<id>",
    scheduleId: "<id>",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("agentSchedulesPauseAgentSchedule 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.
  useAgentSchedulesPauseAgentScheduleMutation
} from "@meetkai/mka1/react-query/agentSchedulesPauseAgentSchedule.js";

Parameters

ParameterTypeRequiredDescription
requestoperations.PauseAgentScheduleRequest✔️The request object 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.AgentSchedule>

Errors

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

resumeAgentSchedule

Resume an agent schedule

Example Usage

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

const sdk = new SDK({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const result = await sdk.agentSchedules.resumeAgentSchedule({
    agentId: "<id>",
    scheduleId: "<id>",
  });

  console.log(result);
}

run();

Standalone function

The standalone function version of this method:

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

// Use `SDKCore` for best tree-shaking performance.
// You can create one instance of it to use across an application.
const sdk = new SDKCore({
  bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
});

async function run() {
  const res = await agentSchedulesResumeAgentSchedule(sdk, {
    agentId: "<id>",
    scheduleId: "<id>",
  });
  if (res.ok) {
    const { value: result } = res;
    console.log(result);
  } else {
    console.log("agentSchedulesResumeAgentSchedule 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.
  useAgentSchedulesResumeAgentScheduleMutation
} from "@meetkai/mka1/react-query/agentSchedulesResumeAgentSchedule.js";

Parameters

ParameterTypeRequiredDescription
requestoperations.ResumeAgentScheduleRequest✔️The request object 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.AgentSchedule>

Errors

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