@icoderyy/yy-agent-core
v0.1.3
Published
Reusable core runtime for Y-Agent.
Downloads
66
Readme
@icoderyy/yy-agent-core
Reusable Agent runtime for CLI, Web, server jobs, and editor integrations.
Install
npm install @icoderyy/yy-agent-coreMinimal Usage
import { agentLoop, createLoopState } from '@icoderyy/yy-agent-core'
const state = createLoopState({
modelId: 'deepseek:deepseek-chat',
cwd: process.cwd(),
})
await agentLoop({
input: 'Read package.json and summarize this project.',
state,
askPermission: async () => 'no',
onText: text => process.stdout.write(text),
})Image Input
await agentLoop({
input: [
{ type: 'text', text: 'Describe this image.' },
{ type: 'image', image: new URL('https://example.com/image.png'), mediaType: 'image/png' },
],
state,
askPermission: async () => 'no',
onText: text => process.stdout.write(text),
})Runtime Notes
- Node.js
>=22.0.0. - Model provider keys are read from environment variables.
agentLoopacceptsabortSignal,tokenBudget, andonEventfor host integrations.
