A strongly-typed .NET client library for the OMEGA Federation Core API.
dotnet add package Omega.Sdkusing Omega.Sdk;
// Create client with options
var client = new OmegaClient(new OmegaClientOptions
{
FederationUrl = "http://localhost:9405",
ApiKey = "your-api-key",
TenantId = "my-tenant",
ActorId = "my-actor"
});
// Check health
var health = await client.GetHealthAsync();
Console.WriteLine($"Status: {health.Status}");
// List tools
var tools = await client.Tools.ListAsync();
Console.WriteLine($"Tools: {tools.Items.Count}");
// Invoke a tool
var result = await client.Tools.InvokeAsync("my-tool", new { Input = "value" });
Console.WriteLine($"Result: {result.Result}");The SDK can be configured via environment variables:
OMEGA_FEDERATION_URL=http://localhost:9405
OMEGA_API_KEY=your-api-key
OMEGA_TENANT_ID=my-tenant
OMEGA_ACTOR_ID=my-actor
OMEGA_TIMEOUT_MS=120000
OMEGA_MAX_RETRIES=3var client = OmegaClient.FromEnvironment();// List tools
var tools = await client.Tools.ListAsync(new ToolListRequest
{
Capability = "search"
});
// Get tool details
var tool = await client.Tools.GetAsync("tool-id");
// Invoke tool
var result = await client.Tools.InvokeAsync("tool-id", new { Query = "hello" });// List agents
var agents = await client.Agents.ListAsync(new AgentListRequest
{
Kind = "titan"
});
// Get agent details
var agent = await client.Agents.GetAsync("agent-id");// Create async task
var task = await client.Tasks.CreateAsync("workflow.run", new { Workflow = "my-wf" });
// Wait for completion
var completed = await client.Tasks.WaitForCompletionAsync(task.TaskId);// List evidence packs
var packs = await client.Evidence.ListAsync();
// Verify integrity
var verification = await client.Evidence.VerifyAsync("pack-hash");// Start workflow
var run = await client.Workflows.RunWorkflowAsync("council-of-titans", new
{
Topic = "brand strategy"
});
// Wait for completion (or pause)
var result = await client.Workflows.WaitForCompletionAsync(run.RunId);
// Resume if paused at gate
if (result.Status == WorkflowStatus.Paused && result.GateInfo != null)
{
await client.Workflows.ResumeRunAsync(
run.RunId,
result.GateInfo.GateId,
decision: "approve",
input: new Dictionary<string, object> { ["answers"] = new[] { "context" } }
);
}The SDK provides typed exceptions:
using Omega.Sdk.Exceptions;
try
{
await client.Tools.GetAsync("nonexistent");
}
catch (ConnectionException ex)
{
// Core is not running or unreachable
Console.Error.WriteLine(ex.Message); // Displays helpful setup instructions
}
catch (NotFoundException ex)
{
Console.WriteLine($"Tool not found: {ex.ResourceId}");
}
catch (RateLimitException ex)
{
Console.WriteLine($"Rate limited, retry after: {ex.RetryAfterMs}ms");
}
catch (OmegaException ex)
{
Console.WriteLine($"Error: {ex.Code} - {ex.Message}");
}If you get a ConnectionException when trying to use the SDK:
For local development:
-
Verify Omega Core is running:
curl http://localhost:9405/health
-
Start Core if not running:
docker compose up -d # or omega-core start -
Check the Federation URL in your code matches where Core is running
For production/cloud:
- Verify the Core instance is running and accessible
- Check network connectivity
- Verify the
FederationUrlconfiguration is correct
You can explicitly verify connectivity before making requests:
try
{
var isConnected = await client.VerifyConnectionAsync();
Console.WriteLine($"Connected to Omega Core: {isConnected}");
}
catch (ConnectionException ex)
{
Console.Error.WriteLine($"Cannot connect to Core: {ex.Message}");
}- .NET 8.0 or later
- C# 12.0 or later
MIT License
Powered by OMEGA. Governed by Keon.