A single AI call answers a question. An agent orchestration system solves problems. Hazina’s orchestration layer lets you build AI agents that can use tools, maintain state, and work autonomously toward goals.
What Is Agent Orchestration?
An agent is an AI model connected to tools (functions it can call). The orchestration layer manages:
- Tool execution – The AI decides which tools to call and in what order
- State management – Conversation history and intermediate results
- Error handling – Retries, fallbacks, and graceful degradation
- Security – Controlling what the agent can and cannot do
Creating an Agent
var agent = new HazinaAgent()
.WithSystemPrompt("You are a customer support agent for an e-commerce store.")
.WithTool(new SearchOrdersTool())
.WithTool(new GetProductInfoTool())
.WithTool(new CreateRefundTool())
.WithMaxIterations(10);
var response = await agent.RunAsync("I want to return my order #12345");
Defining Tools
public class SearchOrdersTool : IAgentTool
{
public string Name => "search_orders";
public string Description => "Search for customer orders by order ID or email";
public ToolParameters Parameters => new() {
{ "query", ToolParameterType.String, "Order ID or email address" }
};
public async Task<string> ExecuteAsync(ToolContext context)
{
var query = context.GetParameter<string>("query");
var orders = await _orderService.SearchAsync(query);
return JsonSerializer.Serialize(orders);
}
}
The Orchestration Loop
When you call agent.RunAsync(), Hazina:
- Sends the user message to the LLM with available tools
- If the LLM wants to call a tool, Hazina executes it
- Tool results are sent back to the LLM
- Repeat until the LLM provides a final answer
- Return the response to the user
Terminal Access (ConPTY)
Hazina can even give agents access to a terminal for system operations:
var agent = new HazinaAgent()
.WithSystemPrompt("You are a DevOps agent.")
.WithTerminalAccess(new TerminalOptions {
AllowedCommands = new[] { "git", "dotnet", "npm" },
WorkingDirectory = "/app",
MaxSessionDuration = TimeSpan.FromMinutes(5)
});
This powers the Hazina Orchestration demo – a web-based terminal where AI can execute real commands.
In the next post, we’ll explore Social Content Providers – connecting to WordPress, LinkedIn, and more.
Frequently Asked Questions
Agent orchestration in AI refers to the process of managing multiple AI agents that can utilize various tools and maintain state to solve complex problems. It involves coordinating their actions, managing tool execution, and handling errors while ensuring security.
Hazina’s orchestration layer allows developers to create AI agents that can autonomously perform tasks by calling specific tools, managing conversation history, and handling errors. It operates through an orchestration loop that processes user input, executes necessary tools, and returns final responses.
Hazina agents can integrate various tools such as order search, product information retrieval, and refund processing tools. Developers can define these tools with specific parameters to enable agents to perform a wide range of tasks effectively.
Yes, Hazina allows agents to access a terminal to execute real commands, such as ‘git’ or ‘npm’. This feature is useful for DevOps agents and enables them to perform system operations in a controlled environment.