mirror of
https://github.com/microsoft/agent-framework.git
synced 2026-06-16 21:04:09 +08:00
.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:
@@ -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 [];
|
||||
|
||||
Reference in New Issue
Block a user