#Direct to LLM version update: Unknown Provider

1 messages · Page 1 of 1 (latest)

stark siren
#

I have a direct to LLM connection to Bedrock and I'm trying to update our working version of this project to 1.5. We have no langraph agents, we've been managing our agent code primarily using the frontend options from the eariler version of the project.

I've tried this using the built in bedrock adaptor, and a custom bedrock adaptor, and I run into some version of the same error (this example is using the build in bedrock adapter):

Agent execution failed: Error: Unknown provider "bedrock" in "bedrock/amazon.nova-lite-v1:0". Supported: openai, anthropic, google (gemini).

Which I can trace back to:

  In @copilotkit/runtime/src/lib/runtime/copilot-runtime.ts:384:
  if (isAgentsListEmpty) {
    agentsList.default = new BuiltInAgent({
      model: `${serviceAdapter.provider}/${serviceAdapter.model}`,
    });
  }

It seems to be instantiating a basic agent, since I don't have any configured, but it seems that to configure one I'd need to use one of the above providers directly. Can I bypass this or do we need to stand up a langraph agent? Is there any direct to LLM support outside of these clients? I've tried to use the delegateAgentProcessingToServiceAdapter: true flag I found, but it hasn't made a difference.

halcyon reefBOT
#

This solution has been AI generated

The error happens because v1.5 auto-creates a BuiltInAgent when no agents are defined, and that resolver only recognizes openai, anthropic, and google model prefixes. Your Bedrock adapter ends up as bedrock/..., which the BuiltInAgent rejects. You don't need to stand up a LangGraph agent—just prevent auto-agent creation and delegate to your Bedrock adapter.

Why this happens

When agents is empty, the runtime does:

agentsList.default = new BuiltInAgent({
  model: `${serviceAdapter.provider}/${serviceAdapter.model}` // -> "bedrock/amazon.nova-lite-v1:0"
});

BuiltInAgent doesn't recognize bedrock, so it throws "Unknown provider bedrock".

Fix: Define a dummy agent and delegate to the adapter

Provide any valid BuiltInAgent (using a supported provider string) to satisfy the empty-agents check, and enable delegation so your Bedrock adapter handles processing.

import { CopilotRuntime, BedrockAdapter } from "@copilotkit/runtime";
import { BuiltInAgent } from "@copilotkit/runtime/v2";

const runtime = new CopilotRuntime({
  // 1) Avoid auto-creation by defining a default agent
  agents: {
    default: new BuiltInAgent({
      // Any supported provider string works here; it's a placeholder
      model: "openai/gpt-4o-mini",
    }),
  },
  // 2) Ensure requests delegate to your service adapter (v1.x-style direct LLM)
  delegateAgentProcessingToServiceAdapter: true,
});

export const handler = (req: Request) =>
  runtime.handleRequest(req, {
    serviceAdapter: new BedrockAdapter({
      model: "amazon.nova-lite-v1:0",
      // ...credentials/config
    }),
  });

Notes

  • This bypasses the BuiltInAgent model resolution for Bedrock while still giving you direct-to-LLM via your adapter.
  • Using the built-in or a custom Bedrock adapter both work with this approach.
#

Was this helpful?

If this solution worked for you, please click on the appropriate option below to help us improve:

#

Thank you for your feedback! Our team will provide additional assistance. 🔄

stark siren
halcyon reefBOT
#

Hey! I've shared this with the team to investigate – they'll be able to look into what's going on with the v1.5 upgrade and Bedrock support.
In the meantime, I found something that might be worth trying. Try passing the adapter directly to the handler instead of the runtime constructor, and skip the agents config entirely:

import { CopilotRuntime, BedrockAdapter } from "@copilotkit/runtime";
import { copilotRuntimeNextJSAppRouterEndpoint } from "@copilotkit/runtime/nextjs";

const runtime = new CopilotRuntime(); // Keep empty

export const POST = async (req: Request) => {
  const serviceAdapter = new BedrockAdapter({
    model: "amazon.nova-lite-v1:0",
    // region, credentials, etc.
  });

  const { handleRequest } = copilotRuntimeNextJSAppRouterEndpoint({
    runtime,
    serviceAdapter, 
    endpoint: "/api/copilotkit",
  });

  return handleRequest(req);
};

This might work because passing serviceAdapter directly should use Bedrock for processing before hitting the fallback logic that triggers the "unknown provider" error, and not defining a BuiltInAgent means the runtime won't look for OpenAI credentials.
Would you mind giving this a try while we wait to hear back from the team? Let me know how it goes!

stark siren
#

No luck with this - it still tries to stand up the agent and hits validation errors on the provider