Skip to content
This repository was archived by the owner on Sep 17, 2025. It is now read-only.
This repository was archived by the owner on Sep 17, 2025. It is now read-only.

createAgent function which accepts blocks and actions #36

@DexterStorey

Description

@DexterStorey
import { createAgent } from '@rubriclab/agents'
import { actions } from './actions'
import { blocks } from './blocks'

export const { eventTypes, executeAgent } = createAgent({
	model: 'gpt-4o-mini',
	systemPrompt: 'You are a helpful assistant',
	blocks,
	actions
})

Should get event types (which could be passed to events pkg for typesafety) and an executor

ensure typesafety from events package cleanly integrates:

'use server'

import { executeAgent } from '~/agents'
import { publish } from '~/events'

export async function sendMessage(message: string) {
	await executeAgent(
		[
			{
				role: 'user',
				content: message
			}
		],
		{
			on: {
				chatMessage: async ({ event }) => {
					publish('chatMessage', {
						event
					})
				}
			}
		}
	)
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions