Files
copilotkit--copilotkit/showcase/integrations/ms-agent-python/src/app/demos/agent-config/page.tsx
T
2026-07-13 12:58:18 +08:00

41 lines
1.3 KiB
TypeScript

"use client";
/**
* Agent Config Object - typed config knobs (tone / expertise / responseLength)
* forwarded from the provider into the agent so its behavior changes per turn.
*
* Wiring: the toggles live in `useAgentConfig`. Each render publishes the
* resolved config through both CopilotKit `properties` and `useAgentContext`.
* The Microsoft Agent Framework route reads `properties` as AG-UI
* `forwardedProps`; the context relay keeps the demo aligned with the
* LangGraph Python v2 pattern.
*/
import { CopilotKit } from "@copilotkit/react-core/v2";
import { DemoLayout } from "./demo-layout";
import { ConfigContextRelay } from "./config-context-relay";
import { useAgentConfig } from "./use-agent-config";
export default function AgentConfigDemoPage() {
const { config, setTone, setExpertise, setResponseLength } = useAgentConfig();
return (
// @region[provider-setup]
<CopilotKit
runtimeUrl="/api/copilotkit-agent-config"
agent="agent-config-demo"
properties={config}
>
<ConfigContextRelay config={config} />
<DemoLayout
config={config}
onToneChange={setTone}
onExpertiseChange={setExpertise}
onResponseLengthChange={setResponseLength}
/>
</CopilotKit>
// @endregion[provider-setup]
);
}