Skip to main content

B2B Campaign Agent Python SDK

A Python client for the B2B Campaign Agent API that helps you generate personalized B2B campaigns by analyzing business websites and social media profiles.

Want to Join The Beta?

Visit here to register for beta access!

Installation

pip install b2brilliant-sdk

Basic Usage

from b2brilliant_sdk import B2BrilliantAgent

# Initialize with your API key
agent = B2BrilliantAgent(api_key="your-api-key")

# Discover information about your business
user_business = agent.user.discover([
    "https://yourbusiness.com"
])

# Discover information about a target business
target_business = agent.business.discover([
    "https://targetbusiness.com"
])

# Generate campaigns (email, DM, SMS)
campaigns = agent.campaigns.create(
    user_business,
    target_business,
    ["email", "dm", "sms"]
)

# Use the generated campaigns
print(campaigns)

API Reference

Initialization

from b2brilliant_sdk import B2BrilliantAgent

agent = B2BrilliantAgent(api_key="your-api-key")

User Business Methods

Discover User Business Information

options = {
    "find_competitors": True,
    "find_branding": True,
    "deep_search": False
}

user_business = agent.user.discover(
    ["https://yourbusiness.com", "https://yourbusiness.com/about"],
    options
)

Refine User Business Information

refined_business = agent.user.refine(
    user_business, 
    "We recently launched a new service called 'Advanced Analytics'"
)

Target Business Methods

Discover Target Business Information

target_business = agent.business.discover(
    ["https://targetbusiness.com"],
    {"find_branding": True}
)

Refine Target Business Information

refined_target = agent.business.refine(
    target_business,
    "They recently announced a Series B funding round"
)

Assess Business Compatibility

compatibility = agent.business.compatibility(
    user_business,
    target_business
)

print(f"Compatibility score: {compatibility['score']}")
print("Positives:", compatibility["reasoning"]["positives"])
print("Negatives:", compatibility["reasoning"]["negatives"])
print("Recommendations:", compatibility["reasoning"]["recommendations"])

Campaign Methods

Create Campaign

# Generate all campaign types
all_campaigns = agent.campaigns.create(
    user_business,
    target_business
)

# Generate only specific campaign types
campaign_types = ["email", "dm"]
specific_campaigns = agent.campaigns.create(
    user_business,
    target_business,
    campaign_types
)

Refine Campaign

refined_campaigns = agent.campaigns.refine(
    user_business,
    target_business,
    all_campaigns,
    "Make the tone more professional and focus on their recent funding"
)

Error Handling

The SDK raises typed exceptions that can be caught and handled:

from b2brilliant_sdk.exceptions import ApiError, ValidationError

try:
    campaigns = agent.campaigns.create(user_business, target_business)
except ApiError as e:
    print(f"API error ({e.status}): {e.message}")
    print("Error data:", e.data)
except ValidationError as e:
    print("Validation error:", e.validation_errors)
except Exception as e:
    print("Unexpected error:", e)

Data Structures

The SDK works with the following key data structures:

BusinessObject

{
    "profile": {
        "name": str,
        "summary": str,
        "services": List[str],
        "current_events": str,
        "target_audience": str,
        "industry": str
    },
    "contacts": {
        "point_of_contact": {  # Optional
            "name": str,
            "position": str
        },
        "social": List[Dict],  # List of social channels
        "email": str,
        "phone": str
    },
    "branding": {
        "voice": str,
        "tone": str,
        "style": str,
        "phrases": List[str]
    },
    "competitors": List[Dict],  # Optional
    "confidence": {
        "score": float,  # 0-10
        "reasoning": str
    }
}

CampaignObject

{
    "target_business": str,
    "user_business": str,
    "campaigns": [
        {
            "type": str,  # "dm", "email", or "sms"
            "content": str,
            "rating": float,
            "feedback": {
                "strengths": List[str],
                "weaknesses": List[str],
                "suggestions": List[str]
            }
        }
    ]
}

BusinessCompatibilityScore

{
    "target_business": str,
    "user_business": str,
    "score": float,
    "reasoning": {
        "positives": List[str],
        "negatives": List[str],
        "recommendations": List[str]
    }
}

License

This software is licensed under the Business Source License 1.1 (BSL).

Metadata

Release files for b2brilliant-sdk 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for b2brilliant-sdk 0.1.2
File Size Uploaded Provenance
b2brilliant_sdk-0.1.2.tar.gz 5.8 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for b2brilliant-sdk 0.1.2
File Interpreter ABI Platform
b2brilliant_sdk-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 14.5 kB

Release files / b2brilliant_sdk-0.1.2.tar.gz

Download URL b2brilliant_sdk-0.1.2.tar.gz
Size 5.8 kB
Tags Source
SHA-256 checksum
How to use checksums
c5b15b6efe86fdfea805fa78d536d124f47f5e0ffd8bd0beee0c0deb43db0936
BLAKE2b-256 checksum
How to use checksums
2e2ae4e09f1614c8212aced5c37ad66cac757ca295ad920acd24cad27ed16380
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.4

Release files / b2brilliant_sdk-0.1.2-py3-none-any.whl

Download URL b2brilliant_sdk-0.1.2-py3-none-any.whl
Size 8.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fdd8fc5ae88845526756d14d0e7367c74f3e1c2f84c0e5763d5df2e0a5156e8b
BLAKE2b-256 checksum
How to use checksums
054446e89b39bddc4e47e60d70e842b25c76762a057c84433393313362054833
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.4

Security for b2brilliant-sdk 0.1.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page