Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Vanaras-AI/agent-framework

Repository files navigation

Vanaras Agent Framework

A lightweight, local-first agent framework for programmatic code execution and orchestration.

PyPI version License: MIT

Vanaras enables you to build AI-powered workflows with autonomous agents, multi-agent crews, and intelligent tool executionβ€”all running locally with your choice of LLM.

🌟 Features

  • πŸ€– Autonomous Agents - ReAct loop with reasoning, tool use, and memory
  • πŸ‘₯ Multi-Agent Crews - Sequential, DAG, and hierarchical orchestration
  • πŸ”§ Built-in Tools - File operations, code patching, directory listing
  • πŸ”Œ Python Bridge - HTTP API for IDE integrations
  • πŸ“Š Real-time Metrics - Token usage, execution time, error tracking
  • 🎨 Visual Workflow Designer - Node-based UI for building crews
  • πŸ’» VS Code Extension - AI assistant directly in your editor
  • πŸ”’ Safety First - Sandbox execution, tool safety manager

πŸš€ Quick Start

Installation

pip install vanaras-agent-framework

Create Your First Agent

from vanaras.core.agent import Agent
from vanaras.core.task import Task
from vanaras.core.crew import Crew
# Define an agent
coder = Agent(
 role="Python Developer",
 goal="Write clean, efficient Python code",
 backstory="Expert Python developer with 10 years of experience"
)
# Create a task
task = Task(
 description="Create a function to calculate fibonacci numbers",
 expected_output="A working Python function",
 agent=coder
)
# Execute
crew = Crew(agents=[coder], tasks=[task])
result = crew.kickoff()
print(result)

Use Templates

# Initialize from a template
vanaras init code_analyzer
# List available templates
vanaras init --list
# Describe a template
vanaras init --describe code_analyzer

πŸ—οΈ Ecosystem

The Vanaras ecosystem consists of three main components:

1. Core Framework (this repo)

Python package with agents, crews, tasks, and tools.

Visual workflow designer with node-based UI for building and monitoring agent crews.

AI-powered code assistant that brings Vanaras agents directly into your editor.

πŸ“– Documentation

Agent System

from vanaras.core.agent import Agent
agent = Agent(
 role="Data Analyst",
 goal="Analyze data and provide insights",
 backstory="Expert in data analysis and visualization",
 tools=["read_file", "write_file"] # Optional custom tools
)

Crew Orchestration

from vanaras.core.crew import Crew, Process
# Sequential execution
crew = Crew(
 agents=[agent1, agent2],
 tasks=[task1, task2],
 process=Process.SEQUENTIAL
)
# DAG execution (parallel where possible)
crew = Crew(
 agents=[agent1, agent2, agent3],
 tasks=[task1, task2, task3],
 process=Process.DAG
)
# Hierarchical (manager coordinates workers)
crew = Crew(
 agents=[worker1, worker2],
 tasks=[task1, task2],
 process=Process.HIERARCHICAL,
 manager_llm="gpt-4"
)

Python Bridge (API Server)

# Start the bridge
vanaras serve --port 5001
# Test it
curl http://localhost:5001/health
curl -X POST http://localhost:5001/chat \
 -H "Content-Type: application/json" \
 -d '{"message": "Create a hello world function"}'

Available Endpoints:

  • GET /health - Server status
  • POST /chat - Send message to agent
  • GET /tools - List available tools

Built-in Tools

  • write_file - Write content to files (sandbox only)
  • read_file - Read file contents
  • list_dir - List directory contents
  • patch_file - Apply unified diff patches

Custom Tools

from vanaras.tools.registry import registry, ToolMetadata, ToolCategory
def my_custom_tool(arg1, arg2):
 """Your custom tool logic."""
 return f"Processed {arg1} and {arg2}"
registry.register(ToolMetadata(
 name="my_tool",
 description="Description of what it does",
 category=ToolCategory.CUSTOM,
 function=my_custom_tool,
 destructive=False
))

🎯 Use Cases

  • Code Generation - Generate boilerplate, tests, documentation
  • Code Analysis - Analyze codebases, find issues, suggest improvements
  • Refactoring - Automated code refactoring with AI
  • Documentation - Generate and maintain documentation
  • Testing - Create test cases and test data
  • DevOps - Automate deployment scripts and configurations

πŸ”§ CLI Commands

# Initialize from template
vanaras init <template_name>
# Run a task
vanaras run <task_file>
# Start Python Bridge
vanaras serve [--port PORT] [--host HOST]
# Launch UI Dashboard
vanaras dashboard [--port PORT]
# Tool registry
vanaras tools list
vanaras tools describe <tool_name>

πŸƒ Examples

Multi-Agent Workflow

from vanaras.core.agent import Agent
from vanaras.core.task import Task
from vanaras.core.crew import Crew, Process
# Define agents
researcher = Agent(
 role="Researcher",
 goal="Research and gather information",
 backstory="Expert researcher with attention to detail"
)
writer = Agent(
 role="Writer",
 goal="Write clear, engaging content",
 backstory="Professional technical writer"
)
# Define tasks
research_task = Task(
 description="Research the topic of AI agents",
 expected_output="A summary of key findings",
 agent=researcher
)
writing_task = Task(
 description="Write a blog post based on the research",
 expected_output="A well-written blog post",
 agent=writer,
 context=[research_task] # Depends on research_task
)
# Execute
crew = Crew(
 agents=[researcher, writer],
 tasks=[research_task, writing_task],
 process=Process.SEQUENTIAL,
 verbose=True
)
result = crew.kickoff()

πŸ› οΈ Development

Setup

git clone https://github.com/vanarasai/agent-framework.git
cd agent-framework
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
pip install -e .

Run Tests

pytest tests/

Build Package

python -m build

πŸ“Š Metrics & Monitoring

Vanaras automatically tracks:

  • Token usage (input/output)
  • Execution time
  • Tool calls
  • Errors and retries

Metrics are saved to metrics_report.md after each crew execution.

πŸ”’ Security

  • Sandbox Execution - File operations restricted to sandbox/ and workspaces/ directories
  • Tool Safety Manager - Validates tool inputs and prevents destructive operations
  • Local-First - All data stays on your machine by default

🀝 Contributing

Contributions are welcome! Please see CONTRIBUTING.md for guidelines.

πŸ“„ License

MIT License - see LICENSE for details.

πŸ”— Links

πŸ’¬ Support


Built with ❀️ by the Vanaras team

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /