# Getting Started with AriaFlow Core

This guide shows a minimal runtime setup with a single agent.

## Prerequisites

- Node.js 18+
- `@ai-sdk/*` provider (example uses OpenAI)
- Environment variable: `OPENAI_API_KEY`

## Install

```bash
npm install @ariaflowagents/core ai zod @ai-sdk/openai
```

## Minimal Runtime

```ts
import 'dotenv/config';
import {
  Runtime,
  type AgentConfig,
  createDateParser,
  createFileStreamSink,
} from '@ariaflowagents/core';
import { openai } from '@ai-sdk/openai';

const dateParser = createDateParser();

const support: AgentConfig = {
  id: 'support',
  name: 'Support',
  type: 'llm',
  systemPrompt: 'You are a helpful support agent.',
  model: openai('gpt-4o-mini') as any,
  tools: { parse_date: dateParser },
  // Production default: non-triage agents do not hand off unless configured.
  canHandoffTo: [],
};

const runtime = new Runtime({
  agents: [support],
  defaultAgentId: 'support',
  defaultModel: openai('gpt-4o-mini') as any,
  // Optional: non-blocking persistence sink with message-level defaults
  streamCallback: {
    sinks: [createFileStreamSink({ directory: './transcripts' })],
    eventMode: 'message',
    emitToolEvents: true,
    emitTextDeltas: false,
    emitFinalText: true,
  },
});

for await (const part of runtime.stream({ input: 'Hello there' })) {
  if (part.type === 'text-delta') process.stdout.write(part.text);
}
```

## Running

```bash
node index.ts
```

## Next Steps

- See **Runtime** for routing, sessions, and hooks: `guides/RUNTIME.md`
- See **Flows** for structured conversations: `guides/FLOWS.md`
- See **Guardrails** for safety and enforcement: `guides/GUARDRAILS.md`
