A Pure Python AI Agent Framework with Intelยฎ OpenVINOโข Optimization
Built from scratch โ A complete AI Agent Framework for orchestrating agentic workflows without using CrewAI, AutoGen, LangGraph, or n8n.
| What | Description |
|---|---|
| What is it? | A Python framework SDK for building AI agents with DAG workflows, tools, memory, and observability |
| Why? | Intel Unnati Problem Statement #2: Build-Your-Own AI Agent Framework |
| Key Features | Flow DAG execution, YAML orchestration, Tool registry with schema validation, Memory store, Structured logging, Intelยฎ OpenVINOโข ML optimization |
| Demo Time | < 30 seconds to run all demos |
| Lines of Code | ~4,500 lines of pure Python (no agent framework dependencies) |
| Problem Statement Requirement | Implementation | Location |
|---|---|---|
| Define and execute task flows (DAG) | โ
Flow class with topological sort, parallel execution |
framework/flow.py |
| Support input handlers, tools/actions | โ
ToolRegistry, BaseTool with schema validation |
framework/tools.py |
| Output actions | โ
FileWriteTool, HTTPTool, task outputs |
framework/tools.py |
| Include memory | โ
MemoryStore with namespaces, TTL, persistence |
framework/memory.py |
| Guardrails | โ Schema validation, retries, timeouts, error handling | framework/tools.py, task.py |
| Observability (logs, metrics) | โ
FlowLogger, MetricsCollector, AuditLog |
framework/logging.py |
| Orchestrator | โ
YAML-based Orchestrator with state persistence |
framework/orchestrator.PY |
| Apache components | โ Ready for Kafka/Airflow integration (REST API included) | api/server.py |
| Intelยฎ OpenVINOโข optimization | โ
OpenVINOTextClassifier, OpenVINOEmbedding |
framework/openvino_tools.py |
| Framework SDK with APIs | โ
Agent class, decorators, builders |
framework/sdk.py |
| Two reference agents | โ Research Agent, Data Processing Agent | examples/agents_demo.py |
| Performance benchmarks | โ Before/after OpenVINO comparison | examples/openvino_benchmark.py |
| Retries and timeouts | โ Exponential backoff, configurable timeouts | framework/task.py |
git clone https://github.com/Precise-Goals/Intel-Ai-Unnati-Program---Internship.git
cd Intel-Ai-Unnati-Program---Internship
pip install -r requirements.txt# Step 1: Set PYTHONPATH (required before running demos)
# Linux/macOS:
export PYTHONPATH=$(pwd)
# Windows PowerShell:
$env:PYTHONPATH = (Get-Location).Path
# Windows CMD:
set PYTHONPATH=%cd%
# Step 2: Run the demos
python examples/agents_demo.py # Reference Agents (Research + Data Processing)
python examples/tools_demo.py # Tool System with Schema Validation
python examples/orchestrator_demo.py # YAML Orchestrator with State Persistence
python examples/logging_demo.py # Structured Logging Demo
python examples/openvino_benchmark.py # OpenVINO Benchmark๐ก Tip: On Windows, you can also run
run_demos.batwhich sets PYTHONPATH automatically.
from framework import Agent, FunctionTask, tool
# Define a tool with schema validation
@tool(name="analyze", description="Analyze text sentiment")
def analyze(text: str) -> dict:
return {"sentiment": "positive", "confidence": 0.95}
# Create an agent and workflow
agent = Agent("demo_agent")
flow = agent.create_flow("analysis_flow")
flow.add_task(FunctionTask("fetch", lambda ctx: {"text": "Great product!"}))
flow.add_task(FunctionTask("analyze", lambda ctx: analyze(ctx["fetch_result"]["text"])))
flow.add_dependency("analyze", "fetch")
# Execute
result = agent.run_flow("analysis_flow", {})
print(f"Success: {result.success}") # True| Metric | PyTorch (Baseline) | Intelยฎ OpenVINOโข | Improvement |
|---|---|---|---|
| Avg Latency | 45.23 ms | 28.41 ms | 37.2% faster |
| Min Latency | 42.18 ms | 26.54 ms | - |
| Max Latency | 51.87 ms | 32.19 ms | - |
| P95 Latency | 49.31 ms | 30.87 ms | - |
| Throughput | 22.11 req/s | 35.21 req/s | 59.2% higher |
| Speedup | 1.0x | 1.59x | - |
Model: distilbert-base-uncased-finetuned-sst-2-english
| Metric | PyTorch (Baseline) | Intelยฎ OpenVINOโข | Improvement |
|---|---|---|---|
| Avg Latency | 12.87 ms | 7.94 ms | 38.3% faster |
| Min Latency | 11.92 ms | 7.21 ms | - |
| Max Latency | 15.43 ms | 9.18 ms | - |
| P95 Latency | 14.21 ms | 8.76 ms | - |
| Throughput | 77.73 req/s | 125.94 req/s | 62.0% higher |
| Speedup | 1.0x | 1.62x | - |
Model: sentence-transformers/all-MiniLM-L6-v2
๐ก Note: Results measured on Intel CPU. OpenVINO provides best optimization on Intelยฎ processors (CPU, iGPU, VPU).
๐ [20:09:42] FLOW_START: research_workflow (b8e59490...) - 5 tasks
โถ [20:09:42] TASK_START: search (function)
โ [20:09:42] TASK_END: search - completed in 0.101s
โถ [20:09:42] TASK_START: extract_entities (function)
โถ [20:09:42] TASK_START: summarize (function) โ Parallel execution!
โ [20:09:42] TASK_END: extract_entities - completed in 0.051s
โ [20:09:42] TASK_END: summarize - completed in 0.101s
โถ [20:09:42] TASK_START: analyze_sentiment (function)
โ [20:09:42] TASK_END: analyze_sentiment - completed in 0.051s
โถ [20:09:42] TASK_START: generate_report (function)
โ [20:09:42] TASK_END: generate_report - completed in 0.000s
โ
[20:09:42] FLOW_END: research_workflow - completed in 0.26s (5 completed, 0 failed)
--- Research Report ---
query: artificial intelligence applications in healthcare
entities: {'persons': ['John Doe'], 'organizations': ['Tech Inc'], ...}
sentiment: {'score': -0.10, 'label': 'neutral', 'confidence': 0.72}
============================================================
PARALLEL WORKFLOW DEMO
============================================================
Workflow: parallel_processing
Status: completed
Duration: 0.01s
Task States:
start: completed
branch_a: completed โ Parallel branches
branch_b: completed โ
merge: completed
Merge Result: {'merged': True, 'total': 300}
State persisted to: workflow_states.json
{"timestamp": "2026-01-01T20:09:42", "event_type": "FLOW_START", "flow_id": "b8e59490", "task_count": 5}
{"timestamp": "2026-01-01T20:09:42", "event_type": "TASK_END", "task_name": "search", "duration_seconds": 0.101}
{"timestamp": "2026-01-01T20:09:42", "event_type": "TASK_RETRY", "task_name": "flaky_task", "attempt": 1, "max_attempts": 3}
{"timestamp": "2026-01-01T20:09:42", "event_type": "FLOW_END", "status": "completed", "duration_seconds": 0.26}intel/
โโโ framework/ # Core Framework SDK
โ โโโ __init__.py # Package exports
โ โโโ sdk.py # Agent class, high-level API
โ โโโ task.py # Task abstraction (Function, LLM, Tool, Conditional)
โ โโโ flow.py # DAG execution engine with parallel support
โ โโโ tools.py # Tool registry, BaseTool, schema validation
โ โโโ memory.py # Memory store with namespaces & TTL
โ โโโ logging.py # FlowLogger, MetricsCollector, AuditLog
โ โโโ orchestrator.PY # YAML-based workflow orchestrator
โ โโโ openvino_tools.py # OpenVINO ML optimized tools
โ
โโโ examples/ # Demo & Reference Implementations
โ โโโ agents_demo.py # Research Agent + Data Processing Agent
โ โโโ tools_demo.py # Tool system demonstration
โ โโโ orchestrator_demo.py # YAML orchestration demo
โ โโโ logging_demo.py # Structured logging demo
โ โโโ openvino_benchmark.py # OpenVINO performance benchmark
โ โโโ workflows/ # YAML workflow definitions
โ โโโ research.yaml
โ โโโ data_pipeline.yaml
โ
โโโ api/
โ โโโ server.py # REST API server (FastAPI)
โ
โโโ dashboard/
โ โโโ ui.py # Streamlit monitoring dashboard
โ
โโโ logs/flows/ # Persisted flow logs (JSONL)
โโโ requirements.txt # Python dependencies
โโโ README.md # This file
| Framework | Status | Verification |
|---|---|---|
| CrewAI | โ Not Used | grep -r "crewai" . returns nothing |
| AutoGen | โ Not Used | grep -r "autogen" . returns nothing |
| LangGraph | โ Not Used | grep -r "langgraph" . returns nothing |
| n8n | โ Not Used | grep -r "n8n" . returns nothing |
| Technology | Usage | Location |
|---|---|---|
| Intelยฎ OpenVINOโข | ML model optimization (1.5x-1.6x speedup) | framework/openvino_tools.py |
| Apache-compatible | REST API ready for Kafka/Airflow integration | api/server.py |
| Pure Python | All core logic (~4,500 lines) | framework/*.py |
| pydantic | Data validation | requirements.txt |
| PyYAML | YAML workflow parsing | framework/orchestrator.PY |
| Deliverable | Status | Evidence |
|---|---|---|
| Framework SDK with APIs | โ | framework/sdk.py, framework/__init__.py |
| Flow/DAG execution | โ | framework/flow.py (topological sort, parallel execution) |
| Tool registry | โ | framework/tools.py (BaseTool, schema validation) |
| Memory store | โ | framework/memory.py (namespaces, TTL, persistence) |
| Observability | โ | framework/logging.py (JSONL logs, metrics, audit) |
| YAML orchestrator | โ | framework/orchestrator.PY (state persistence) |
| Reference Agent #1 | โ | Research Agent in examples/agents_demo.py |
| Reference Agent #2 | โ | Data Processing Agent in examples/agents_demo.py |
| OpenVINO optimization | โ | framework/openvino_tools.py with benchmarks |
| Performance benchmarks | โ | examples/openvino_benchmark.py |
| Retries & timeouts | โ | framework/task.py (exponential backoff) |
| Framework Characteristic | Evidence |
|---|---|
| Extensible SDK | Agent, Task, Flow, Tool base classes for users to extend |
| Pluggable components | Tool registry, memory backends, custom task types |
| Decorators for DX | @tool, @log_execution decorators |
| Configuration-driven | YAML workflow definitions |
| APIs for integration | REST API, programmatic flow builder |
| Reusable abstractions | BaseTool, Task, MemoryStore abstract patterns |
# workflows/my_workflow.yaml
name: my_workflow
version: "1.0"
tasks:
- id: fetch_data
type: function
config:
function: mymodule.fetch
- id: process
type: tool
depends_on: [fetch_data]
config:
tool_name: text_processor
tool_args:
operation: uppercase
- id: save
type: function
depends_on: [process]
config:
function: mymodule.savefrom framework.orchestrator import Orchestrator
orch = Orchestrator(state_dir="./states")
result = orch.load_and_run("workflows/my_workflow.yaml")
print(f"Status: {result.status}") # completedfrom framework.openvino_tools import OpenVINOTextClassifier
classifier = OpenVINOTextClassifier(
model_name="distilbert-base-uncased-finetuned-sst-2-english",
use_openvino=True # Enable Intel optimization
)
result = classifier.classify("This product is amazing!")
# {'label': 'POSITIVE', 'confidence': 0.98}| Name | Role | Contact | CGPA | |
|---|---|---|---|---|
| Sarthak Tulsidas Patil | Developer (CSE) | sarthak.patil@nmiet.edu.in | 7387303695 | 9.57 |
| Prathamesh Santosh Kolhe | Developer (CSE) | prathameshkolhe6099@gmail.com | 9975668077 | 9.18 |
| Dhiraj Takale | Developer (CSE) | dhirajtakale17@gmail.com | 8668945438 | 9.27 |
| Name | Role | Contact | |
|---|---|---|---|
| Prof. Jordan Choudhari | Assistant Professor | jordan.choudhari@nmiet.edu.in | 7709754570 |
MIT License - See LICENSE for details.


