Skip to main content

Build autonomous AI agents in 3 lines of code. Production-ready orchestration with P2P mesh networking.

Project description

JarvisCore Framework

Build autonomous AI agents with P2P mesh networking.

Features

  • AutoAgent - LLM generates and executes code from natural language
  • CustomAgent - Bring your own logic with P2P message handlers
  • P2P Mesh - Agent discovery and communication via SWIM protocol
  • Workflow Orchestration - Dependencies, context passing, multi-step pipelines
  • FastAPI Integration - 3-line setup with JarvisLifespan
  • Cognitive Discovery - LLM-ready peer descriptions for autonomous delegation
  • Cloud Deployment - Self-registering agents for Docker/K8s

Installation

pip install jarviscore-framework

Setup

# Initialize project
python -m jarviscore.cli.scaffold --examples
cp .env.example .env
# Add your LLM API key to .env

# Validate
python -m jarviscore.cli.check --validate-llm
python -m jarviscore.cli.smoketest

Quick Start

AutoAgent (LLM-Powered)

from jarviscore import Mesh
from jarviscore.profiles import AutoAgent

class CalculatorAgent(AutoAgent):
    role = "calculator"
    capabilities = ["math"]
    system_prompt = "You are a math expert. Store result in 'result'."

mesh = Mesh(mode="autonomous")
mesh.add(CalculatorAgent)
await mesh.start()

results = await mesh.workflow("calc", [
    {"agent": "calculator", "task": "Calculate factorial of 10"}
])
print(results[0]["output"])  # 3628800

CustomAgent + FastAPI (Recommended)

from fastapi import FastAPI
from jarviscore.profiles import CustomAgent
from jarviscore.integrations.fastapi import JarvisLifespan

class ProcessorAgent(CustomAgent):
    role = "processor"
    capabilities = ["processing"]

    async def on_peer_request(self, msg):
        # Handle requests from other agents
        return {"result": msg.data.get("task", "").upper()}

# 3 lines to integrate with FastAPI
app = FastAPI(lifespan=JarvisLifespan(ProcessorAgent(), mode="p2p"))

CustomAgent (Workflow Mode)

from jarviscore import Mesh
from jarviscore.profiles import CustomAgent

class ProcessorAgent(CustomAgent):
    role = "processor"
    capabilities = ["processing"]

    async def execute_task(self, task):
        data = task.get("params", {}).get("data", [])
        return {"status": "success", "output": [x * 2 for x in data]}

mesh = Mesh(mode="distributed", config={'bind_port': 7950})
mesh.add(ProcessorAgent)
await mesh.start()

results = await mesh.workflow("demo", [
    {"agent": "processor", "task": "Process", "params": {"data": [1, 2, 3]}}
])
print(results[0]["output"])  # [2, 4, 6]

Profiles

Profile You Write JarvisCore Handles
AutoAgent System prompt LLM code generation, sandboxed execution
CustomAgent on_peer_request() and/or execute_task() Mesh, discovery, routing, lifecycle

Execution Modes

Mode Use Case
autonomous Single machine, LLM code generation (AutoAgent)
p2p Agent-to-agent communication, swarms (CustomAgent)
distributed Multi-node workflows + P2P (CustomAgent)

Framework Integration

JarvisCore is async-first. Best experience with async frameworks.

Framework Integration
FastAPI JarvisLifespan (3 lines)
aiohttp, Quart, Tornado Manual lifecycle (see docs)
Flask, Django Background thread pattern (see docs)

Documentation

Documentation is included with the package:

python -c "import jarviscore; print(jarviscore.__path__[0] + '/docs')"

Available guides:

  • GETTING_STARTED.md - 5-minute quickstart
  • CUSTOMAGENT_GUIDE.md - CustomAgent patterns and framework integration
  • AUTOAGENT_GUIDE.md - LLM-powered agents
  • USER_GUIDE.md - Complete documentation
  • API_REFERENCE.md - Detailed API docs
  • CONFIGURATION.md - Settings reference

Version

0.4.0

License

MIT License

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

jarviscore_framework-0.3.1.tar.gz (275.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

jarviscore_framework-0.3.1-py3-none-any.whl (351.0 kB view details)

Uploaded Python 3

File details

Details for the file jarviscore_framework-0.3.1.tar.gz.

File metadata

  • Download URL: jarviscore_framework-0.3.1.tar.gz
  • Upload date:
  • Size: 275.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for jarviscore_framework-0.3.1.tar.gz
Algorithm Hash digest
SHA256 edbbf72ec0c12cbd374eb75da4dc1fbbf8f1a4ca4ecde88a3b84fa0d16c0e3b3
MD5 ba04a23bb5b80ee863a2c51480fa273e
BLAKE2b-256 2057a34426eb7b233545c8e0f09685a54126ec7aa6d08557d0929d80bcb1f951

See more details on using hashes here.

File details

Details for the file jarviscore_framework-0.3.1-py3-none-any.whl.

File metadata

File hashes

Hashes for jarviscore_framework-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e5ee686d35489e2a190bef102329b40908e781bb8be0a8d7d60df6394f6254bd
MD5 66d784f9427068f7a5a35d67e7c8e770
BLAKE2b-256 d8a6d34bbc0b696a7fbafe8d63140700a998497abcc2322728fe6d59cce025af

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page