SwarmNode.Net.Client 1.0.1

dotnet add package SwarmNode.Net.Client --version 1.0.1
                    
NuGet\Install-Package SwarmNode.Net.Client -Version 1.0.1
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SwarmNode.Net.Client" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SwarmNode.Net.Client" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="SwarmNode.Net.Client" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add SwarmNode.Net.Client --version 1.0.1
                    
#r "nuget: SwarmNode.Net.Client, 1.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package SwarmNode.Net.Client@1.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=SwarmNode.Net.Client&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=SwarmNode.Net.Client&version=1.0.1
                    
Install as a Cake Tool

SwarmNode .NET SDK

NuGet Version

The SwarmNode .NET SDK provides convenient access to the SwarmNode REST API from any .NET 8.0+ application. The SDK includes rich type definitions and enables developers to manage agents, execute tasks, and schedule cron jobs with ease.

Documentation

Full documentation of the SDK is available at https://swarmnode.ai/docs/sdk/introduction. You may also want to check out the REST API Reference.

Installation

You can install the SDK via NuGet:

dotnet add package SwarmNode.Net.Client

Usage

Once installed, you can use it to make requests.

Create an Agent

using SwarmNode.Net;

SwarmNodeClient.ApiKey = "YOUR_API_KEY";

var agent = await SwarmNodeClient.Agent.CreateAsync(new AgentCreateRequest
{
    Name = "My Agent",
    Script = "def main(request, store):\n    return request.payload",
    Requirements = "requests==2.31.0\npandas==2.1.4",
    EnvVars = "FOO=bar\nBAZ=qux",
    PythonVersion = "3.11",
    StoreId = "YOUR_STORE_ID",
});

Execute an Agent

using SwarmNode.Net;

SwarmNodeClient.ApiKey = "YOUR_API_KEY";

var agent = await SwarmNodeClient.Agent.GetAsync("YOUR_AGENT_ID");

var execution = await agent.ExecuteAsync(new { key = "value" });

Create a Cron Job

using SwarmNode.Net;

SwarmNodeClient.ApiKey = "YOUR_API_KEY";

var cronJob = await SwarmNodeClient.CronJob.CreateAsync(new CronJobCreateRequest
{
    AgentId = "YOUR_AGENT_ID",
    Name = "My Cron Job",
    Expression = "* * * * *",
});

Stream Executions from a Cron Job

using SwarmNode.Net;

SwarmNodeClient.ApiKey = "YOUR_API_KEY";

var cronJob = await SwarmNodeClient.CronJob.GetAsync("YOUR_CRON_JOB_ID");

await foreach (var execution in cronJob.StreamExecutionsAsync())
{
    Console.WriteLine($"Execution received: {execution.Id}");
}

These are only a few examples of what you can do with the SDK. Refer to the full documentation to learn more about the SDK capabilities.

Contributing

Contributions are welcome! If you have any ideas or improvements, feel free to submit a pull request or open an issue.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.1 161 12/29/2024
1.0.0 146 12/29/2024