A lightweight, local-first agent framework for programmatic code execution and orchestration.
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.
- π€ 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
pip install vanaras-agent-framework
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)
# Initialize from a template vanaras init code_analyzer # List available templates vanaras init --list # Describe a template vanaras init --describe code_analyzer
The Vanaras ecosystem consists of three main components:
Python package with agents, crews, tasks, and tools.
2. Vanaras Flow
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.
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 )
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" )
# 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 statusPOST /chat- Send message to agentGET /tools- List available 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
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 ))
- 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
# 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>
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()
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 .
pytest tests/
python -m build
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.
- Sandbox Execution - File operations restricted to
sandbox/andworkspaces/directories - Tool Safety Manager - Validates tool inputs and prevents destructive operations
- Local-First - All data stays on your machine by default
Contributions are welcome! Please see CONTRIBUTING.md for guidelines.
MIT License - see LICENSE for details.
- Documentation: [Coming soon]
- PyPI: https://pypi.org/project/vanaras-agent-framework/
- GitHub: https://github.com/vanarasai/agent-framework
- Vanaras Flow: https://github.com/vanarasai/vanaras-flow
- VS Code Extension: https://github.com/vanarasai/vanaras-vscode-extension
- Issues: GitHub Issues
- Discussions: GitHub Discussions
Built with β€οΈ by the Vanaras team