@agentforge/core 0.1.0
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 +147 -0
- package/dist/index.cjs +4048 -0
- package/dist/index.d.cts +4076 -0
- package/dist/index.d.ts +4076 -0
- package/dist/index.js +3905 -0
- package/package.json +68 -0
package/README.md
ADDED
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
# @agentforge/core
|
|
2
|
+
|
|
3
|
+
Core abstractions for AgentForge - production-ready deep agents framework.
|
|
4
|
+
|
|
5
|
+
## Status
|
|
6
|
+
|
|
7
|
+
✅ **Phase 1 & 2 Complete** | 🚧 **Phase 3.1 In Progress** - ReAct Pattern Nearly Complete
|
|
8
|
+
|
|
9
|
+
**326 tests passing** | **Full TypeScript support** | **Comprehensive documentation**
|
|
10
|
+
|
|
11
|
+
## Features
|
|
12
|
+
|
|
13
|
+
### ✅ Production Ready (Phase 1 & 2)
|
|
14
|
+
|
|
15
|
+
**Phase 1: Tool System** (113 tests)
|
|
16
|
+
- **Tool Metadata** - Rich metadata with categories, tags, examples
|
|
17
|
+
- **Tool Builder** - Fluent API for creating tools
|
|
18
|
+
- **Tool Registry** - Centralized management with querying and events
|
|
19
|
+
- **LangChain Integration** - Seamless conversion to LangChain tools
|
|
20
|
+
- **Prompt Generation** - Automatic LLM prompt generation
|
|
21
|
+
|
|
22
|
+
**Phase 2: LangGraph Utilities** (158 tests)
|
|
23
|
+
- **State Management** - Type-safe state annotations with Zod validation
|
|
24
|
+
- **Workflow Builders** - Sequential, parallel, and conditional patterns
|
|
25
|
+
- **Error Handling** - Retry, error handling, and timeout utilities
|
|
26
|
+
- **Subgraph Composition** - Reusable subgraph utilities
|
|
27
|
+
- **Memory & Persistence** - Checkpointer and thread management
|
|
28
|
+
- **Observability** - LangSmith integration, metrics, logging, error reporting
|
|
29
|
+
|
|
30
|
+
### 🚧 In Progress (Phase 3)
|
|
31
|
+
|
|
32
|
+
**Phase 3.1.1-3.1.3: ReAct Pattern Core** (29 tests) ✅
|
|
33
|
+
- **ReAct State** - State definition with Zod schemas
|
|
34
|
+
- **Agent Builder** - `createReActAgent()` factory function
|
|
35
|
+
- **Prompt Templates** - System prompts and reasoning templates
|
|
36
|
+
- **Reasoning Node** - Generates thoughts and decides on actions
|
|
37
|
+
- **Action Node** - Executes tools with error handling
|
|
38
|
+
- **Observation Node** - Processes results and updates scratchpad
|
|
39
|
+
|
|
40
|
+
**Phase 3.1.4: ReAct Builder & Integration** (26 tests) ✅
|
|
41
|
+
- **Fluent Builder API** - `ReActAgentBuilder` with method chaining
|
|
42
|
+
- **Factory Function** - `createReActAgentBuilder()` alternative
|
|
43
|
+
- **Integration Tests** - 7 end-to-end scenarios
|
|
44
|
+
- **Validation** - Runtime validation of required fields
|
|
45
|
+
- **Type Safety** - Full TypeScript support with inference
|
|
46
|
+
|
|
47
|
+
**Phase 3.1.5: Documentation** (In Progress)
|
|
48
|
+
- Usage guide with examples
|
|
49
|
+
- API documentation
|
|
50
|
+
- Migration guide
|
|
51
|
+
|
|
52
|
+
### 📋 Coming Soon
|
|
53
|
+
|
|
54
|
+
**Phase 3.2-3.4: More Agent Patterns**
|
|
55
|
+
- Plan-Execute pattern
|
|
56
|
+
- Reflection pattern
|
|
57
|
+
- Multi-agent coordination
|
|
58
|
+
|
|
59
|
+
**Phase 4: Middleware System**
|
|
60
|
+
- Logging, tracing, caching middleware
|
|
61
|
+
- Rate limiting and retry middleware
|
|
62
|
+
|
|
63
|
+
**Phase 5: Production Features**
|
|
64
|
+
- Streaming support
|
|
65
|
+
- Performance monitoring
|
|
66
|
+
- Production deployment guides
|
|
67
|
+
|
|
68
|
+
## Installation
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
pnpm add @agentforge/core
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Quick Start
|
|
75
|
+
|
|
76
|
+
### Tool System
|
|
77
|
+
|
|
78
|
+
```typescript
|
|
79
|
+
import { createTool } from '@agentforge/core';
|
|
80
|
+
import { z } from 'zod';
|
|
81
|
+
|
|
82
|
+
const weatherTool = createTool({
|
|
83
|
+
name: 'get_weather',
|
|
84
|
+
description: 'Get current weather for a location',
|
|
85
|
+
schema: z.object({
|
|
86
|
+
location: z.string().describe('City name'),
|
|
87
|
+
units: z.enum(['celsius', 'fahrenheit']).optional()
|
|
88
|
+
}),
|
|
89
|
+
execute: async ({ location, units = 'celsius' }) => {
|
|
90
|
+
// Implementation
|
|
91
|
+
return { temperature: 22, units, location };
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### LangGraph Workflow Builders
|
|
97
|
+
|
|
98
|
+
```typescript
|
|
99
|
+
import { createSequentialWorkflow, withRetry } from '@agentforge/core';
|
|
100
|
+
import { z } from 'zod';
|
|
101
|
+
|
|
102
|
+
// Create a sequential workflow
|
|
103
|
+
const workflow = createSequentialWorkflow(AgentState, [
|
|
104
|
+
{ name: 'fetch', node: fetchNode },
|
|
105
|
+
{ name: 'process', node: processNode },
|
|
106
|
+
{ name: 'save', node: saveNode },
|
|
107
|
+
]);
|
|
108
|
+
|
|
109
|
+
// Add error handling
|
|
110
|
+
const robustNode = withRetry(myNode, {
|
|
111
|
+
maxAttempts: 3,
|
|
112
|
+
backoff: 'exponential',
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
const app = workflow.compile();
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## Documentation
|
|
119
|
+
|
|
120
|
+
- [Tool System](./docs/TOOL_SYSTEM.md)
|
|
121
|
+
- [LangChain Integration](./docs/LANGCHAIN_INTEGRATION.md)
|
|
122
|
+
- [LangGraph Integration](./docs/LANGGRAPH_INTEGRATION.md)
|
|
123
|
+
|
|
124
|
+
## Examples
|
|
125
|
+
|
|
126
|
+
See the [examples](./examples) directory for complete working examples.
|
|
127
|
+
|
|
128
|
+
## Development
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
# Build
|
|
132
|
+
pnpm build
|
|
133
|
+
|
|
134
|
+
# Watch mode
|
|
135
|
+
pnpm dev
|
|
136
|
+
|
|
137
|
+
# Run tests
|
|
138
|
+
pnpm test
|
|
139
|
+
|
|
140
|
+
# Type check
|
|
141
|
+
pnpm typecheck
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## License
|
|
145
|
+
|
|
146
|
+
MIT © Paymentology
|
|
147
|
+
|