// Copyright (c) Microsoft. All rights reserved.
using System.ComponentModel;
using Microsoft.DurableTask;
namespace Microsoft.Agents.AI.DurableTask;
///
/// Agent-related extension methods for the class.
///
[EditorBrowsable(EditorBrowsableState.Never)]
public static class TaskOrchestrationContextExtensions
{
///
/// Gets a for interacting with hosted agents within an orchestration.
///
/// The orchestration context.
/// The name of the agent.
/// Thrown when is null or empty.
/// A that can be used to interact with the agent.
public static DurableAIAgent GetAgent(
this TaskOrchestrationContext context,
string agentName)
{
ArgumentException.ThrowIfNullOrEmpty(agentName);
return new DurableAIAgent(context, agentName);
}
///
/// Generates an for an agent.
///
///
/// This method is deterministic and safe for use in an orchestration context.
///
/// The orchestration context.
/// The name of the agent.
/// Thrown when is null or empty.
/// The generated agent session ID.
internal static AgentSessionId NewAgentSessionId(
this TaskOrchestrationContext context,
string agentName)
{
ArgumentException.ThrowIfNullOrEmpty(agentName);
return new AgentSessionId(agentName, context.NewGuid().ToString("N"));
}
}