Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/agent/agent-platform/dist/sub-agents/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export * from './interfaces.js';
export * from './errors.js';
export * from './sub-agent.js';
export * from './extended-agents.js';
export * from './sub-agent-factory.js';
export * from './agent-pool.js';
export * from './task-splitter.js';
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/agent/agent-platform/dist/sub-agents/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/agent/agent-platform/dist/sub-agents/index.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

149 changes: 134 additions & 15 deletions packages/agent/agent-platform/src/sub-agents/extended-agents.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,148 @@
* main index to keep the core roster clean.
*/

import { BaseSubAgent } from './sub-agent.js';
import type { AgentConfig } from './interfaces.js';
import type { TaskModel } from '@agentx/core-runtime';
import type { CompletionRequest, CompletionResponse } from '@agentx/provider-sdk';
import { ProviderRegistry } from '@agentx/provider-sdk';
import type { AgentRole, AgentConfig } from './interfaces.js';

export class PlannerAgent extends BaseSubAgent {
constructor(id: string, config?: AgentConfig) {
super(id, 'planner', config);
export abstract class BaseExtendedAgent {
public readonly id: string;
public readonly role: AgentRole;
protected readonly providerId?: string;
protected readonly promptTemplate?: string;
protected readonly providerRegistry: ProviderRegistry;

constructor(
id: string,
role: AgentRole,
config?: AgentConfig,
providerRegistry?: ProviderRegistry,
) {
this.id = id;
this.role = role;
this.providerId = config?.providerId;
this.promptTemplate = config?.promptTemplate;
this.providerRegistry = providerRegistry || new ProviderRegistry();
}
}

export class ArchitectAgent extends BaseSubAgent {
constructor(id: string, config?: AgentConfig) {
super(id, 'architect', config);
protected async callLLM(
prompt: string,
systemPrompt?: string,
modelId?: string,
): Promise<CompletionResponse> {
const providers = this.providerRegistry.list();
const provider = providers[0];
if (!provider) {
throw new Error('No provider configured');
}

const request: CompletionRequest = {
systemPrompt: systemPrompt || '',
userPrompt: prompt,
modelId: modelId || 'claude-sonnet-4-20250514',
};

return this.providerRegistry.complete(provider.id, request);
}

public abstract execute(task: TaskModel, _context: unknown): Promise<unknown>;
}

export class DocumentationAgent extends BaseSubAgent {
constructor(id: string, config?: AgentConfig) {
super(id, 'documentation', config);
export class DocumentationAgent extends BaseExtendedAgent {
constructor(id: string, config?: AgentConfig, providerRegistry?: ProviderRegistry) {
super(id, 'documentation', config, providerRegistry);
}

public async execute(task: TaskModel, _context: unknown): Promise<unknown> {
const prompt = `You are an expert technical writer and documentation engineer. Create comprehensive documentation for:

Goal: ${task.goal}

Provide:
1. Clear, concise documentation with proper structure
2. API reference documentation (if applicable)
3. Usage examples and code snippets
4. Installation and setup instructions
5. Troubleshooting guide
6. FAQ section

Follow best practices for technical writing:
- Use active voice
- Write for the target audience
- Include diagrams where helpful (text-based)
- Ensure consistency in terminology`;

try {
const response = await this.callLLM(prompt);
return {
agentId: this.id,
role: this.role,
taskId: task.id,
providerId: this.providerId,
status: 'success',
output: response.text,
usage: response.usage,
toolCalls: response.toolCalls,
};
} catch (error) {
return {
agentId: this.id,
role: this.role,
taskId: task.id,
status: 'failure',
error: error instanceof Error ? error.message : String(error),
};
}
}
}

export class QAAgent extends BaseSubAgent {
constructor(id: string, config?: AgentConfig) {
super(id, 'qa', config);
export class QAAgent extends BaseExtendedAgent {
constructor(id: string, config?: AgentConfig, providerRegistry?: ProviderRegistry) {
super(id, 'qa', config, providerRegistry);
}

public async execute(task: TaskModel, _context: unknown): Promise<unknown> {
const prompt = `You are an expert quality assurance engineer. Perform comprehensive QA analysis for:

Goal: ${task.goal}

Provide:
1. Test plan with test scenarios
2. Functional testing checklist
3. Non-functional testing requirements (performance, security, usability)
4. Edge cases and boundary conditions
5. Regression testing strategy
6. Acceptance criteria validation
7. Defect reports with severity ratings

QA Best Practices:
- Test from user perspective
- Consider all user roles and permissions
- Validate against requirements
- Document reproducible steps for any issues
- Prioritize findings by impact`;

try {
const response = await this.callLLM(prompt);
return {
agentId: this.id,
role: this.role,
taskId: task.id,
providerId: this.providerId,
status: 'success',
output: response.text,
usage: response.usage,
toolCalls: response.toolCalls,
};
} catch (error) {
return {
agentId: this.id,
role: this.role,
taskId: task.id,
status: 'failure',
error: error instanceof Error ? error.message : String(error),
};
}
}
}
1 change: 1 addition & 0 deletions packages/agent/agent-platform/src/sub-agents/index.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
export * from './interfaces.js';
export * from './errors.js';
export * from './sub-agent.js';
export * from './extended-agents.js';
export * from './sub-agent-factory.js';
export * from './agent-pool.js';
export * from './task-splitter.js';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
import type { AgentRole, SubAgent } from './interfaces.js';
import { CoderAgent, ReviewerAgent, TesterAgent, SecurityAgent } from './sub-agent.js';
import { PlannerAgent, ArchitectAgent, DocumentationAgent, QAAgent } from './extended-agents.js';
import {
PlannerAgent,
ArchitectAgent,
CoderAgent,
ReviewerAgent,
TesterAgent,
SecurityAgent,
} from './sub-agent.js';
import { DocumentationAgent, QAAgent } from './extended-agents.js';

export class SubAgentFactory {
public createAgent(role: AgentRole): SubAgent {
Expand Down
Loading