Skip to main content

CrewAI integration for PactSpec — discover and use PactSpec agents as CrewAI tools

Project description

pactspec-crewai

CrewAI integration for PactSpec — discover and use PactSpec agents as CrewAI tools.

Installation

pip install pactspec-crewai

Quick Start

Search the PactSpec registry and get CrewAI-compatible tools in two lines:

from pactspec_crewai import PactSpecTools

tools = PactSpecTools.from_registry(
    query="medical coding",
    verified_only=True,
)

print(f"Found {len(tools)} tools")
for tool in tools.get_tools():
    print(f"  - {tool.name}: {tool.description}")

Full CrewAI Agent Example

from crewai import Agent, Task, Crew
from pactspec_crewai import PactSpecTools

# Discover tools from the registry
tools = PactSpecTools.from_registry(
    query="medical coding",
    verified_only=True,
)

# Create a CrewAI agent with PactSpec tools
coder = Agent(
    role="Medical Coder",
    goal="Assign accurate ICD-11 codes to clinical notes",
    backstory="You are an experienced medical coder who uses specialized AI tools.",
    tools=tools.get_tools(),
)

task = Task(
    description="Assign ICD-11 codes to: 'Patient presents with acute bronchitis and mild fever.'",
    expected_output="A list of ICD-11 codes with descriptions",
    agent=coder,
)

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

Filtering and Pricing

You can filter by price to control costs:

# Only include skills that cost $0.01 or less per invocation
tools = PactSpecTools.from_registry(
    query="translation",
    max_price=0.01,
)

# Further filter after discovery
subset = tools.filter(name_contains="translate", verified_only=True)

Using a Specific Agent

If you know the agent's spec ID or registry UUID, load it directly:

from pactspec_crewai import PactSpecTools

tools = PactSpecTools.from_agent("pactspec:acme/medical-coder@1.0.0")

# Or by registry UUID
tools = PactSpecTools.from_agent("550e8400-e29b-41d4-a716-446655440000")

API Reference

PactSpecTools

Method Description
from_registry(query, verified_only, max_price, limit, registry) Search the registry and build tools
from_agent(spec_id, max_price, registry) Load a specific agent by ID
get_tools() Return the list of PactSpecTool instances
filter(name_contains, verified_only) Return a filtered subset

PactSpecTool

Extends crewai.tools.BaseTool. Each tool wraps a single PactSpec skill.

  • name — Unique tool name derived from the agent spec ID and skill ID
  • description — Skill description with agent name and verification badge
  • _run(input_text) — Sends input as JSON POST to the agent endpoint; parses JSON input or wraps plain text as {"input": "..."}

License

MIT

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

pactspec_crewai-0.1.0.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

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

pactspec_crewai-0.1.0-py3-none-any.whl (5.0 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for pactspec_crewai-0.1.0.tar.gz
Algorithm Hash digest
SHA256 b9b5028e4e29341a61e2bb3c819720eb1ad6d5ef9b57c7864513a7b205f00de9
MD5 42e195e6237ed0430f01b68c0d9ac39d
BLAKE2b-256 20f37880ef3143de7b0bda49e0b5694b2fe2482c362078eb9101ac6520608dd4

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for pactspec_crewai-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 7ad2f439760b6fe5bb2f2bf15978ee83a7173c92d0930ae0ecf4e5c4cb47b79d
MD5 5e9b8c9c1e9e7198fafa771337daf00e
BLAKE2b-256 0b03a6f1a3b29b56f96bedc1814ac9822fce5542efb39b87d083672d4573e54f

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