bluejay-sdk
One client for the Bluejay API and for tracing your agent's calls into Bluejay conversations.
pip install bluejay-sdk # API client + tracing
pip install "bluejay-sdk[livekit]" # + LiveKit Agents
pip install "bluejay-sdk[pipecat]" # + Pipecat
from bluejay import BluejayClient
client = BluejayClient() # reads BLUEJAY_API_KEY; or BluejayClient(api_key="bj_...", base_url=...)
In asyncio code, use AsyncBluejayClient: the same client, with API methods to await.
Tracing
For API calls, create a client with BluejayClient(). For chat, LiveKit, or Pipecat,
create the client once at process startup with tracing enabled:
client = BluejayClient(tracing=True)
This adds Bluejay's exporter to your OpenTelemetry setup or creates one.
It also traces model requests through these SDKs. When LiveKit or Pipecat is already tracing a model request, Bluejay uses the framework's span for that request.
| SDK | Traced |
|---|---|
openai |
chat completions and responses: create, parse, stream; Azure OpenAI and OpenAI-compatible APIs |
anthropic |
messages: create and stream |
google-genai |
Gemini and Vertex AI: generate_content, generate_content_stream, chats |
boto3 |
Bedrock converse and converse_stream |
Each call is one span with the model, prompt, reply, tool calls, tokens and finish reason, in
OpenTelemetry's gen_ai.* attributes. Inside session() or a voice integration it joins that call.
Voice agents
LiveKit: one line before the session.start() you already have. Spans, audio, transcript and tool
calls all reach Bluejay, and the call becomes a conversation when it hangs up.
client.instrument_livekit(ctx, session, external_agent_id="support-bot")
await session.start(room=ctx.room, agent=SupportAgent())
Pipecat: add the Bluejay tap after your output transport and keep your existing context aggregators. Enable Pipecat's native spans on the worker and use the tap's session ID.
tap = client.instrument_pipecat(external_agent_id="support-bot")
pipeline = Pipeline([
transport.input(), stt, user_aggregator, llm, tts,
transport.output(), tap, assistant_aggregator,
])
worker = PipelineWorker(pipeline, enable_tracing=True, conversation_id=tap.session_id)
Text and chat agents
with client.session(chat_id, external_agent_id="chat-bot") as session:
session.turn("USER", user_message)
reply = run_agent(user_message) # auto-traced model calls join this session
session.turn("AGENT", reply)
session.end() # optional: otherwise it builds after an hour idle
When the whole function is the session, decorate it. The first argument picks the id from the call. Use the same flow for SMS with the SMS conversation ID:
@client.session(lambda chat_id, message: chat_id, external_agent_id="chat-bot")
def handle(chat_id: str, message: str) -> str:
client.turn("USER", message)
reply = run_agent(message)
client.turn("AGENT", reply)
return reply
Every span needs a session and an agent: session() and the voice integrations set both.
Reopen the same id on the next request and the turns land in one conversation.
Tools and custom spans
@client.observe(kind="tool")
def lookup_appointment(member_id: str) -> dict: ...
@client.observe(kind="llm", model="mistral-large", provider="mistral_ai")
def ask_mistral(messages: list) -> str: ...
# a model call the SDK does not trace on its own (a provider's native SDK, raw HTTP):
# the span gets the same gen_ai.* attributes as an auto-instrumented call
with client.span("chat mistral-large", kind="llm", model="mistral-large", provider="mistral_ai", input=messages) as span:
reply = mistral.chat.complete(model="mistral-large", messages=messages)
span.set_output(reply.choices[0].message.content, finish_reason="stop",
input_tokens=reply.usage.prompt_tokens, output_tokens=reply.usage.completion_tokens)
Span kinds
Use client.span(...) around a block or @client.observe(...) on a synchronous or asynchronous function. Both accept the same kinds. session.span(...) works inside an active session too.
| Kind | What Bluejay records |
|---|---|
llm |
Model, provider and timing. Supply custom token usage through span.set_output(). |
stt, tts |
Speech stage, model, provider and timing. For a stream, keep the span open while consuming it to measure total duration. |
tool |
Tool name, arguments, result or error. Use this for retrieval functions. |
agent |
The named agent run. Model and tool spans started inside inherit its trace context. |
handoff |
Source and destination on successful completion. Use the callback that confirms an asynchronous transfer. |
| Omitted | A named, timed step. |
with client.span("Billing", kind="agent"):
with client.span("synthesize", kind="tts", provider=provider_name, model=model_name):
await synthesize_and_play(reply)
@client.observe(kind="handoff", from_agent="Triage", to_agent="Billing")
async def transfer_to_billing():
await confirm_billing_transfer()
A transfer tool can pass from_agent and to_agent on its existing tool span. Raise on failure or call span.set_error(...) before leaving the block. The source and destination are recorded only after successful completion. Existing integrations export native spans once; avoid wrapping a call already traced by the runtime.
Privacy
For advanced tracing options, create the client and configure tracing explicitly at startup.
client = BluejayClient()
client.init_tracing(redact_pii=True, mask=scrub)
client.instrument_livekit(ctx, session, external_agent_id="support-bot", record_audio=False)
The API
The API is on the same client, one namespace per resource, each with list, get, create,
update and delete where they apply:
from bluejay import models
client.agents.list()
client.digital_humans.create(digital_humans=[...], simulation_ids=[...])
client.simulations.run(simulation_id=...)
client.simulation_results.list(simulation_run_id)
client.evaluate(external_agent_id="support-bot", start_time_utc=..., participants=[...],
transcript=[models.Turn(speaker="USER", utterance="hi", start_offset_ms=0, end_offset_ms=500)])
See src/bluejay/api/reference.md for every method, and
SDK_GENERATION.md for how the API client is generated and released.
Metadata
Release files for bluejay-sdk 0.5.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 | Provenance | Actions |
|---|---|---|---|---|
| bluejay_sdk-0.5.0.tar.gz | 333.6 kB | Without provenance | Details for bluejay_sdk-0.5.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| bluejay_sdk-0.5.0-py3-none-any.whl | Python 3 | none | any | Details for bluejay_sdk-0.5.0-py3-none-any.whl |
Total release size: 910.6 kB
Release files / bluejay_sdk-0.5.0.tar.gz
| Download URL | bluejay_sdk-0.5.0.tar.gz |
|---|---|
| Size | 333.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
919b2ce7e0b9da032785e759066eaa5675af70ed46d824bf4d87b0d66fc9e099
|
|
BLAKE2b-256 checksum How to use checksums |
b62440cf784f9a0239b31ceddfd9166ef482eeeb212145db6b2fd1748abbf8e5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / bluejay_sdk-0.5.0-py3-none-any.whl
| Download URL | bluejay_sdk-0.5.0-py3-none-any.whl |
|---|---|
| Size | 577.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7ac0bb3f2140e32738ca9c768045f90c33be1f172eb4a9e14874749a042e1428
|
|
BLAKE2b-256 checksum How to use checksums |
fb2e5a44f38aa50106fb7d6dda220d970df83707378932a4265211ebfe9cfae0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.13.9 {"installer":{"name":"uv","version":"0.13.9","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"26.04","id":"resolute","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for bluejay-sdk 0.5.0
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.