Agents
Overview
Create and manage reusable agent definitions.
Available Operations
- listAgents - List agents
- createAgent - Create an agent
- getAgent - Retrieve an agent
- updateAgent - Update an agent
- deleteAgent - Delete an agent
listAgents
List agents
Example Usage
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:
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.
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
| Parameter | Type | Required | Description |
|---|---|---|---|
request | operations.ListAgentsRequest | ✔️ | The request object to use for the request. |
security | operations.ListAgentsSecurity | ✔️ | 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.AgentList>
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.ErrorEnvelope | 401 | application/json |
| errors.APIError | 4XX, 5XX | */* |
createAgent
Create an agent
Example Usage
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:
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.
import {
// Mutation hook for triggering the API call.
useAgentsCreateAgentMutation
} from "@meetkai/mka1/react-query/agentsCreateAgent.js";Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request | operations.CreateAgentRequest | ✔️ | The request object to use for the request. |
security | operations.CreateAgentSecurity | ✔️ | 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.Agent>
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.ErrorEnvelope | 400, 401 | application/json |
| errors.APIError | 4XX, 5XX | */* |
getAgent
Retrieve an agent
Example Usage
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:
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.
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
| Parameter | Type | Required | Description |
|---|---|---|---|
request | operations.GetAgentRequest | ✔️ | The request object to use for the request. |
security | operations.GetAgentSecurity | ✔️ | 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.Agent>
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.ErrorEnvelope | 401, 404 | application/json |
| errors.APIError | 4XX, 5XX | */* |
updateAgent
Update an agent
Example Usage
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:
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.
import {
// Mutation hook for triggering the API call.
useAgentsUpdateAgentMutation
} from "@meetkai/mka1/react-query/agentsUpdateAgent.js";Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request | operations.UpdateAgentRequest | ✔️ | The request object to use for the request. |
security | operations.UpdateAgentSecurity | ✔️ | 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.Agent>
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.ErrorEnvelope | 400, 401, 404 | application/json |
| errors.APIError | 4XX, 5XX | */* |
deleteAgent
Delete an agent
Example Usage
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:
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.
import {
// Mutation hook for triggering the API call.
useAgentsDeleteAgentMutation
} from "@meetkai/mka1/react-query/agentsDeleteAgent.js";Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
request | operations.DeleteAgentRequest | ✔️ | The request object to use for the request. |
security | operations.DeleteAgentSecurity | ✔️ | 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<operations.DeleteAgentResponseBody>
Errors
| Error Type | Status Code | Content Type |
|---|---|---|
| errors.ErrorEnvelope | 401, 404 | application/json |
| errors.APIError | 4XX, 5XX | */* |