Draft
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add a framework-agnostic AI agent plugin to AppKit with auto-tool-discovery from existing plugins, a Databricks Model Serving adapter, three framework adapters (Databricks, Vercel AI, LangChain), and a
createAgent()convenience API.Main changes
Agent plugin core (
packages/appkit/src/plugins/agent/):New deferred-phase plugin that scans all registered plugins for
ToolProviderimplementations, collects their tools withpluginName.toolNamenamespacing, and exposes 7 HTTP routes (chat via SSE, cancel, threads CRUD, tools list, agents list). Manages in-memory threads per userId and supports multiple named agents with a configurable default. The chat handler builds anexecuteToolclosure over the request for user-context-aware tool execution.DatabricksAdapter (
packages/appkit/src/agents/databricks.ts):Adapter that talks directly to Databricks Model Serving
/invocationsendpoints using rawfetch(). Authenticates per-request via anauthenticate()callback (no stale tokens), sanitizes tool names (dots to double-underscores) for the Databricks API, and handles both structuredtool_callsresponses and text-based tool call fallback parsing (Llama JSON format and Python-style). Includes afromServingEndpoint()async factory and acreateDatabricksModel()helper for Vercel AI SDK integration.ToolProvider on existing plugins (
packages/appkit/src/plugins/{analytics,files,genie,lakebase}/):All four existing plugins now implement the
ToolProviderinterface withgetAgentTools()andexecuteAgentTool(). Analytics exposesquery(1 tool), Files generates per-volume tools (6 per volume), Genie generates per-space tools (2 per space), and Lakebase exposesquery(1 tool).createAgent()wrapper (packages/appkit/src/core/create-agent.ts):Higher-level API that wraps
createAppwithserver()andagent()pre-configured. Supports single-agent shorthand (adapter) or multi-agent (agentsrecord), flat server config (port,host), and returns anAgentHandlewithregisterAgent,getTools,getThreads, andpluginsnamespace.Supporting infrastructure
packages/shared/src/agent.ts— Core types:ToolProvider,AgentToolDefinition,AgentAdapter,AgentEvent(7-event SSE protocol),Message,Thread,ThreadStore.packages/appkit/src/agents/vercel-ai.ts— Adapter bridging Vercel AI SDK'sstreamText().fullStreamtoAgentEvent.packages/appkit/src/agents/langchain.ts— Adapter bridging LangChain'sstreamEventsv2 toAgentEvent, with JSON Schema to Zod converter.packages/appkit/src/plugins/agent/thread-store.ts—InMemoryThreadStoreimplementation (Map-based, userId-scoped).apps/agent-app/— Standalone agent app project usingcreateAgent(), with chat UI, markdown rendering, event stream panel, and theme selector.apps/dev-playground/client/src/routes/agent.route.tsx— Agent chat page in dev-playground with inline autocomplete and event stream sidebar.Examples
2 ways of building agents
in app:
Screen.Recording.2026-03-26.at.18.17.40.mov
dedicated agent:
Screen.Recording.2026-03-26.at.18.20.03.mov