PouryaKit.AI
The Host's one chat client, for OpenAI, Azure OpenAI or Ollama, built from validated options.
The Host's one chat client, for OpenAI, Azure OpenAI or Ollama, built from validated options. A run of that client may call a Module's command or query as a Gateway tool: each call runs through the Module's Gateway as an Operation of its own, with the run's Operation Context continued, so validation, the authorizers and the tenant requirement apply to it. Over the same client, agents of the Microsoft Agent Framework run plain, streamed or for a typed answer.
Install
dotnet add package PouryaKit.AI --prereleaseWhen to use it
- A Feature answers in natural language, or lets a model look things up through the Module's own queries.
- You compose the Host's chat client for a hosted provider or a local Ollama.
- A run needs a Module's command or query, or an MCP server's tools.
- An agent keeps a conversation's session and memory per Actor, or a workflow runs several agents.
- You check every call to the model with a guardrail.
It builds on PouryaKit.Modularity, whose Gateway its tools call. PouryaKit.AI.Postgres adds semantic search.
Quick start
Register the Host's one client and bind its options, as the Proving Sample does:
builder.Services.AddPouryaKitAI();
builder.Services.Configure<PouryaKitAIOptions>(
builder.Configuration.GetSection("PouryaKit:AI")
);
builder.Services.AddSingleton<IChatGuardrail, CardNumberGuardrail>();Turn a query into a Gateway tool, in the handler that builds the run:
var getProduct = catalog.Tool(
"GetProduct",
"Finds one product of the catalog by its id: its id, its category's id and its name.",
context,
(ProductToFind product) => new GetProductQuery(product.ProductId)
);What you get
- One
IChatClientper Host, wrapped in its allow-list, iteration cap and the guardrails the Host registers. - Gateway tools that run as Operations, under the run's Operation Context.
- MCP tools of the servers the Host's options name, under the same allow-list.
- Agents and workflows over that client, with sessions and memory in your application's stores.
- No resilience of its own on the provider's client, so a Host whose defaults add one pipeline to every client keeps exactly that one.
The model decides what to call; the Kit decides what each call may do. A run inside an authorized Operation gives its tool calls that Operation's authority, so give such a run only the tools its Operation may run.