Agent improvements (#200)

* moved agent tool creation functions and helpers to separate file

* refactored the while loop into smaller functions

* added structured context passing while handing off

* fixed zod issues

* fixed tool calls issue in task and pipeline agents

* Allow pipeline to be set as start agent

* fixed pipeline agent looping issue when made start agent

* fix to show correct agent name after handoffs

* addressed review comments on not touching workflow types

* filter out empty agent messages

* partial: make task agents not loop when set as start agent

* Resolve merge conflicts after rebase - keep both onSetMainAgent prop and HTMLDivElement ref type

* Allow pipeline to be set as start agent

* Add infinite loop protection and remove JSON formatting from agent instructions

* remove whitespace diffs

---------

Co-authored-by: Ramnique Singh <30795890+ramnique@users.noreply.github.com>
This commit is contained in:
arkml 2025-08-14 19:22:43 +05:30 committed by GitHub
parent 6ce96f942f
commit 852e02e49e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 1965 additions and 736 deletions

View file

@ -280,6 +280,7 @@ interface PipelineCardProps {
onDeletePipeline: (name: string) => void;
onDeleteAgent: (name: string) => void;
onAddAgentToPipeline: (pipelineName: string) => void;
onSetMainAgent: (name: string) => void;
selectedRef: React.RefObject<HTMLDivElement | null>;
startAgentName: string | null;
dragHandle?: React.ReactNode;
@ -294,6 +295,7 @@ const PipelineCard = ({
onDeletePipeline,
onDeleteAgent,
onAddAgentToPipeline,
onSetMainAgent,
selectedRef,
startAgentName,
dragHandle,
@ -347,6 +349,11 @@ const PipelineCard = ({
<div className="flex items-center gap-2">
<span className="text-xs">{pipeline.name}</span>
<span className="text-xs text-gray-500">({pipelineAgents.length} steps)</span>
{startAgentName === pipeline.name && (
<span className="text-xs bg-green-100 dark:bg-green-900/30 text-green-700 dark:text-green-400 px-2 py-0.5 rounded font-medium">
START
</span>
)}
</div>
</button>
@ -362,10 +369,19 @@ const PipelineCard = ({
onAction={(key) => {
if (key === 'delete') {
onDeletePipeline(pipeline.name);
} else if (key === 'set-main-agent') {
onSetMainAgent(pipeline.name);
}
}}
>
<DropdownItem key="delete" className="text-danger">Delete Pipeline</DropdownItem>
{startAgentName !== pipeline.name ? (
<>
<DropdownItem key="set-main-agent">Set as start agent</DropdownItem>
<DropdownItem key="delete" className="text-danger">Delete Pipeline</DropdownItem>
</>
) : (
<DropdownItem key="delete" className="text-danger">Delete Pipeline</DropdownItem>
)}
</DropdownMenu>
</Dropdown>
</div>
@ -740,6 +756,7 @@ export const EntityList = forwardRef<
onDeletePipeline={onDeletePipeline}
onDeleteAgent={onDeleteAgent}
onAddAgentToPipeline={onAddAgentToPipeline}
onSetMainAgent={onSetMainAgent}
selectedRef={selectedRef}
startAgentName={startAgentName}
/>
@ -1663,6 +1680,7 @@ const SortablePipelineItem = ({
onDeletePipeline,
onDeleteAgent,
onAddAgentToPipeline,
onSetMainAgent,
selectedRef,
startAgentName
}: {
@ -1677,6 +1695,7 @@ const SortablePipelineItem = ({
onDeletePipeline: (name: string) => void;
onDeleteAgent: (name: string) => void;
onAddAgentToPipeline: (pipelineName: string) => void;
onSetMainAgent: (name: string) => void;
selectedRef: React.RefObject<HTMLDivElement | null>;
startAgentName: string | null;
}) => {
@ -1706,6 +1725,7 @@ const SortablePipelineItem = ({
onDeletePipeline={onDeletePipeline}
onDeleteAgent={onDeleteAgent}
onAddAgentToPipeline={onAddAgentToPipeline}
onSetMainAgent={onSetMainAgent}
selectedRef={selectedRef}
startAgentName={startAgentName}
dragHandle={