create-agentuity 0.0.68 → 0.0.69
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 -9
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -88,22 +88,22 @@ Create a new agent by adding a folder in `src/agent/`:
|
|
|
88
88
|
|
|
89
89
|
```typescript
|
|
90
90
|
// src/agent/my-agent/agent.ts
|
|
91
|
-
import {
|
|
92
|
-
import {
|
|
91
|
+
import { createAgent } from '@agentuity/runtime';
|
|
92
|
+
import { s } from '@agentuity/schema';
|
|
93
93
|
|
|
94
94
|
const agent = createAgent({
|
|
95
95
|
metadata: {
|
|
96
96
|
description: 'My amazing agent',
|
|
97
97
|
},
|
|
98
98
|
schema: {
|
|
99
|
-
input:
|
|
100
|
-
message:
|
|
99
|
+
input: s.object({
|
|
100
|
+
message: s.string(),
|
|
101
101
|
}),
|
|
102
|
-
output:
|
|
103
|
-
response:
|
|
102
|
+
output: s.object({
|
|
103
|
+
response: s.string(),
|
|
104
104
|
}),
|
|
105
105
|
},
|
|
106
|
-
handler: async (ctx
|
|
106
|
+
handler: async (ctx, input) => {
|
|
107
107
|
return { response: `Processed: ${input.message}` };
|
|
108
108
|
},
|
|
109
109
|
});
|
|
@@ -118,7 +118,6 @@ Create custom routes in `src/web/` or add routes to an agent folder:
|
|
|
118
118
|
```typescript
|
|
119
119
|
// src/agent/my-agent/route.ts
|
|
120
120
|
import { createRouter } from '@agentuity/runtime';
|
|
121
|
-
import { zValidator } from '@hono/zod-validator';
|
|
122
121
|
import agent from './agent';
|
|
123
122
|
|
|
124
123
|
const router = createRouter();
|
|
@@ -128,7 +127,7 @@ router.get('/', async (c) => {
|
|
|
128
127
|
return c.json(result);
|
|
129
128
|
});
|
|
130
129
|
|
|
131
|
-
router.post('/',
|
|
130
|
+
router.post('/', agent.validator(), async (c) => {
|
|
132
131
|
const data = c.req.valid('json');
|
|
133
132
|
const result = await c.agent.myAgent.run(data);
|
|
134
133
|
return c.json(result);
|