# ComposerRuntime URL: /docs/api-reference/runtimes/composer-runtime Runtime for programmatically controlling the message composer. *** title: ComposerRuntime description: Runtime for programmatically controlling the message composer. --------------------------------------------------------------------------- The composer runtime allows you to view or edit anything related to how new information is added and sent. For instance you can use the composer runtime to read the state, add attachments, update text, send a message, etc. import { ParametersTable } from "@/components/docs/tables/ParametersTable"; import { ComposerRuntime, ThreadComposerRuntime, ThreadComposerState, EditComposerState } from "@/generated/typeDocs"; ### `useComposerRuntime` Grabs the nearest composer (whether it’s the edit composer or the thread’s composer): ```tsx // Example import { useComposerRuntime } from "@assistant-ui/react"; const composerRuntime = useComposerRuntime(); // set the text composerRuntime.setText("Hello from the composer runtime"); // send whatever is in the composer composerRuntime.send(); // get the current text in the composer state const composerState = composerRuntime.getState(); const currentText = composerState.text; ``` ### `useThreadComposer` Access the thread’s new message composer state: ```tsx import { useThreadComposer } from "@assistant-ui/react"; const threadComposerRuntime = useThreadComposer(); // set the text threadComposerRuntime.setText("Hello from the thread composer runtime"); // send whatever is in the thread composer threadComposerRuntime.send(); // get the current text in the composer state const threadComposerState = threadComposerRuntime.getState(); const currentText = threadComposerRuntime.text; ``` ### `ThreadComposerState` The state of the thread composer which is the composer the user can interact with at the bottom. ### `EditComposerState` The state of the edit composer which is the composer the user can edit messages with.