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
Metadata
Release files for pactspec-crewai 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pactspec_crewai-0.1.0.tar.gz | 4.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pactspec_crewai-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.4 kB
Release files / pactspec_crewai-0.1.0.tar.gz
| Download URL | pactspec_crewai-0.1.0.tar.gz |
|---|---|
| Size | 4.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b9b5028e4e29341a61e2bb3c819720eb1ad6d5ef9b57c7864513a7b205f00de9
|
|
BLAKE2b-256 checksum How to use checksums |
20f37880ef3143de7b0bda49e0b5694b2fe2482c362078eb9101ac6520608dd4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.6
|
Release files / pactspec_crewai-0.1.0-py3-none-any.whl
| Download URL | pactspec_crewai-0.1.0-py3-none-any.whl |
|---|---|
| Size | 5.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7ad2f439760b6fe5bb2f2bf15978ee83a7173c92d0930ae0ecf4e5c4cb47b79d
|
|
BLAKE2b-256 checksum How to use checksums |
0b03a6f1a3b29b56f96bedc1814ac9822fce5542efb39b87d083672d4573e54f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.9.6
|