BUILD WITH AGENTS

Agents

Define focused AI behavior in C# and run it inside your application.

An agent brings together instructions, a model, and the capabilities the model may use. Your application registers the definition; the Runiq runtime handles execution.

Use an agent when a request needs interpretation, tool selection, or a generated response. Attach only the tools and knowledge that its responsibility requires.

What makes an agent

Building blockResponsibility
IdentityA stable id for runtime lookup and a readable name for Studio.
InstructionsThe agent's role, boundaries, and expected response style.
ModelA provider/model reference and its connection settings.
ToolsTyped C# operations attached with AddTool<TTool>().
RAG, when neededRetrieval configured with UseRag(...) against a named index.

Tools and RAG are optional. Start with a small definition and add capabilities as your feature needs them.

A definition in C#

C#
using Runiq.AI.Agents;

var agent = new Agent(
    id: "support-agent",
    name: "Support Agent",
    instructions: """
        Help users understand the application.
        Ask for missing details before giving specific guidance.
        Keep answers concise and state uncertainty clearly.
        """,
    model: "openai/gpt-5",
    apiKey: builder.Configuration["OpenAI:ApiKey"]);

This snippet belongs in your host setup after creating builder. It creates a definition; register it before running it by id. Choose a model available through your provider account.

How a request runs

  1. Your application passes a message and agent id to the runtime.
  2. The runtime resolves the definition and prepares the model request. Configured RAG retrieval can supply passages before the initial model call.
  3. The model answers or requests an attached tool. Runiq executes the tool and returns its output to the model for continuation.
  4. Your application receives a completed result or streaming events. Studio helps inspect the run.

A tool result is intermediate data; the model can use it to compose the final response.

Build your first agent

Define and register an agent →

Create a small definition and make it available to your application.

Run an agent →

Call the runtime from C# and handle results or streaming events.

Inspect a run in Studio →

Check the selected model, tool calls, and retrieved sources.

On this page