A Zig implementation of the AGiXT SDK for interacting with AGiXT API endpoints. This SDK provides a native Zig interface for managing agents, conversations, and other AGiXT functionality.
- Agent Management (create, delete, update, list)
- Conversation Handling (create, manage, interact)
- Authentication Support (user registration, login)
- Chat and Instruction Capabilities
- Memory Management
- Command Execution
- Chain Operations
- Extensible Design
- Zig 0.11.0 or later
- AGiXT Server (running locally or remote)
- Add the SDK to your project:
// build.zig.zon
.{
.dependencies = .{
.agixt_sdk = .{
.url = "https://github.com/birdup000/AGiXT-Zig-SDK/archive/refs/tags/v0.1.0.tar.gz",
// Add appropriate hash after release
},
},
}
- Include in your build.zig:
const agixt_sdk_dep = b.dependency("agixt_sdk", .{
.target = target,
.optimize = optimize,
});
exe.addModule("agixt_sdk", agixt_sdk_dep.module("agixt_sdk"));
const std = @import("std");
const AGiXTSDK = @import("agixt_sdk").AGiXTSDK;
pub fn main() !void {
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
defer _ = gpa.deinit();
const allocator = gpa.allocator();
// Initialize the SDK
var client = try AGiXTSDK.init(
allocator,
null, // default base_uri: http://localhost:7437
null, // no API key
true, // verbose mode
);
defer client.deinit();
// Create an agent
const new_agent = try client.addAgent(
"test_agent",
.{ .provider = "gpt4free" },
null,
null,
);
// Start a conversation
const conversation = try client.newConversation(
"test_agent",
"test_conversation",
null,
);
// Chat with the agent
const response = try client.chat(
"test_agent",
"Hello, how are you?",
"test_conversation",
4,
);
std.debug.print("Agent response: {s}\n", .{response});
}
This Zig SDK provides a comprehensive interface for interacting with the AGiXT API. It supports agent management, conversation handling, authentication, and more. Below are code snippets illustrating basic usage. For detailed API usage, please refer to the source code in src/sdk.zig
.
var client = try AGiXTSDK.init(
allocator,
null, // default base_uri: http://localhost:7437
null, // no API key
true, // verbose mode
);
defer client.deinit();
const new_agent = try client.addAgent(
"test_agent",
.{ .provider = "gpt4free" },
null,
null,
);
const conversation = try client.newConversation(
"test_agent",
"test_conversation",
null,
);
const response = try client.chat(
"test_agent",
"Hello, how are you?",
"test_conversation",
4,
);
std.debug.print("Agent response: {s}\n", .{response});
The SDK uses Zig's error union type. Example:
const result = client.addAgent("agent_name", settings, null, null) catch |err| {
switch (err) {
error.NetworkError => std.debug.print("Network error\n", .{}),
error.ServerError => std.debug.print("Server error\n", .{}),
else => std.debug.print("Unknown error\n", .{}),
}
return;
};
For a complete list of functions and error types, please refer to the source code.
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature
) - Commit your changes (
git commit -m 'Add some amazing feature'
) - Push to the branch (
git push origin feature/amazing-feature
) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
- AGiXT Team for the original Python SDK
- Zig community for the amazing programming language
For support, please open an issue in the GitHub repository or contact the maintainers.
## Contributing
1. Fork the repository
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
4. Push to the branch (`git push origin feature/amazing-feature`)
5. Open a Pull Request
## License
This project is licensed under the MIT License - see the LICENSE file for details.
## Acknowledgments
- AGiXT Team for the original Python SDK
- Zig community for the amazing programming language
## Support
For support, please open an issue in the GitHub repository or contact the maintainers.