File tree Expand file tree Collapse file tree
packages/react-core/src/v2/hooks Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ export { useRenderTool } from "./use-render-tool";
88export { useDefaultRenderTool } from "./use-default-render-tool" ;
99export { useHumanInTheLoop } from "./use-human-in-the-loop" ;
1010export { useAgent , UseAgentUpdate } from "./use-agent" ;
11+ export { useCapabilities } from "./use-capabilities" ;
1112export { useAgentContext } from "./use-agent-context" ;
1213export type { AgentContextInput , JsonSerializable } from "./use-agent-context" ;
1314export { useSuggestions } from "./use-suggestions" ;
Original file line number Diff line number Diff line change 1+ import type { AgentCapabilities } from "@ag-ui/core" ;
2+ import { ProxiedCopilotRuntimeAgent } from "@copilotkit/core" ;
3+ import { useAgent } from "./use-agent" ;
4+
5+ /**
6+ * Returns the capabilities declared by the given agent (or the default agent).
7+ * Capabilities are fetched from the runtime at connection time and are
8+ * available synchronously — no loading state required.
9+ *
10+ * @param agentId - Optional agent ID. If omitted, uses the default agent.
11+ * @returns The agent's capabilities, or `undefined` if the agent hasn't
12+ * connected yet or doesn't declare capabilities.
13+ */
14+ export function useCapabilities ( agentId ?: string ) : AgentCapabilities | undefined {
15+ const { agent } = useAgent ( { agentId } ) ;
16+
17+ if ( agent instanceof ProxiedCopilotRuntimeAgent ) {
18+ return agent . capabilities ;
19+ }
20+
21+ return undefined ;
22+ }
You can’t perform that action at this time.
0 commit comments