Agent Runtime
Installation

Bring-your-own Large Language Models (LLMs) and Tool access

Agent Runtime provides access to model providers and tools out-of-the-box.

To use your own model provider, pass your API key to the applicable model provider.

export const agent = createAgent({
  goal,
  model: anthropic("claude-3-5-sonnet-latest", { apiKey }),
});

To use a custom provider or your own service, define a ModelClient type.

const customModelClient: ModelClient = {
  type: "MyCustomClient",
  modelId: "my-model-id",
  invoke: async (input) => await myImplementation(input),
};
 
export const agent = createAgent({
  goal,
  model: customModelClient,
});