Skip to content

Build an AI Agent framework (not just an app) that can orchestrate agentic workflows from input to output without using existing agent frameworks like crew.ai, AutoGen, or n8n. The framework should support allowing the definition of agentic workflows as a composition of task flows.

License

Notifications You must be signed in to change notification settings

Precise-Goals/Intel-Ai-Unnati-Program---Internship

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

18 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

AI Agent Framework

Intelยฎ Unnati Industrial Training Program 2025

A Pure Python AI Agent Framework with Intelยฎ OpenVINOโ„ข Optimization

Python 3.8+ License: MIT OpenVINO


๐Ÿ“‹ TL;DR (Too Long, Didn't Read) short Overview

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 โ†’ Implementation Mapping

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

๐Ÿ—๏ธ Architecture

ARCHITECTURE


๐Ÿš€ Quick Start (< 2 minutes)

1. Install Dependencies

git clone https://github.com/Precise-Goals/Intel-Ai-Unnati-Program---Internship.git
cd Intel-Ai-Unnati-Program---Internship
pip install -r requirements.txt

2. Run All Demos

# 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.bat which sets PYTHONPATH automatically.

3. Quick Code Example

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

๐Ÿ“Š Benchmark Results: OpenVINO Optimization

Text Classification (Sentiment Analysis)

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

Text Embeddings (RAG/Search)

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).


๐Ÿ“ Sample Agent Outputs

Research Agent Demo

๐Ÿš€ [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}

Orchestrator Demo (YAML Workflow)

============================================================
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

Structured Logging Output (JSONL)

{"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}

๐Ÿ“ Project Structure

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

โœ… Compliance Checklist

โŒ Forbidden Frameworks (NOT USED)

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

โœ… Allowed Technologies (USED)

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

โœ… Deliverables Completed

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)

โœ… This is a FRAMEWORK, Not Just an App

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

๐Ÿ”ง Advanced Usage

Define a YAML Workflow

# 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.save

Run with Orchestrator

from framework.orchestrator import Orchestrator

orch = Orchestrator(state_dir="./states")
result = orch.load_and_run("workflows/my_workflow.yaml")
print(f"Status: {result.status}")  # completed

Use OpenVINO-Optimized Tools

from 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}

๐Ÿ‘ฅ Team Falcons

Name Role Email 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

Mentor

Name Role Email Contact
Prof. Jordan Choudhari Assistant Professor jordan.choudhari@nmiet.edu.in 7709754570

๐Ÿ“œ License

MIT License - See LICENSE for details.


alt text

Built with โค๏ธ by Team Falcons for Intelยฎ Unnati Industrial Training Program 2025

No forbidden frameworks. Pure Python. Intelยฎ Optimized.

About

Build an AI Agent framework (not just an app) that can orchestrate agentic workflows from input to output without using existing agent frameworks like crew.ai, AutoGen, or n8n. The framework should support allowing the definition of agentic workflows as a composition of task flows.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published