OxyJen is the missing AI framework for Java & JVM enterprises.
AI Orchestration Framework for Java - Build complex AI pipelines with simplicity and power.
Oxyjen is a graph-based orchestration framework for building AI applications in Java. It provides a clean, extensible architecture for connecting LLMs, data processors, and custom logic into powerful workflows.
Think of it as the plumbing for your AI pipelines, you focus on what each step does, Oxyjen handles the execution flow.
I get it, this is the first question you're thinking. Let me be completely honest.
I started building Oxyjen without knowing LangChain4j existed. When I discovered it halfway through, I had a choice:
- Abandon the project
- Find a way to differentiate
I chose to differentiate. I wanted to learn how OSS works. I wanted to build this in public.
LangChain4j is a solid framework focused on feature breadth, lots of integrations, lots of tools. That's great for many use cases.
Oxyjen is taking a different path, focused on developer experience and production readiness
Oxyjen is meant for runtime reliability, your graphs will be self-aware and will make sure to provide less failure, even if a node fails, Oxyjen will learn from it and improve.
Features like, async, project loom, parallel processing, java concurrency will lay down the foundation of fail-safe graph structure for Oxyjen.
I'm not here to compete with Langchain4j, I'm here to create a framework for devs.
Modern AI applications need more than just API calls. They need:
- Complex workflows with multiple steps
- Type safety to catch errors at compile time
- Observability to debug what's happening
- Testability to ensure reliability
- Extensibility to add custom logic
Oxyjen provides all of this with a simple, intuitive API.
// Build a 3-step text processing pipeline
Graph pipeline = GraphBuilder.named("text-processor")
.addNode(new UppercaseNode())
.addNode(new ReverseNode())
.addNode(new PrefixNode("OUTPUT: "))
.build();
// Execute with context
NodeContext context = new NodeContext();
Executor executor = new Executor();
String result = executor.run(pipeline, "hello world", context);
System.out.println(result);
// Output: OUTPUT: DLROW OLLEHThat's it! Clean, simple, powerful.
Oxyjen is built around four core concepts:
A Graph defines the structure of your pipeline - which nodes run in what order.
public class Graph {
private final String name;
private final List<NodePlugin<?, ?>> nodes;
// Add nodes to your pipeline
public Graph addNode(NodePlugin<?, ?> node);
// Get all nodes in execution order
public List<NodePlugin<?, ?>> getNodes();
}Think of it as: Your pipeline's DNA - it knows what needs to happen, but doesn't execute anything.
A NodePlugin is a single step in your pipeline. Each node transforms input into output.
public interface NodePlugin<I, O> {
// Core processing logic
O process(I input, NodeContext context);
// Unique identifier for this node
default String getName() {
return this.getClass().getSimpleName();
}
// Lifecycle hooks for setup/cleanup
default void onStart(NodeContext context) {}
default void onFinish(NodeContext context) {}
default void onError(Exception e, NodeContext context) {}
}Think of it as: A Lego brick - small, focused, composable.
Example node:
public class SummarizerNode implements NodePlugin<String, String> {
@Override
public String process(String input, NodeContext context) {
context.getLogger().info("Summarizing text...");
// Your logic here (will be LLM call in v0.2)
return "Summary: " + input.substring(0, 100);
}
@Override
public void onStart(NodeContext context) {
context.getLogger().info("Summarizer node starting");
}
}The Executor runs your graph, calling each node in sequence and passing outputs to inputs.
public class Executor {
public <I, O> O run(Graph graph, I input, NodeContext context) {
// Validates graph structure
// Executes nodes sequentially
// Handles errors and lifecycle hooks
// Returns final output
}
}Think of it as: The conductor of an orchestra - coordinates everything.
How it works:
- Takes your
Graphand initialinput - For each node:
- Calls
onStart()lifecycle hook - Executes
process()with current data - Calls
onFinish()lifecycle hook - Passes output to next node
- Calls
- Returns final result
The NodeContext is shared across all nodes, providing logging and state management.
public class NodeContext {
// Store/retrieve shared data
public void set(String key, Object value);
public <T> T get(String key);
// Logging
public Logger getLogger();
public OxyLogger getOxyjenLogger();
// Metadata (e.g., graph name, execution ID)
public void setMetadata(String key, Object value);
public <T> T getMetadata(String key);
// Error handling
public ExceptionHandler getExceptionHandler();
}Think of it as: A shared notebook that all nodes can read/write to.
Example usage:
public String process(String input, NodeContext ctx) {
// Log what's happening
ctx.getLogger().info("Processing: " + input);
// Store intermediate results
ctx.set("word_count", input.split(" ").length);
// Share data between nodes
String previousResult = ctx.get("previous_output");
return processedOutput;
}package examples;
import io.oxyjen.core.*;
public class ContentPipeline {
public static void main(String[] args) {
// Step 1: Define your nodes
NodePlugin<String, String> validator = new ValidationNode();
NodePlugin<String, String> processor = new ProcessingNode();
NodePlugin<String, String> formatter = new FormatterNode();
// Step 2: Build your graph
Graph pipeline = GraphBuilder.named("content-pipeline")
.addNode(validator)
.addNode(processor)
.addNode(formatter)
.build();
// Step 3: Create execution context
NodeContext context = new NodeContext();
context.set("max_length", 100);
// Step 4: Execute
Executor executor = new Executor();
String result = executor.run(pipeline, "Raw input text", context);
System.out.println("Final output: " + result);
System.out.println("Word count: " + context.get("word_count"));
}
}
// Example node implementations
class ValidationNode implements NodePlugin<String, String> {
@Override
public String process(String input, NodeContext ctx) {
if (input == null || input.isEmpty()) {
throw new IllegalArgumentException("Input cannot be empty");
}
ctx.getLogger().info("✓ Input validated");
return input;
}
}
class ProcessingNode implements NodePlugin<String, String> {
@Override
public String process(String input, NodeContext ctx) {
String processed = input.toUpperCase().trim();
ctx.set("word_count", processed.split(" ").length);
ctx.getLogger().info("✓ Text processed");
return processed;
}
}
class FormatterNode implements NodePlugin<String, String> {
@Override
public String process(String input, NodeContext ctx) {
Integer maxLength = ctx.get("max_length");
String formatted = input.length() > maxLength
? input.substring(0, maxLength) + "..."
: input;
ctx.getLogger().info("✓ Text formatted");
return formatted;
}
}- Bring AI orchestration (LangChain/LangGraph style) to Java.
- Build enterprise-first modules: LLM agents, Audit tools, Secure complex Workflow Engine.
- Focus on performance, security, and observability.
- I'm building this to learn java in a much deeper way.
- RAG support - Vector databases, embeddings, document loaders
- Cost management - Budgets, limits, usage tracking
- Enterprise features - Audit logs, RBAC, compliance
- Multi-tenancy - Isolate data between users/orgs
- Async execution - Run nodes in parallel
- DAG support - Complex branching workflows
- Conditional routing - "If X, then run node Y"
- Retry logic - Automatic retries with backoff
- Circuit breakers - Fail fast when services are down
- Streaming responses
- Token counting & cost tracking
Add JitPack repository:
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>Add dependency:
<dependency>
<groupId>com.github.11divyansh</groupId>
<artifactId>Oxyjen</artifactId>
<version>v0.3.0</version>
</dependency>repositories {
maven { url 'https://jitpack.io' }
}
dependencies {
implementation 'com.github.11divyansh:Oxyjen:v0.3.0'
}git clone https://github.com/11divyansh/OxyJen.git
cd OxyJen
mvn clean installAfter installation, verify by importing:
import io.oxyjen.core.*;
import io.oxyjen.llm.*;Built with ❤️ by Divyansh Bhatt - a BTech CS student who believes Java deserves world-class AI tooling.
This started as a learning project, but I'm committed to making it production-ready. I know this is not big yet, but lets make it valuable.
- Star this repo to follow the journey and be a part of it
- Report bugs via Issues
- Suggest features via Discussions
- Contribute code or documentation
- Share on Twitter/LinkedIn if you find it useful
** Watch for updates on v0.2 progress!**
Apache 2.0 (open-source, enterprise-friendly)