Skip to content

Commit

Permalink
Adds factory 'createAgent' function
Browse files Browse the repository at this point in the history
  • Loading branch information
jcarlosn committed Nov 22, 2024
1 parent 09ddd73 commit 87c2ff8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions packages/protofy/src/Agent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,10 @@ export class Agent {
}
}

export function createAgent(data: AgentData, parent?: Agent) {
return new Agent(data, parent);
}

export class AgentInterface {
input: AgentIOInterface;
output: AgentIOInterface;
Expand Down
4 changes: 2 additions & 2 deletions packages/protofy/tests/agent.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Agent } from '../src/Agent';
import { Agent, createAgent } from '../src/Agent';
import { z } from 'zod';
import { zodToJsonSchema } from 'zod-to-json-schema';

Expand All @@ -25,7 +25,7 @@ describe('Agents basic behavior', () => {
tags: ['child']
});

agent = new Agent({
agent = createAgent({
id: 'getDisplayInfo',
name: 'getDisplayInfo',
description: 'Get display info of a user',
Expand Down

0 comments on commit 87c2ff8

Please sign in to comment.