Skip to content

Documentation / @agentick/core / createApp

Variable: createApp() ​

const createApp: <P>(Component, options) => App<P>

Defined in: core/src/agentick-instance.ts:926

Create an app from a component function.

This is Agentick.createApp - apps inherit middleware from the global Agentick instance.

Create an app from a component function.

The app inherits middleware from this Agentick instance.

Type Parameters ​

P ​

P

Parameters ​

Component ​

ComponentFunction<P>

The component function that defines the Model Interface

options? ​

AppOptions = {}

App configuration options

Returns ​

App<P>

An App instance with run, send, and session methods

Example ​

typescript
const MyAgent = ({ query }) => (
  <>
    <System>You are helpful.</System>
    <Timeline />
    <User>{query}</User>
  </>
);

// Use global Agentick
const app = createApp(MyAgent, { model });

// Use scoped instance
const scoped = Agentick.create();
scoped.use('tool:*', authMiddleware);
const scopedApp = scoped.createApp(MyAgent, { model });

Example ​

typescript
import { createApp } from 'agentick';

const app = createApp(MyAgent, { model });
const result = await app.run({ props: { query: "Hello!" } });

Released under the ISC License.