AgentRuns
Overview
Execute saved agents and inspect persisted run results.
Available Operations
- listAgentRuns - List runs for an agent
- createAgentRun - Execute a saved agent
- getAgentRun - Retrieve an agent run
listAgentRuns
List runs for an agent
Example Usage
import { SDK } from "@meetkai/mka1";
const sdk = new SDK();
async function run() {
const result = await sdk.agentRuns.listAgentRuns({
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
}, {
agentId: "<id>",
});
console.log(result);
}
run();Standalone function
The standalone function version of this method:
import { SDKCore } from "@meetkai/mka1/core.js";
import { agentRunsListAgentRuns } from "@meetkai/mka1/funcs/agentRunsListAgentRuns.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 agentRunsListAgentRuns(sdk, {
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
}, {
agentId: "<id>",
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("agentRunsListAgentRuns 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.
import {
// Query hooks for fetching data.
useAgentRunsListAgentRuns,
useAgentRunsListAgentRunsSuspense,
// Utility for prefetching data during server-side rendering and in React
// Server Components that will be immediately available to client components
// using the hooks.
prefetchAgentRunsListAgentRuns,
// Utilities to invalidate the query cache for this query in response to
// mutations and other user actions.
invalidateAgentRunsListAgentRuns,
invalidateAllAgentRunsListAgentRuns,
} from "@meetkai/mka1/react-query/agentRunsListAgentRuns.js";Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request | operations.ListAgentRunsRequest | ✔️ | The request object to use for the request. |
security | operations.ListAgentRunsSecurity | ✔️ | The security requirements to use for the request. |
options | RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions | RequestInit | ➖ | Options 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.retries | RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Response
Promise<components.AgentRunList>
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.ErrorEnvelope | 401, 404 | application/json |
| errors.APIError | 4XX, 5XX | */* |
createAgentRun
Execute a saved agent
Example Usage
import { SDK } from "@meetkai/mka1";
const sdk = new SDK();
async function run() {
const result = await sdk.agentRuns.createAgentRun({
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
}, {
agentId: "<id>",
createAgentRunRequest: {
input: [
{
type: "<value>",
},
],
},
});
console.log(result);
}
run();Standalone function
The standalone function version of this method:
import { SDKCore } from "@meetkai/mka1/core.js";
import { agentRunsCreateAgentRun } from "@meetkai/mka1/funcs/agentRunsCreateAgentRun.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 agentRunsCreateAgentRun(sdk, {
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
}, {
agentId: "<id>",
createAgentRunRequest: {
input: [
{
type: "<value>",
},
],
},
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("agentRunsCreateAgentRun 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.
import {
// Mutation hook for triggering the API call.
useAgentRunsCreateAgentRunMutation
} from "@meetkai/mka1/react-query/agentRunsCreateAgentRun.js";Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request | operations.CreateAgentRunRequest | ✔️ | The request object to use for the request. |
security | operations.CreateAgentRunSecurity | ✔️ | The security requirements to use for the request. |
options | RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions | RequestInit | ➖ | Options 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.retries | RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Response
Promise<components.AgentRun>
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.ErrorEnvelope | 400, 401, 404 | application/json |
| errors.ErrorEnvelope | 502 | application/json |
| errors.APIError | 4XX, 5XX | */* |
getAgentRun
Retrieve an agent run
Example Usage
import { SDK } from "@meetkai/mka1";
const sdk = new SDK();
async function run() {
const result = await sdk.agentRuns.getAgentRun({
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
}, {
agentId: "<id>",
runId: "<id>",
});
console.log(result);
}
run();Standalone function
The standalone function version of this method:
import { SDKCore } from "@meetkai/mka1/core.js";
import { agentRunsGetAgentRun } from "@meetkai/mka1/funcs/agentRunsGetAgentRun.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 agentRunsGetAgentRun(sdk, {
bearerAuth: "<YOUR_BEARER_TOKEN_HERE>",
}, {
agentId: "<id>",
runId: "<id>",
});
if (res.ok) {
const { value: result } = res;
console.log(result);
} else {
console.log("agentRunsGetAgentRun 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.
import {
// Query hooks for fetching data.
useAgentRunsGetAgentRun,
useAgentRunsGetAgentRunSuspense,
// Utility for prefetching data during server-side rendering and in React
// Server Components that will be immediately available to client components
// using the hooks.
prefetchAgentRunsGetAgentRun,
// Utilities to invalidate the query cache for this query in response to
// mutations and other user actions.
invalidateAgentRunsGetAgentRun,
invalidateAllAgentRunsGetAgentRun,
} from "@meetkai/mka1/react-query/agentRunsGetAgentRun.js";Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request | operations.GetAgentRunRequest | ✔️ | The request object to use for the request. |
security | operations.GetAgentRunSecurity | ✔️ | The security requirements to use for the request. |
options | RequestOptions | ➖ | Used to set various options for making HTTP requests. |
options.fetchOptions | RequestInit | ➖ | Options 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.retries | RetryConfig | ➖ | Enables retrying HTTP requests under certain failure conditions. |
Response
Promise<components.AgentRun>
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.ErrorEnvelope | 401, 404 | application/json |
| errors.APIError | 4XX, 5XX | */* |