Commit Graph

4207 Commits

Author SHA1 Message Date
Mike Ryan 043a447ef6 feat: Prove out a WebSocket agent runner pattern 2026-02-26 17:14:00 -08:00
Jordan Ritter a3fbf467aa feat: add selfManagedAgents prop to React and Angular providers (#3285)
## What does this PR do?

Add `selfManagedAgents` prop.

## Related PRs and Issues

- https://copilotkit.slack.com/archives/C075NF9SN01/p1771967940173989
2026-02-26 18:55:49 -04:00
Jordan Ritter 3f1259d060 fix: propagate custom provider config from service adapters to BuiltInAgent (#3283)
Fixes #2903

## The Bug

Azure OpenAI users get `AI_LoadAPIKeyError: OpenAI API key is missing`
despite passing a properly configured `OpenAI` instance to
`OpenAIAdapter`, exactly as shown in the docs.

**Root cause**: `CopilotRuntime.handleServiceAdapter()` discards the
adapter's configured OpenAI instance and constructs a plain string
`"openai/gpt-4o"` to pass to `BuiltInAgent`. The agent's
`resolveModel()` then creates a *brand new* OpenAI provider using only
`OPENAI_API_KEY`, losing all Azure configuration (baseURL, api-key
header, api-version query param).

The V1 adapter's `process()` method — which correctly uses the custom
OpenAI instance — is dead code. It's never called. Only `.provider` and
`.model` strings are extracted.

```
User configures Azure OpenAI instance →
  OpenAIAdapter stores it →
    CopilotRuntime extracts only "openai"/"gpt-4o" strings →
      BuiltInAgent.resolveModel("openai/gpt-4o") →
        createOpenAI({ apiKey: OPENAI_API_KEY }) →
          💥 API key missing / wrong endpoint
```

## Workaround

Until this is merged, users can bypass the broken adapter entirely by
using `BuiltInAgent` directly with the Vercel AI SDK Azure provider:

```typescript
import { createAzure } from "@ai-sdk/azure";
import { CopilotRuntime, copilotRuntimeNodeHttpEndpoint } from "@copilotkit/runtime";
import { BuiltInAgent } from "@copilotkitnext/agent";

const azure = createAzure({
  resourceName: process.env.AZURE_RESOURCE_NAME,
  apiKey: process.env.AZURE_API_KEY,
});

const runtime = new CopilotRuntime({
  agents: {
    default: new BuiltInAgent({
      model: azure("your-deployment-name"),
    }),
  },
});

// Then use copilotRuntimeNodeHttpEndpoint as usual — no serviceAdapter needed
```

This works because `BuiltInAgent` already accepts `LanguageModel`
instances and `resolveModel()` passes them straight through.

## The Fix

Add an optional `getLanguageModel()` method to `CopilotServiceAdapter`.
Adapters that accept custom SDK instances (OpenAI, Anthropic, Groq) now
implement this to produce a pre-configured Vercel AI SDK `LanguageModel`
that carries the full provider configuration. `CopilotRuntime` prefers
this over the string format when creating `BuiltInAgent`.

**Backward compatible**: `getLanguageModel()` is optional on the
interface, so existing custom adapters continue to work unchanged.

| File | Change |
|------|--------|
| `service-adapter.ts` | Add optional `getLanguageModel()` to
`CopilotServiceAdapter` interface |
| `openai-adapter.ts` | Implement `getLanguageModel()` using
`createOpenAI` with the configured instance's `baseURL`/`apiKey` |
| `anthropic-adapter.ts` | Implement `getLanguageModel()` using
`createAnthropic` |
| `groq-adapter.ts` | Implement `getLanguageModel()` using
`createOpenAI` (Groq is OpenAI-compatible) |
| `copilot-runtime.ts` | Prefer `serviceAdapter.getLanguageModel()` over
string model when creating `BuiltInAgent` |
| `package.json` | Add `ai`, `@ai-sdk/openai`, `@ai-sdk/anthropic`
dependencies |

## Test plan

- [x] V2 agent tests pass (101/101)
- [x] V1 runtime build succeeds with no type errors
- [x] V1 runtime tests: same pass/fail as `main` (pre-existing failures
unrelated to this change)
- [ ] Manual: configure Azure OpenAI via `OpenAIAdapter` without
`OPENAI_API_KEY` — should work without `AI_LoadAPIKeyError`
- [ ] Manual: standard OpenAI via `OpenAIAdapter` with `OPENAI_API_KEY`
— should continue working

🤖 Generated with [Claude Code](https://claude.com/claude-code)
2026-02-26 18:36:11 -04:00
Maxim 0897192cc6 feat: add selfManagedAgents prop to React and Angular providers
Merges selfManagedAgents into agents__unsafe_dev_only at the component level.
No core changes, no validation, no license key checks.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-27 01:22:09 +04:00
Jordan Ritter ecfafc989c test: add unit tests for getSdkClientOptions utility 2026-02-26 12:47:19 -08:00
Jordan Ritter b8bf8085e0 refactor: replace as-any _options access with typed shared utility
SDK clients store defaultHeaders and fetch in a private _options field.
Extract the access pattern into getSdkClientOptions() with runtime
validation and a narrow return type, eliminating as-any from all three
adapter getLanguageModel() implementations.
2026-02-26 12:43:13 -08:00
Jordan Ritter 777231aaea refactor: use static imports and remove as-any casts in adapter tests
Address PR review feedback: replace dynamic await import() with static
top-level imports using vi.hoisted() for mock declarations, and remove
all `as any` type casts since the SDK constructor types already accept
the options we pass.
2026-02-26 12:25:44 -08:00
Jordan Ritter e520a66ed6 test: add exhaustive option-forwarding tests for adapter getLanguageModel()
Each test mocks the AI SDK provider factory and asserts that all options
from the SDK client instance are forwarded. Compile-time exhaustiveness
guards ensure the tests break if the AI SDK provider types add new
options that need to be handled.
2026-02-26 12:03:39 -08:00
Jordan Ritter 311d758570 fix: forward custom fetch from SDK clients to AI SDK providers 2026-02-26 12:03:32 -08:00
Jordan Ritter 7d2c69fef2 fix: forward custom headers, organization, and project to AI SDK providers
Pass defaultHeaders from SDK client instances through to the AI SDK
providers. This is critical for Azure OpenAI (api-key header) and any
custom proxy setups. Also forward organization and project for OpenAI.
2026-02-26 11:52:39 -08:00
github-actions[bot] f924ecb4aa chore(post-release): update version to 1.52.0 v1.52.0 2026-02-26 19:37:25 +00:00
Tyler Slaton 04089ecee8 chore: fix example dep not properly setup
Signed-off-by: Tyler Slaton <tyler@copilotkit.ai>
2026-02-26 11:33:49 -08:00
Jordan Ritter 3f8b5e2360 fix: propagate custom provider config from service adapters to BuiltInAgent
Service adapters (OpenAIAdapter, AnthropicAdapter, GroqAdapter) accept
custom SDK instances with provider-specific configuration (e.g. Azure
OpenAI with custom baseURL/apiKey/headers), but CopilotRuntime discards
those instances and reconstructs a plain "provider/model" string for
BuiltInAgent. The agent's resolveModel() then creates a fresh provider
using only environment variables, losing all custom configuration.

Add getLanguageModel() to CopilotServiceAdapter so adapters can produce
a pre-configured Vercel AI SDK LanguageModel. CopilotRuntime now prefers
this over the string format when creating BuiltInAgent.

Fixes CopilotKit/CopilotKit#2903
2026-02-26 11:13:08 -08:00
Tyler Slaton 0a0394e0a4 chore: release 1.52.0
Signed-off-by: Tyler Slaton <tyler@copilotkit.ai>
2026-02-26 10:48:06 -08:00
Mike Ryan 609c3e9936 feat(angular): add public license key config 2026-02-26 09:22:48 -08:00
Alem Tuzlak b60707563f feat: accept agentId parameter in useLangGraphInterrupt (#3272) 2026-02-26 17:24:32 +01:00
Mike Ryan 9920ad34b2 fix(angular): restore frontend tool handler context wiring 2026-02-26 08:18:52 -08:00
Mike Ryan dca52ed355 docs(angular): Add Angular documentation 2026-02-26 08:18:52 -08:00
Mike Ryan 744e392230 feat(angular): mirror React agent proxying and runtime signals 2026-02-26 08:18:52 -08:00
Mike Ryan 6be0696d11 chore(angular): Update the license of the Angular SDK 2026-02-26 07:25:47 -08:00
Brian Love 6833f0f7e3 chore(angular): version 19 2026-02-24 14:23:27 -08:00
Nathan 🔶 Tarbert 7091563ae7 Revise feature request template for clarity
Updated the feature request template to improve clarity and added a pre-flight checklist.
2026-02-24 14:17:05 -05:00
github-actions[bot] a0cd2ed364 chore(post-release): update version to 1.52.0-next.8 2026-02-24 15:21:43 +00:00
Alem Tuzlak 942d397352 feat: e2e selectors for components (#3264) 2026-02-24 16:18:11 +01:00
github-actions[bot] 17d42682ef chore(post-release): update version to 1.52.0-next.7 2026-02-24 14:54:00 +00:00
Ran Shemtov d77f3475a6 feat: create use-interrupt hook (#3184)
Co-authored-by: Alem Tuzlak <t.zlak@hotmail.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 15:50:21 +01:00
Alem Tuzlak 9bd041888e docs: refactor AGENTS.md and CLAUDE.md with progressive disclosure (#3259)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-23 18:15:52 +01:00
Jordan Ritter 0f47b01d06 feat: Enable Git LFS for binary assets (.gif, .jpg, .png, .pdf, .mp4) (#3238)
Co-authored-by: Alem Tuzlak <t.zlak@hotmail.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2026-02-23 13:56:48 +01:00
github-actions[bot] 740d21a0aa chore(post-release): update version to 1.52.0-next.6 2026-02-21 02:42:07 +00:00
Alem Tuzlak 2007f8be55 feat: useComponent improvements (#3248)
Co-authored-by: Tyler Slaton <54378333+tylerslaton@users.noreply.github.com>
2026-02-20 18:38:44 -08:00
Maxim 5f941db968 fix(react): add cpk prefix to ensure tailwind styles don't pollute host app 2026-02-20 18:38:44 -08:00
github-actions[bot] 4fc8abe886 chore(post-release): update version to 1.52.0-next.5 2026-02-21 02:20:08 +00:00
Tyler Slaton 6dd6c84411 chore: release next version (#3254)
Signed-off-by: Tyler Slaton <tyler@copilotkit.ai>
2026-02-20 21:16:38 -05:00
Nathan 🔶 Tarbert dbddb354fd chore(.github): update 1-bug-report.yml (#3232)
Co-authored-by: Alem Tuzlak <t.zlak@hotmail.com>
2026-02-20 18:52:23 -05:00
Tyler Slaton ec78d719b2 chore: delete examples/v1/_legacy/saas-dynamic-dashboards/frontend/vercel.json (#3252) 2026-02-20 18:30:52 -05:00
github-actions[bot] fac1c7c015 chore(post-release): update version to 1.51.5-next.4 2026-02-20 23:28:02 +00:00
Alem Tuzlak 7e32e69b3b chore: fix up style generation (#3247)
Co-authored-by: Tyler Slaton <54378333+tylerslaton@users.noreply.github.com>
2026-02-20 18:21:35 -05:00
github-actions[bot] 2e3a03132b chore(post-release): update version to 1.51.5-next.3 2026-02-20 05:42:01 +00:00
Ran Shemtov 593859fd9f feat: add useComponent wrapper around useFrontendTool (#3175)
Co-authored-by: Alem Tuzlak <t.zlak@hotmail.com>
Co-authored-by: Tyler Slaton <54378333+tylerslaton@users.noreply.github.com>
2026-02-20 00:38:31 -05:00
Tyler Slaton d56959718d fix(saas-dynamic-dashboard): add vercel.json for building (#3240)
Signed-off-by: Tyler Slaton <tyler@copilotkit.ai>
2026-02-19 16:45:31 -05:00
Alem Tuzlak 221584460a chore: fix css not being bundled with v1 (#3243) 2026-02-19 16:30:19 -05:00
Tyler Slaton a26c77f8c4 fix(travel): reconfigure travel demo backend (#3246)
Signed-off-by: Tyler Slaton <tyler@copilotkit.ai>
2026-02-19 16:14:32 -05:00
Tyler Slaton f7f8047c58 fix(travel): add environment variable to specify langgraph deployment url (#3245)
Signed-off-by: Tyler Slaton <tyler@copilotkit.ai>
2026-02-19 15:22:30 -05:00
github-actions[bot] 365b915e26 chore(post-release): update version to 1.51.5-next.2 2026-02-18 23:50:35 +00:00
Tyler Slaton 80418e371a fix: use workspace:* for a2ui-renderer peer dep and sync lockfile on release (#3241)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 18:47:09 -05:00
github-actions[bot] 012c8aa111 chore(post-release): update version to 1.51.5-next.1 2026-02-18 23:11:01 +00:00
Maxim 412965a71a feat(react): add 'available' property to frontend tools (#3234) 2026-02-18 18:07:31 -05:00
Tyler Slaton 8c47abb0bb fix: enable corepack in Vercel deployments for pnpm 10 compatibility (#3235)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 10:43:12 -05:00
Tyler Slaton ea44dd1d1f fix(runtime): remove dead GraphQL schema building from runtime init (#3236)
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-17 20:18:59 -05:00
Max Korp 980d3f5b55 docs: add v2 interface reference docs (#3197)
Also fixing some linting/build issues.

Co-authored-by: Tyler Slaton <tyler@copilotkit.ai>
2026-02-17 17:14:41 -05:00