@falai/agent 0.6.1 → 0.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -93,33 +93,6 @@
93
93
 
94
94
  ---
95
95
 
96
- ## 🏗️ Architecture
97
-
98
- `@falai/agent` uses a **state machine-driven architecture** where:
99
-
100
- - 🎯 **Conversations are explicit state machines** - Predictable, testable flows using the Route DSL
101
- - 🔧 **Tools execute automatically** - Based on state transitions and guideline matching, not AI decisions
102
- - 🧠 **AI only generates messages** - The AI never sees or calls tools; it just creates natural responses
103
- - 🔄 **Preparation iterations gather data** - Tools run in loops before message generation to enrich context
104
- - 📦 **Domain-based organization** - Tools grouped logically with route-level access control
105
-
106
- **Example:**
107
-
108
- ```typescript
109
- route.initialState
110
- .transitionTo({ chatState: "What's your name?" })
111
- .transitionTo(
112
- { toolState: saveName }, // ← Tool executes automatically
113
- "User provided their name"
114
- )
115
- .transitionTo({ chatState: "Thanks! What's your email?" });
116
- ```
117
-
118
- The AI generates conversational messages while the engine handles tool execution and flow control. This creates **deterministic, controllable agents** perfect for structured conversations like customer support, onboarding, and multi-step processes.
119
-
120
- 📖 **[Read the full architecture guide →](./docs/ARCHITECTURE.md)**
121
-
122
- ---
123
96
 
124
97
  ## 📦 Installation
125
98
 
@@ -178,10 +151,10 @@ const bookingRoute = agent.createRoute({
178
151
  });
179
152
 
180
153
  bookingRoute.initialState
181
- .transitionTo(
182
- { toolState: checkAvailability },
183
- "User provided hotel name and date"
184
- )
154
+ .transitionTo({
155
+ toolState: checkAvailability,
156
+ condition: "User provided hotel name and date",
157
+ })
185
158
  .transitionTo({ chatState: "Confirm booking and provide summary" });
186
159
 
187
160
  // 4️⃣ Start conversing
@@ -235,6 +208,8 @@ const agent = new Agent({
235
208
 
236
209
  ## 📚 Documentation
237
210
 
211
+ 📋 **[Complete Documentation Index →](docs/DOCS.md)** - Searchable index of all docs
212
+
238
213
  **Core Guides:**
239
214
  - 📘 **[Getting Started](./docs/GETTING_STARTED.md)** - Build your first agent in 5 minutes
240
215
  - 🏗️ **[Architecture](./docs/ARCHITECTURE.md)** - Design principles & philosophy
package/docs/DOCS.md ADDED
@@ -0,0 +1,239 @@
1
+ # Documentation Index
2
+
3
+ Complete index of all `@falai/agent` documentation.
4
+
5
+ ---
6
+
7
+ ## 🚀 Getting Started
8
+
9
+ Start here if you're new to the framework:
10
+
11
+ ### [Getting Started Guide](./GETTING_STARTED.md)
12
+ Build your first AI agent in 5 minutes with step-by-step instructions.
13
+
14
+ **Topics:** Installation, first agent, basic routes, data extraction, session state
15
+
16
+ ---
17
+
18
+ ## 📖 Core Concepts
19
+
20
+ Essential guides for understanding how the framework works:
21
+
22
+ ### [Architecture](./ARCHITECTURE.md)
23
+ Design principles, philosophy, and how the framework works under the hood.
24
+
25
+ **Topics:** Schema-first extraction, session state, code-based logic, state machines, deterministic IDs
26
+
27
+ ### [Constructor Options](./CONSTRUCTOR_OPTIONS.md)
28
+ Comprehensive guide to agent configuration patterns.
29
+
30
+ **Topics:** Declarative vs fluent API, terms, guidelines, capabilities, routes, initialization patterns
31
+
32
+ ### [Context Management](./CONTEXT_MANAGEMENT.md)
33
+ Session state, lifecycle hooks, and persistent conversations.
34
+
35
+ **Topics:** Session state, lifecycle hooks, context updates, multi-turn conversations, persistence patterns
36
+
37
+ ---
38
+
39
+ ## 🔧 Feature Guides
40
+
41
+ Deep dives into specific features:
42
+
43
+ ### [API Reference](./API_REFERENCE.md)
44
+ Complete API documentation for all classes, methods, and types.
45
+
46
+ **Topics:** Agent class, Route class, State class, defineTool, providers, all APIs
47
+
48
+ ### [AI Providers](./PROVIDERS.md)
49
+ Guide to AI provider configuration and usage.
50
+
51
+ **Topics:** Anthropic (Claude), OpenAI (GPT), Google (Gemini), OpenRouter, custom providers, backup models, retry logic
52
+
53
+ ### [Domain Organization](./DOMAINS.md)
54
+ Optional tool security and organization.
55
+
56
+ **Topics:** Domain-based security, tool scoping, route isolation, preventing unauthorized access
57
+
58
+ ### [Persistence Guide](./PERSISTENCE.md)
59
+ Database integration and session persistence.
60
+
61
+ **Topics:** Persistence adapters, auto-save, session management, lifecycle integration, custom adapters
62
+
63
+ ### [Database Adapters](./ADAPTERS.md)
64
+ Detailed comparison and configuration for all database adapters.
65
+
66
+ **Topics:** Prisma, Redis, MongoDB, PostgreSQL, SQLite, OpenSearch, Memory adapter, custom adapters
67
+
68
+ ---
69
+
70
+ ## 💡 Examples & Patterns
71
+
72
+ Real-world code examples:
73
+
74
+ ### [Examples Guide](./EXAMPLES.md)
75
+ Comprehensive guide to all 15+ production-ready examples.
76
+
77
+ **Topics:** Learning path, use case guide, code examples, quick reference
78
+
79
+ ### [Example Files](../examples/)
80
+ Browse the `/examples` directory for runnable code:
81
+ - [Business Onboarding](../examples/business-onboarding.ts) - Complex multi-step workflows
82
+ - [Travel Agent](../examples/travel-agent.ts) - Session state & data extraction
83
+ - [Healthcare Agent](../examples/healthcare-agent.ts) - Security & validation
84
+ - [Streaming Agent](../examples/streaming-agent.ts) - Real-time responses
85
+ - [Prisma Persistence](../examples/prisma-persistence.ts) - Database integration
86
+ - [Domain Scoping](../examples/domain-scoping.ts) - Tool security
87
+ - [And 10+ more...](./EXAMPLES.md)
88
+
89
+ ---
90
+
91
+ ## 🤝 Contributing
92
+
93
+ Help improve the framework:
94
+
95
+ ### [Contributing Guide](./CONTRIBUTING.md)
96
+ How to contribute code, documentation, and report issues.
97
+
98
+ **Topics:** Development setup, code style, pull requests, bug reports
99
+
100
+ ### [Publishing Guide](./PUBLISHING.md)
101
+ Internal guide for maintainers on publishing releases.
102
+
103
+ **Topics:** Release process, versioning, npm publishing, changelog
104
+
105
+ ---
106
+
107
+ ## 📚 Quick Reference
108
+
109
+ ### By Use Case
110
+
111
+ **I want to...**
112
+
113
+ - **Build my first agent** → [Getting Started](./GETTING_STARTED.md)
114
+ - **Understand the design** → [Architecture](./ARCHITECTURE.md)
115
+ - **Configure my agent** → [Constructor Options](./CONSTRUCTOR_OPTIONS.md)
116
+ - **Persist conversations** → [Persistence Guide](./PERSISTENCE.md)
117
+ - **Add tool security** → [Domain Organization](./DOMAINS.md)
118
+ - **See real examples** → [Examples Guide](./EXAMPLES.md)
119
+ - **Look up an API** → [API Reference](./API_REFERENCE.md)
120
+ - **Use a different AI provider** → [AI Providers](./PROVIDERS.md)
121
+ - **Choose a database** → [Database Adapters](./ADAPTERS.md)
122
+ - **Contribute code** → [Contributing Guide](./CONTRIBUTING.md)
123
+
124
+ ### By Topic
125
+
126
+ **Architecture & Design:**
127
+ - [Architecture Guide](./ARCHITECTURE.md)
128
+ - [How It Works](../README.md#-how-it-works)
129
+
130
+ **Agent Configuration:**
131
+ - [Constructor Options](./CONSTRUCTOR_OPTIONS.md)
132
+ - [Context Management](./CONTEXT_MANAGEMENT.md)
133
+ - [Getting Started](./GETTING_STARTED.md)
134
+
135
+ **Routes & State Machines:**
136
+ - [API Reference - Routes](./API_REFERENCE.md#route)
137
+ - [Architecture - State Machines](./ARCHITECTURE.md#state-machines)
138
+ - [Examples - Complex Flows](./EXAMPLES.md#-real-world-applications)
139
+
140
+ **Tools & Domains:**
141
+ - [Domain Organization](./DOMAINS.md)
142
+ - [API Reference - defineTool](./API_REFERENCE.md#definetool)
143
+ - [Examples - Domain Scoping](./EXAMPLES.md#-domain-scoping)
144
+
145
+ **Data Extraction:**
146
+ - [Architecture - Schema-First](./ARCHITECTURE.md#schema-first-data-extraction)
147
+ - [API Reference - extractionSchema](./API_REFERENCE.md#extractionschema)
148
+ - [Examples - Travel Agent](./EXAMPLES.md#-travel-agent)
149
+
150
+ **Session State:**
151
+ - [Context Management](./CONTEXT_MANAGEMENT.md)
152
+ - [Architecture - Session State](./ARCHITECTURE.md#session-state-management)
153
+ - [API Reference - createSession](./API_REFERENCE.md#createsession)
154
+
155
+ **Persistence:**
156
+ - [Persistence Guide](./PERSISTENCE.md)
157
+ - [Database Adapters](./ADAPTERS.md)
158
+ - [Examples - Prisma](./EXAMPLES.md#-prisma-persistence)
159
+
160
+ **AI Providers:**
161
+ - [AI Providers Guide](./PROVIDERS.md)
162
+ - [API Reference - Providers](./API_REFERENCE.md#providers)
163
+ - [Examples - Multiple Providers](./EXAMPLES.md#-provider-examples)
164
+
165
+ **Streaming:**
166
+ - [API Reference - respondStream](./API_REFERENCE.md#respondstream)
167
+ - [Examples - Streaming](./EXAMPLES.md#-streaming-responses)
168
+
169
+ ---
170
+
171
+ ## 📖 Documentation Format Guide
172
+
173
+ All documentation follows these conventions:
174
+
175
+ ### Code Examples
176
+ All code examples are TypeScript and can be copy-pasted directly.
177
+
178
+ ### Links
179
+ - Internal docs use relative links: `[Text](./FILE.md)`
180
+ - Examples use relative links: `[Text](../examples/file.ts)`
181
+ - External links use full URLs
182
+
183
+ ### File Structure
184
+ ```
185
+ docs/
186
+ ├── INDEX.md # This file - documentation index
187
+ ├── README.md # Docs overview and quick links
188
+ ├── GETTING_STARTED.md # Beginner tutorial
189
+ ├── ARCHITECTURE.md # Design principles
190
+ ├── API_REFERENCE.md # Complete API docs
191
+ ├── CONSTRUCTOR_OPTIONS.md # Configuration patterns
192
+ ├── CONTEXT_MANAGEMENT.md # Session state & hooks
193
+ ├── PERSISTENCE.md # Database integration
194
+ ├── ADAPTERS.md # Database adapter guide
195
+ ├── DOMAINS.md # Tool security
196
+ ├── PROVIDERS.md # AI provider guide
197
+ ├── EXAMPLES.md # Examples guide
198
+ ├── CONTRIBUTING.md # How to contribute
199
+ └── PUBLISHING.md # Release guide (maintainers)
200
+ ```
201
+
202
+ ---
203
+
204
+ ## 🔍 Search Tips
205
+
206
+ **Looking for something specific?**
207
+
208
+ 1. **Check this index first** for the right doc
209
+ 2. **Use your browser's find** (Ctrl+F / Cmd+F) within docs
210
+ 3. **Check the [Examples Guide](./EXAMPLES.md)** for code samples
211
+ 4. **Search the [API Reference](./API_REFERENCE.md)** for specific APIs
212
+
213
+ **Common searches:**
214
+ - "How do I..." → [Getting Started](./GETTING_STARTED.md)
215
+ - "What is..." → [Architecture](./ARCHITECTURE.md)
216
+ - "Example of..." → [Examples Guide](./EXAMPLES.md)
217
+ - "API for..." → [API Reference](./API_REFERENCE.md)
218
+
219
+ ---
220
+
221
+ ## 📱 External Resources
222
+
223
+ - **Main Website:** [falai.dev](https://falai.dev)
224
+ - **GitHub Repository:** [github.com/gusnips/falai](https://github.com/gusnips/falai)
225
+ - **npm Package:** [@falai/agent](https://www.npmjs.com/package/@falai/agent)
226
+ - **Issue Tracker:** [GitHub Issues](https://github.com/gusnips/falai/issues)
227
+
228
+ ---
229
+
230
+ ## 🆘 Still Can't Find What You Need?
231
+
232
+ 1. **Check the [main README](../README.md)** for an overview
233
+ 2. **Browse [all examples](../examples/)** for code patterns
234
+ 3. **Search [closed issues](https://github.com/gusnips/falai/issues?q=is%3Aissue+is%3Aclosed)** for similar questions
235
+ 4. **Open a [new issue](https://github.com/gusnips/falai/issues/new)** with your question
236
+
237
+ ---
238
+
239
+ **Last Updated:** 2025-10-15
package/docs/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  Welcome to the `@falai/agent` documentation!
4
4
 
5
+ 📋 **[Complete Documentation Index →](DOCS.md)** - Full searchable index of all docs
6
+
5
7
  ## 📖 Documentation Structure
6
8
 
7
9
  ### Getting Started
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@falai/agent",
3
- "version": "0.6.1",
3
+ "version": "0.6.3",
4
4
  "description": "Standalone, strongly-typed AI Agent framework with route DSL and AI provider strategy",
5
5
  "type": "module",
6
6
  "main": "./dist/cjs/index.js",