Skip to main content

CrewAI integration for SkillBroker - Access expert knowledge in your AI crews

Project description

SkillBroker CrewAI Integration

Add expert knowledge to your CrewAI crews with SkillBroker - the marketplace where AI agents pay for human expertise.

Installation

pip install skillbroker-crewai

Quick Start

Basic Agent with Expert Tool

from crewai import Agent, Task, Crew
from skillbroker_crewai import SkillBrokerTool

# Create a tool for a specific skill
tax_tool = SkillBrokerTool(
    skill_id="freelancer-tax-advisor",
    name="Tax Advisor",
    description="Get expert advice on freelancer and self-employment tax questions"
)

# Create an agent with the tool
tax_agent = Agent(
    role="Tax Consultant",
    goal="Provide accurate tax advice to freelancers",
    backstory="You are an expert tax consultant specializing in self-employment taxes.",
    tools=[tax_tool],
    verbose=True
)

# Create a task
task = Task(
    description="Help me understand if I can deduct my home office expenses as a freelancer",
    agent=tax_agent,
    expected_output="Detailed tax advice about home office deductions"
)

# Run the crew
crew = Crew(agents=[tax_agent], tasks=[task])
result = crew.kickoff()
print(result)

Dynamic Expert Tool

Let the agent automatically find the right skill:

from crewai import Agent, Task, Crew
from skillbroker_crewai import SkillBrokerExpertTool

# This tool can handle any domain question
expert_tool = SkillBrokerExpertTool()

# Create a research agent
research_agent = Agent(
    role="Research Assistant",
    goal="Answer complex questions using expert knowledge",
    backstory="You have access to a marketplace of human experts.",
    tools=[expert_tool],
)

task = Task(
    description="What's the best way to structure a holding company for tax efficiency?",
    agent=research_agent,
    expected_output="Expert advice on holding company structure"
)

crew = Crew(agents=[research_agent], tasks=[task])
result = crew.kickoff()

Searching for Skills

from skillbroker_crewai import SkillBrokerSearchTool

# Create a search tool
search_tool = SkillBrokerSearchTool()

# Find relevant skills
results = search_tool.run("financial planning")
print(results)

Using the Client Directly

from skillbroker_crewai import SkillBrokerClient

client = SkillBrokerClient()

# Get registry info
info = client.get_registry_info()
print(f"Total skills available: {info['stats']['totalSkills']}")

# Search for skills
results = client.search("machine learning")
for skill in results.skills:
    print(f"- {skill.name}: {skill.description}")

# Invoke a skill directly
response = client.invoke("skill-id", "Your question here")
print(response.response)

Configuration

Environment Variables

# Optional: Override the API URL (defaults to https://api.skillbroker.io)
export SKILLBROKER_API_URL="https://api.skillbroker.io"

# Optional: API key for authenticated requests
export SKILLBROKER_API_KEY="your-api-key"

Programmatic Configuration

from skillbroker_crewai import SkillBrokerClient, SkillBrokerTool

# Configure client
client = SkillBrokerClient(
    api_url="https://api.skillbroker.io",
    api_key="your-api-key",
    timeout=30,
)

# Configure tools
tool = SkillBrokerTool(
    skill_id="my-skill",
    api_url="https://api.skillbroker.io",
    api_key="your-api-key",
)

Available Tools

Tool Description
SkillBrokerTool Invoke a specific skill by ID
SkillBrokerSearchTool Search the marketplace for skills
SkillBrokerExpertTool Automatically find and invoke the best skill

Multi-Agent Crew Example

from crewai import Agent, Task, Crew, Process
from skillbroker_crewai import SkillBrokerTool, SkillBrokerSearchTool

# Create specialized tools
tax_tool = SkillBrokerTool(
    skill_id="freelancer-tax-advisor",
    name="Tax Advisor",
    description="Tax advice for freelancers"
)

legal_tool = SkillBrokerTool(
    skill_id="contract-reviewer",
    name="Contract Advisor",
    description="Contract and legal document review"
)

search_tool = SkillBrokerSearchTool()

# Create specialized agents
tax_agent = Agent(
    role="Tax Specialist",
    goal="Provide accurate tax guidance",
    backstory="Expert in freelancer taxation",
    tools=[tax_tool],
)

legal_agent = Agent(
    role="Legal Advisor",
    goal="Review contracts and legal matters",
    backstory="Specializes in freelancer contracts",
    tools=[legal_tool],
)

research_agent = Agent(
    role="Research Coordinator",
    goal="Find the right experts for any question",
    backstory="Connects users with domain experts",
    tools=[search_tool],
)

# Create tasks
tax_task = Task(
    description="Analyze tax implications of the new contract",
    agent=tax_agent,
    expected_output="Tax analysis report"
)

legal_task = Task(
    description="Review the contract terms",
    agent=legal_agent,
    expected_output="Contract review with recommendations"
)

# Run as a crew
crew = Crew(
    agents=[research_agent, tax_agent, legal_agent],
    tasks=[tax_task, legal_task],
    process=Process.sequential
)

result = crew.kickoff()

API Reference

SkillBrokerClient

client = SkillBrokerClient(api_url=None, api_key=None, timeout=30)

# Methods
client.get_registry_info() -> dict
client.search(query=None, category=None, limit=20) -> SearchResult
client.get_skill(skill_id) -> Skill
client.invoke(skill_id, query, context=None) -> SkillResponse
client.get_categories() -> list
client.get_top_skills(limit=10, category=None) -> list[Skill]
client.get_recommendations(task_description, limit=5) -> list[Skill]

Models

from skillbroker_crewai import Skill, SkillResponse, SkillQuery

# Skill attributes
skill.id
skill.name
skill.description
skill.category
skill.pricing
skill.stats
skill.quality

# Response attributes
response.success
response.response
response.skill_id
response.tokens_used
response.cost

Support

License

MIT License - see LICENSE file for details.

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

skillbroker_crewai-0.1.0.tar.gz (11.6 kB view details)

Uploaded Source

Built Distribution

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

skillbroker_crewai-0.1.0-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

Details for the file skillbroker_crewai-0.1.0.tar.gz.

File metadata

  • Download URL: skillbroker_crewai-0.1.0.tar.gz
  • Upload date:
  • Size: 11.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for skillbroker_crewai-0.1.0.tar.gz
Algorithm Hash digest
SHA256 bb5ffaca1e25d069c431cae33021166e9e2297a497fcf0fbe0969067bb12b6d9
MD5 ec65baf4b4f976ffd0fb613d1787c4a8
BLAKE2b-256 8f12fe54883f97ce54548c186c3995c826c61e9a25b4aa555856113ff15c459e

See more details on using hashes here.

File details

Details for the file skillbroker_crewai-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for skillbroker_crewai-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 b95a4b0753b650ebc64230b5e56effc77bd6990ce7f280297d5ca53450fe5033
MD5 45f98b43e6e9461b27bc279547f36d77
BLAKE2b-256 96655bb8dd4b35a87f1ea5ab7590a137aae8dfeee430280858f9a18330b0fa8c

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