create-agentuity 0.0.101 → 0.0.102
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 +8 -8
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -31,10 +31,10 @@ A fully configured Agentuity project with:
|
|
|
31
31
|
```
|
|
32
32
|
my-app/
|
|
33
33
|
├── src/
|
|
34
|
-
│ ├──
|
|
34
|
+
│ ├── agent/ # Agent definitions
|
|
35
35
|
│ │ └── hello/
|
|
36
36
|
│ │ └── agent.ts # Example agent
|
|
37
|
-
│ ├──
|
|
37
|
+
│ ├── api/ # Custom API routes
|
|
38
38
|
│ │ └── route.ts # Example route
|
|
39
39
|
│ └── web/ # React web application
|
|
40
40
|
│ └── app.tsx # Main React component
|
|
@@ -113,23 +113,23 @@ export default agent;
|
|
|
113
113
|
|
|
114
114
|
## Adding API Routes
|
|
115
115
|
|
|
116
|
-
Create custom routes in `src/
|
|
116
|
+
Create custom routes in `src/api/`:
|
|
117
117
|
|
|
118
118
|
```typescript
|
|
119
|
-
// src/
|
|
119
|
+
// src/api/my-route/route.ts
|
|
120
120
|
import { createRouter } from '@agentuity/runtime';
|
|
121
|
-
import
|
|
121
|
+
import myAgent from '../../agent/my-agent/agent';
|
|
122
122
|
|
|
123
123
|
const router = createRouter();
|
|
124
124
|
|
|
125
125
|
router.get('/', async (c) => {
|
|
126
|
-
const result = await
|
|
126
|
+
const result = await myAgent.run({ message: 'Hello!' });
|
|
127
127
|
return c.json(result);
|
|
128
128
|
});
|
|
129
129
|
|
|
130
|
-
router.post('/',
|
|
130
|
+
router.post('/', myAgent.validator(), async (c) => {
|
|
131
131
|
const data = c.req.valid('json');
|
|
132
|
-
const result = await
|
|
132
|
+
const result = await myAgent.run(data);
|
|
133
133
|
return c.json(result);
|
|
134
134
|
});
|
|
135
135
|
|