CrewAI integration for SHIP Protocol - AI code reliability tools for multi-agent workflows
Project description
ship-crewai
CrewAI Integration for SHIP Protocol - AI Code Reliability Tools for Multi-Agent Workflows
Give your CrewAI agents the ability to score code reliability and detect AI-generated code.
Why SHIP + CrewAI?
70% of AI coding tasks fail. SHIP gives your agents objective reliability metrics before they act on code.
from ship_crewai import SHIPScoreTool, SHIPDetectTool
from crewai import Agent, Task, Crew
# Create a code quality analyst agent
analyst = Agent(
role="Code Quality Analyst",
goal="Assess code reliability before deployment",
backstory="You are an expert at evaluating AI-generated code quality.",
tools=[SHIPScoreTool(), SHIPDetectTool()],
)
# Agent can now score repos and detect AI code
task = Task(
description="Evaluate the reliability of facebook/react",
expected_output="Reliability report with SHIP score and AI detection results",
agent=analyst,
)
Installation
pip install ship-crewai
Quick Start
Score a Repository
from ship_crewai import SHIPScoreTool
tool = SHIPScoreTool()
result = tool._run(repo="microsoft/vscode")
# Returns JSON:
# {
# "repo": "microsoft/vscode",
# "ship_score": 85,
# "grade": "A",
# "breakdown": {"confidence": 88, "focus": 82, ...},
# "recommendation": "Reliable (85-94%). Safe to proceed."
# }
Detect AI-Generated Code
from ship_crewai import SHIPDetectTool
tool = SHIPDetectTool()
result = tool._run(
code="def calculate_total(items): return sum(i.price for i in items)",
language="python",
)
# Returns JSON:
# {
# "ai_probability": 0.87,
# "is_ai_generated": true,
# "confidence": 0.92,
# "interpretation": "Likely AI-generated (70-89%). Significant AI markers present."
# }
Check API Health
from ship_crewai import SHIPHealthTool
tool = SHIPHealthTool()
result = tool._run()
# Returns JSON:
# {
# "status": "healthy",
# "version": "2.0.0",
# "message": "SHIP API is available and operational."
# }
Full CrewAI Example
from crewai import Agent, Task, Crew, Process
from ship_crewai import SHIPScoreTool, SHIPDetectTool, SHIPHealthTool
# Define tools
score_tool = SHIPScoreTool()
detect_tool = SHIPDetectTool()
health_tool = SHIPHealthTool()
# Create a code quality agent
quality_analyst = Agent(
role="Code Quality Analyst",
goal="Evaluate code reliability and detect AI-generated code",
backstory=(
"You are a senior code quality analyst who uses SHIP Protocol "
"to objectively measure AI code reliability. You always check "
"the API health first, then score repositories and detect AI code."
),
tools=[health_tool, score_tool, detect_tool],
verbose=True,
)
# Create a security reviewer agent
security_reviewer = Agent(
role="Security Reviewer",
goal="Identify security risks in AI-generated code",
backstory=(
"You are a security expert who uses AI detection to identify "
"code that needs extra scrutiny due to AI generation patterns."
),
tools=[detect_tool, score_tool],
verbose=True,
)
# Define tasks
health_check = Task(
description="Check that the SHIP API is available",
expected_output="API health status confirmation",
agent=quality_analyst,
)
score_task = Task(
description="Score the repository 'facebook/react' for AI code reliability",
expected_output="SHIP score with grade and breakdown",
agent=quality_analyst,
)
detect_task = Task(
description=(
"Analyze this code for AI generation:\n\n"
"```python\n"
"def process_items(items):\n"
" return [item for item in items if item.is_valid()]\n"
"```"
),
expected_output="AI detection report with probability and interpretation",
agent=security_reviewer,
)
# Run the crew
crew = Crew(
agents=[quality_analyst, security_reviewer],
tasks=[health_check, score_task, detect_task],
process=Process.sequential,
verbose=True,
)
result = crew.kickoff()
print(result)
Tools Reference
SHIPScoreTool
Score a GitHub repository for AI code reliability.
Input:
repo: GitHub repository in "owner/repo" format
Output (JSON):
ship_score: 0-100 reliability scoregrade: Letter grade (A+ to F)breakdown: Component scores (confidence, focus, context, efficiency)recommendation: Human-readable advice based on grade
SHIPDetectTool
Detect whether source code is AI-generated.
Input:
code: Source code to analyzelanguage: Programming language (default: "python")
Output (JSON):
ai_probability: 0-1 probability of AI generationis_ai_generated: Boolean flagconfidence: Model confidence scorefeatures_analyzed: Number of code features analyzedinterpretation: Human-readable interpretation
SHIPHealthTool
Check SHIP API availability.
Input: None required.
Output (JSON):
status: "healthy" or "unhealthy"version: API versionmessage: Status description
Configuration
All tools accept optional configuration for custom API endpoints:
from ship_crewai import SHIPScoreTool
tool = SHIPScoreTool(
base_url="https://your-ship-instance.dev",
api_key="your-api-key",
timeout=60.0,
)
Error Handling
All tools follow antifragile principles -- they never crash your agent:
- On API errors: Return a fallback response with
"fallback": true - On timeouts: Return degraded response with error context
- On connection failures: Return clear error message
# Even when the API is down, your agent keeps running
result = tool._run(repo="owner/repo")
# {
# "ship_score": null,
# "grade": "UNKNOWN",
# "fallback": true,
# "message": "Score unavailable. Proceed with caution..."
# }
Grade Interpretation
| Grade | Score | What It Means |
|---|---|---|
| A+ | 95-100 | 95%+ success rate - Ship with confidence |
| A | 85-94 | 85%+ success rate - Reliable |
| B | 70-84 | 70%+ success rate - Good, minor risks |
| C | 50-69 | 50%+ success rate - Proceed with caution |
| D | 30-49 | 30%+ success rate - High risk |
| F | 0-29 | <30% success rate - Likely to fail |
Links
- SHIP Protocol API: https://ship-protocol.dhruvaapi.workers.dev
- SHIP LangChain Integration: https://pypi.org/project/ship-langchain/
- GitHub: https://github.com/vibeatlas/ship-protocol
License
MIT License - see LICENSE for details.
Built by VibeAtlas - Making AI coding reliable.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ship_crewai-1.0.0.tar.gz.
File metadata
- Download URL: ship_crewai-1.0.0.tar.gz
- Upload date:
- Size: 12.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f5ba8e387daa0d75b3984cfb8c48e0cd8acdddfe30c052e61c4f2343cb497b91
|
|
| MD5 |
09518670c2b700c444c2ca6bd8c50b67
|
|
| BLAKE2b-256 |
1781c3c0d2806a8f773714c59daef1e385d6d00b6bf275c52d02a4f1875844a5
|
File details
Details for the file ship_crewai-1.0.0-py3-none-any.whl.
File metadata
- Download URL: ship_crewai-1.0.0-py3-none-any.whl
- Upload date:
- Size: 9.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
471781fbaa1cd7008d2d8ccab5f17d2809c8837e963927e7d48a9411448ec33a
|
|
| MD5 |
5f785b9e09eec88226b39c75e018fa1d
|
|
| BLAKE2b-256 |
0f0027db468dc385c24d3c08ebf869adf16d8c694f91159a109e24bff16297ca
|