.NET: feat: Improve Support for AIAgent-as-Executor (#432)

* feat: Support Executor-targeted messages

This adds support for only sending a message to a given executor. Messages will still only route through connected edges.

* feat: Support sending all valid input types after starting a run

* feat: Normalize AIAgent-as-Executor Message Protocol to use MEAI types
This commit is contained in:
Jacob Alber
2025-08-19 20:04:03 +00:00
committed by GitHub
parent 953ed7560d
commit baaa9c0aee
21 changed files with 595 additions and 52 deletions
@@ -16,17 +16,23 @@ internal class DirectEdgeRunner(IRunnerContext runContext, DirectEdgeData edgeDa
.ConfigureAwait(false);
}
public async ValueTask<IEnumerable<object?>> ChaseAsync(object message)
public async ValueTask<IEnumerable<object?>> ChaseAsync(MessageEnvelope envelope)
{
if (envelope.TargetId != null && this.EdgeData.SinkId != envelope.TargetId)
{
return [];
}
object message = envelope.Message;
if (this.EdgeData.Condition != null && !this.EdgeData.Condition(message))
{
return [];
}
Executor target = await this.FindRouterAsync().ConfigureAwait(false);
if (target.CanHandle(message.GetType()))
if (target.CanHandle(envelope.MessageType))
{
return [await target.ExecuteAsync(message, this.WorkflowContext).ConfigureAwait(false)];
return [await target.ExecuteAsync(message, envelope.MessageType, this.WorkflowContext).ConfigureAwait(false)];
}
return [];