Skip to content

Commit

Permalink
feat: Attach timestamp tool
Browse files Browse the repository at this point in the history
  • Loading branch information
johnjcsmith committed Dec 16, 2024
1 parent 58e4fff commit 75a9ac7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 3 additions & 0 deletions control-plane/src/modules/workflows/agent/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -397,8 +397,11 @@ export const findRelevantTools = async (state: WorkflowAgentState) => {
const accessKnowledgeArtifactsTool =
await buildAccessKnowledgeArtifacts(workflow);

const currentDateTimeTool = buildCurrentDateTimeTool();

// When tools are not specified, attach all internalTools
tools.push(accessKnowledgeArtifactsTool);
tools.push(currentDateTimeTool);

events.write({
type: "functionRegistrySearchCompleted",
Expand Down
7 changes: 5 additions & 2 deletions control-plane/src/modules/workflows/agent/tools/date-time.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@ export const CURRENT_DATE_TIME_TOOL_NAME = "currentDateTime";
export const buildCurrentDateTimeTool = (): AgentTool =>
new AgentTool({
name: CURRENT_DATE_TIME_TOOL_NAME,
description: "Retrieves the current date and time in ISO 8601 format.",
description: "Retrieves the current date and time in ISO 8601 format and unix timestamp.",
schema: z.object({}),
func: async () => {
return new Date().toISOString();
return JSON.stringify({
iso8601: new Date().toISOString(),
unix: new Date().getTime()
})
},
});

0 comments on commit 75a9ac7

Please sign in to comment.