Skip to content

[Agent] Revisit Agent Component Interface #1406

@chr-hertel

Description

@chr-hertel

This is something that is keeping my head busy for a while now, and I'd like to get some feedback/input.

Motivation

  • Platform and Agent interface are quite similar despite having quite different purpose
  • Agents are well more defined from a functional point of view than the current interface offers
    • Tools are only second level citizen, which is not great - ofc they are optional, but that extra way to register them feels odd
    • Every agent should have a name and instruction - having it optional or also with that SystemPromptProcessor is extra effort
    • i'm considering the component, not the bundle integration which basically fixes parts of it with hiding the extra work
  • promote MultiAgent capability into the main agent

Goal

$agent = new Agent(
    name: 'research',
    instruction: '...',
    tools: [...], // which could include local tools, remote tools, and subagents
    handoffs: [...], // routing like with MultiAgent
);

On top it would be great to design for progress updates, human interactions, or parallel executions.

a) Similar to Process component:

$execution = $agent->run($input, $options);

echo $execution->getOutput();
$execution = $agent->start($input, $options);

foreach ($execution as $type => $update) {
    if (Agent::INTERACT === $type) {
         // on hold until main runtime provides feedback => $feedback
         $agent->continue($feedback, $options);
    }

    if (Agent::PROGRESS === $type) {
         echo $update; // "Search for xyz on the web."
    }
}

b) More promise style

$agent->run($input, $options)
    ->onInteraction(...)
    ->onProgress(...)
    ->onResult(...);

for both we could wrap it into an runner service, that takes care for putting an agent to rest, wakes it up, maybe handles async, and integrates with the event dispatcher - similar to features we see in Chat right now, including forking/branching/rewind?

just sharing thoughts, no point of action right away

Metadata

Metadata

Assignees

Labels

AgentIssues & PRs about the AI Agent componentBC BreakBreaking the Backwards Compatibility PromiseBlockedThis PR is currently blocked by another topic.Status: Waiting feedback

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions