Skip to content

Commit f67a35f

Browse files
Seperate out runAgentTypes to break dependancies
1 parent e1c3d46 commit f67a35f

18 files changed

Lines changed: 65 additions & 74 deletions

File tree

frontend/src/app/modules/chat/conversation/conversation.component.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ export class ConversationComponent implements OnInit, OnDestroy, AfterViewInit {
111111
const id = this.llmId();
112112
return !!id && (
113113
id.startsWith('openai:o') ||
114+
id === 'openai:gpt-5' ||
114115
id.includes('claude-3-7') ||
115116
id.includes('sonnet-4') ||
116117
id.includes('opus-4') ||

shared/user/user.model.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import { Chat } from '#shared/chat/chat.model';
2-
31
export interface LLMServicesConfig {
42
vertexProjectId?: string;
53
vertexRegion?: string;

src/agent/agentContext.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@ import sinon from 'sinon';
33
import { LlmFunctionsImpl } from '#agent/LlmFunctionsImpl';
44
import { createContext } from '#agent/agentContextLocalStorage';
55
import { deserializeContext, serializeContext } from '#agent/agentSerialization';
6-
import type { RunAgentConfig } from '#agent/autonomous/autonomousAgentRunner';
76
import { appContext } from '#app/applicationContext';
87
import { LlmTools } from '#functions/llmTools';
98
import { openaiGPT5 } from '#llm/services/openai';
109
import type { AgentContext } from '#shared/agent/agent.model';
1110
import { functionRegistry } from '../functionRegistry';
11+
import type { RunAgentConfig } from './autonomous/runAgentTypes';
1212

1313
describe('agentContext', () => {
1414
before(() => {

src/agent/agentContextLocalStorage.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ import { AsyncLocalStorage } from 'node:async_hooks';
22
import { randomUUID } from 'node:crypto';
33
import { LlmFunctionsImpl } from '#agent/LlmFunctionsImpl';
44
import { ConsoleCompletedHandler } from '#agent/autonomous/agentCompletion';
5-
import type { RunAgentConfig, RunWorkflowConfig } from '#agent/autonomous/autonomousAgentRunner';
65
import { FileSystemService } from '#functions/storage/fileSystemService';
76
import { logger } from '#o11y/logger';
87
import type { AgentContext, AgentLLMs } from '#shared/agent/agent.model';
98
import type { IFileSystemService } from '#shared/files/fileSystemService';
109
import { currentUser } from '#user/userContext';
10+
import type { RunAgentConfig, RunWorkflowConfig } from './autonomous/runAgentTypes';
1111

1212
let _fileSystemOverride: IFileSystemService | null = null;
1313

src/agent/autonomous/autonomousAgentRunner.ts

Lines changed: 2 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { randomUUID } from 'node:crypto';
2-
import type { LlmFunctionsImpl } from '#agent/LlmFunctionsImpl';
32
import { createContext } from '#agent/agentContextLocalStorage';
43
import { runCodeGenAgent } from '#agent/autonomous/codegen/codegenAutonomousAgent';
54
import { AGENT_REQUEST_FEEDBACK } from '#agent/autonomous/functions/agentFeedback';
@@ -10,57 +9,16 @@ import { FUNC_SEP } from '#functionSchema/functions';
109
import { Git } from '#functions/scm/git';
1110
import { GitHub } from '#functions/scm/github';
1211
import { logger } from '#o11y/logger';
13-
import type { AgentCompleted, AgentContext, AgentLLMs, AgentType } from '#shared/agent/agent.model';
12+
import type { AgentContext } from '#shared/agent/agent.model';
1413
import type { FunctionCallResult } from '#shared/llm/llm.model';
15-
import type { User } from '#shared/user/user.model';
1614
import { runAsUser } from '#user/userContext';
1715
import { errorToString } from '#utils/errors';
1816
import { CDATA_END, CDATA_START } from '#utils/xml-utils';
17+
import { RunAgentConfig } from './runAgentTypes';
1918

2019
export const SUPERVISOR_RESUMED_FUNCTION_NAME: string = `Supervisor${FUNC_SEP}Resumed`;
2120
export const SUPERVISOR_CANCELLED_FUNCTION_NAME: string = `Supervisor${FUNC_SEP}Cancelled`;
2221

23-
export type RunWorkflowConfig = Omit<RunAgentConfig, 'type' | 'functions'> & Partial<Pick<RunAgentConfig, 'functions'>>;
24-
25-
/**
26-
* Configuration for running an autonomous agent
27-
*/
28-
export interface RunAgentConfig {
29-
/** The user who created the agent. Uses currentUser() if not provided */
30-
user?: User;
31-
/** The parent agentId */
32-
parentAgentId?: string;
33-
codeTaskId?: string;
34-
/** The name of this agent */
35-
agentName: string;
36-
/** Autonomous or workflow */
37-
type: AgentType;
38-
/** For autonomous agents either xml or codegen. For workflow agents it identifies the workflow type */
39-
subtype: string;
40-
/** The function classes the agent has available to call */
41-
functions: LlmFunctionsImpl | Array<new () => any>;
42-
/** Handler for when the agent finishes executing. Defaults to console output */
43-
completedHandler?: AgentCompleted;
44-
/** The user prompt */
45-
initialPrompt: string;
46-
/** The agent system prompt */
47-
systemPrompt?: string;
48-
/** Settings for requiring a human-in-the-loop */
49-
humanInLoop?: { budget?: number; count?: number; functionErrorCount?: number };
50-
/** The default LLMs available to use */
51-
llms?: AgentLLMs;
52-
/** The agent to resume */
53-
resumeAgentId?: string;
54-
/** The base path of the context FileSystem. Defaults to the process working directory */
55-
fileSystemPath?: string;
56-
/** Use shared repository location instead of agent-specific directory. Defaults to true. */
57-
useSharedRepos?: boolean;
58-
/** If running in a container, the ID of the container */
59-
containerId?: string;
60-
/** Additional details for the agent */
61-
metadata?: Record<string, any>;
62-
}
63-
6422
/**
6523
* The reference to a running agent
6624
*/

src/agent/autonomous/codegen/codeGenAgentRunner.test.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,7 @@
11
import { expect } from 'chai';
22
import sinon from 'sinon';
33
import { LlmFunctionsImpl } from '#agent/LlmFunctionsImpl';
4-
import {
5-
type RunAgentConfig,
6-
SUPERVISOR_CANCELLED_FUNCTION_NAME,
7-
cancelAgent,
8-
provideFeedback,
9-
runAgentAndWait,
10-
startAgent,
11-
} from '#agent/autonomous/autonomousAgentRunner';
4+
import { SUPERVISOR_CANCELLED_FUNCTION_NAME, cancelAgent, provideFeedback, runAgentAndWait, startAgent } from '#agent/autonomous/autonomousAgentRunner';
125
import { convertTypeScriptToPython } from '#agent/autonomous/codegen/pythonCodeGenUtils';
136
import { AGENT_REQUEST_FEEDBACK, AgentFeedback } from '#agent/autonomous/functions/agentFeedback';
147
import { AGENT_COMPLETED_NAME, AGENT_MEMORY } from '#agent/autonomous/functions/agentFunctions';
@@ -22,6 +15,7 @@ import { lastText } from '#shared/llm/llm.model';
2215
import { setupConditionalLoggerOutput } from '#test/testUtils';
2316
import { sleep } from '#utils/async-utils';
2417
import { agentContextStorage } from '../../agentContextLocalStorage';
18+
import { type RunAgentConfig } from '../runAgentTypes';
2519

2620
const PY_AGENT_COMPLETED = (note: string) => `await ${AGENT_COMPLETED_NAME}("${note}")`;
2721
const PY_AGENT_REQUEST_FEEDBACK = (feedback: string) => `await ${AGENT_REQUEST_FEEDBACK}("${feedback}")`;
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import type { AgentCompleted, AgentLLMs, AgentType, LlmFunctions } from '#shared/agent/agent.model';
2+
import type { User } from '#shared/user/user.model';
3+
4+
export type RunWorkflowConfig = Omit<RunAgentConfig, 'type' | 'functions'> & Partial<Pick<RunAgentConfig, 'functions'>>;
5+
6+
/**
7+
* Configuration for running an autonomous agent
8+
*/
9+
export interface RunAgentConfig {
10+
/** The user who created the agent. Uses currentUser() if not provided */
11+
user?: User;
12+
/** The parent agentId */
13+
parentAgentId?: string;
14+
codeTaskId?: string;
15+
/** The name of this agent */
16+
agentName: string;
17+
/** Autonomous or workflow */
18+
type: AgentType;
19+
/** For autonomous agents either xml or codegen. For workflow agents it identifies the workflow type */
20+
subtype: string;
21+
/** The function classes the agent has available to call */
22+
functions: LlmFunctions | Array<new () => any>;
23+
/** Handler for when the agent finishes executing. Defaults to console output */
24+
completedHandler?: AgentCompleted;
25+
/** The user prompt */
26+
initialPrompt: string;
27+
/** The agent system prompt */
28+
systemPrompt?: string;
29+
/** Settings for requiring a human-in-the-loop */
30+
humanInLoop?: { budget?: number; count?: number; functionErrorCount?: number };
31+
/** The default LLMs available to use */
32+
llms?: AgentLLMs;
33+
/** The agent to resume */
34+
resumeAgentId?: string;
35+
/** The base path of the context FileSystem. Defaults to the process working directory */
36+
fileSystemPath?: string;
37+
/** Use shared repository location instead of agent-specific directory. Defaults to true. */
38+
useSharedRepos?: boolean;
39+
/** If running in a container, the ID of the container */
40+
containerId?: string;
41+
/** Additional details for the agent */
42+
metadata?: Record<string, any>;
43+
}

src/agent/autonomous/xml/xmlAutonomousAgent.test.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,7 @@
11
import { expect } from 'chai';
22
import sinon from 'sinon';
33
import { LlmFunctionsImpl } from '#agent/LlmFunctionsImpl';
4-
import {
5-
type RunAgentConfig,
6-
SUPERVISOR_CANCELLED_FUNCTION_NAME,
7-
cancelAgent,
8-
provideFeedback,
9-
runAgentAndWait,
10-
startAgent,
11-
} from '#agent/autonomous/autonomousAgentRunner';
4+
import { SUPERVISOR_CANCELLED_FUNCTION_NAME, cancelAgent, provideFeedback, runAgentAndWait, startAgent } from '#agent/autonomous/autonomousAgentRunner';
125
import { AGENT_REQUEST_FEEDBACK, REQUEST_FEEDBACK_PARAM_NAME } from '#agent/autonomous/functions/agentFeedback';
136
import { AGENT_COMPLETED_NAME } from '#agent/autonomous/functions/agentFunctions';
147
import { XML_AGENT_SPAN } from '#agent/autonomous/xml/xmlAutonomousAgent';
@@ -21,6 +14,7 @@ import { lastText } from '#shared/llm/llm.model';
2114
import type { User } from '#shared/user/user.model';
2215
import { sleep } from '#utils/async-utils';
2316
import { agentContextStorage } from '../../agentContextLocalStorage';
17+
import { type RunAgentConfig } from '../runAgentTypes';
2418

2519
const REQUEST_FEEDBACK_VALUE = 'question is...';
2620
const REQUEST_FEEDBACK_FUNCTION_CALL = `<plan>Requesting feedback</plan>\n<function_calls><function_call><function_name>${AGENT_REQUEST_FEEDBACK}</function_name><parameters><${REQUEST_FEEDBACK_PARAM_NAME}>${REQUEST_FEEDBACK_VALUE}</${REQUEST_FEEDBACK_PARAM_NAME}></parameters></function_call></function_calls>`;

src/agent/workflow/workflowAgentRunner.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import type { Span } from '@opentelemetry/api';
22
import { agentContext, agentContextStorage, createContext } from '#agent/agentContextLocalStorage';
3-
import { type AgentExecution, type RunWorkflowConfig, agentExecutions } from '#agent/autonomous/autonomousAgentRunner';
3+
import { type AgentExecution, agentExecutions } from '#agent/autonomous/autonomousAgentRunner';
4+
import { type RunWorkflowConfig } from '#agent/autonomous/runAgentTypes';
45
import { appContext } from '#app/applicationContext';
56
import { defaultLLMs } from '#llm/services/defaultLlms';
67
import { logger } from '#o11y/logger';

src/cli/code.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import '#fastify/trace-init/trace-init'; // leave an empty line next so this doesn't get sorted from the first line
22

3-
import type { RunAgentConfig, RunWorkflowConfig } from '#agent/autonomous/autonomousAgentRunner';
3+
import type { RunWorkflowConfig } from '#agent/autonomous/runAgentTypes';
44
import { runWorkflowAgent } from '#agent/workflow/workflowAgentRunner';
55
import { initApplicationContext } from '#app/applicationContext';
66
import { shutdownTrace } from '#fastify/trace-init/trace-init';

0 commit comments

Comments
 (0)