Skip to content

Connect the browser Agent

Mount a chart and connect it to the origin's shared Agent host.

KlineWorkbench includes the Agent panel by default. The browser client connects to a SharedWorker, which owns providers, settings and chat sessions. A chart stays in the page and supplies its tools over the client.

A host that needs custom panel placement can use the /agent export to bind the chart to the client and mount the panel beside it.

<script setup lang="ts">
import { onScopeDispose } from 'vue'
import { KlineWorkbench, createPersistedMarketDataHost, provideBrowserAppRuntime } from '@363045841yyt/klinechart'
import { AgentWorkbenchShell, getChartAgentClient } from '@363045841yyt/klinechart/agent'
import '@363045841yyt/klinechart/style.css'

const market = createPersistedMarketDataHost()
provideBrowserAppRuntime(market.context, true, console.error)
const client = getChartAgentClient()
onScopeDispose(() => {
  client.bindChartAgent(null)
  market.dispose()
})
</script>

<template>
  <div style="height: 480px">
    <AgentWorkbenchShell :client="client">
      <template #chart>
        <KlineWorkbench :agent="false" @controller-ready="chart => client.bindChartAgent(chart.agent)" />
      </template>
    </AgentWorkbenchShell>
  </div>
</template>

The browser must support SharedWorker. The hosted KCQ workspace uses the active Nebutra account and workspace for its managed provider and session storage. You can select your own Provider from Agent settings.

See the Agent tool reference for parameters and the access rules for Plan and Build.