Open-source, secure environment with real-world tools for enterprise-grade agents.
Python agentaiai-agentai-agentscode-interpretercopilotdevelopmentdevtoolsgptgpt-4javascriptllmnextjsopenaipythonreactsoftwaretypescript
create types for agent logs
Vasek Mlejnsky7af7b18f8d88
diff --git a/components/AgentLogsList.tsx b/components/AgentLogsList.tsxnew file mode 100644index 000000000..0aae0ed9f--- /dev/null+++ b/components/AgentLogsList.tsx@@ -0,0 +1,19 @@+import { LogFile } from 'utils/agentLogs'++export interface Props {+ logFiles: LogFile[]+}++function AgentLogsList() {+ return (+ <main className="overflow-hidden flex flex-col max-h-full">+ <header className="flex items-center justify-between p-4 sm:p-6 lg:px-8">+ <h1 className="text-2xl font-semibold leading-7 text-white">Agent Logs</h1>+ </header>+++ </main>+ )+}++export default AgentLogsList\ No newline at end of filediff --git a/components/AgentRunsList.tsx b/components/AgentRunsList.tsxindex d2b374da6..40b99d306 100644--- a/components/AgentRunsList.tsx+++ b/components/AgentRunsList.tsx@@ -39,34 +39,6 @@ function AgentRunsList({}return acc}, {})- // function getAgentRuns(agentInstance: any) {- // }------- // agentInstance={projectsWithDeployments.find(p => p.project.id === selectedAgentInstanceID)!}-- // TODO: If no agent instance was specified, display all instances and runs and make them foldabble.-- // console.log('agentInstance', agentInstance)- // // TODO: We'll have a better concept for run, challenge, task, benchmark, etc- // // once we give SDK to the first users. Let's start with a simple version first.- // // At the moment, a run is just an array of logs with the same run ID.- // const runs = agentInstance.deployment.logs.reduce((acc: any, l: any) => {- // const runID = l['properties']['run_id']- // console.log('run ID', runID)- // console.log('log', l)- // console.log('acc', acc)- // if (!acc[runID]) {- // acc[runID] = []- // } else {- // acc[runID].push(l)- // }- // return acc- // }, {})function toggleSelectedAgentID(projectID: string) {if (selectedAgentID === projectID) {diff --git a/components/DashboardHome.tsx b/components/DashboardHome.tsxindex a63ce4a76..5dc6e5b18 100644--- a/components/DashboardHome.tsx+++ b/components/DashboardHome.tsx@@ -65,6 +65,11 @@ function DashboardHome({allDeployedAgents={projectsWithDeployments}initialSelectedAgentID={selectedAgentInstanceID}/>+ ) : view === 'logs' ? (+ <AgentRunsList+ allDeployedAgents={projectsWithDeployments}+ initialSelectedAgentID={selectedAgentInstanceID}+ />) : (<span>404</span>)}diff --git a/components/Layout.tsx b/components/Layout.tsxindex c0b0b101d..cc4eb0d95 100644--- a/components/Layout.tsx+++ b/components/Layout.tsx@@ -10,9 +10,8 @@ import { Inter } from 'next/font/google'import { usePostHog } from 'posthog-js/react'import { useSupabaseClient } from '@supabase/auth-helpers-react'import {- Zap,- ListEnd,Menu,+ List,} from 'lucide-react'import DashboardDesktopSidebar from 'components/Sidebar/DashboardDesktopSidebar'@@ -25,15 +24,20 @@ const inter = Inter({})const navigation = [+ // {+ // name: 'Deployed Agents',+ // view: 'deployed',+ // icon: Zap,+ // },+ // {+ // name: 'Agent Runs',+ // view: 'runs',+ // icon: ListEnd,+ // },{- name: 'Deployed Agents',- view: 'deployed',- icon: Zap,- },- {- name: 'Agent Runs',- view: 'runs',- icon: ListEnd,+ name: 'Agent Logs',+ view: 'logs',+ icon: List,},]diff --git a/utils/agentLogs.ts b/utils/agentLogs.tsnew file mode 100644index 000000000..6a28f9ae6--- /dev/null+++ b/utils/agentLogs.ts@@ -0,0 +1,32 @@+export interface LogFile {+ name: string+ content: AgentLogs+}++export interface AgentLogs {+ context: SystemContext | UserContext | AssistantContext+ functions: {+ name: string+ description?: string+ parameters: { [key: string]: any }+ }+}++export interface SystemContext {+ role: 'system'+ content: string+}++export interface UserContext {+ role: 'user'+ content: string+}++export interface AssistantContext {+ role: 'user'+ content: string+ function_call: {+ name: string+ arguments: { [argName: string]: string }+ }+}