ArcheAI quick start — session analysis (multi-speaker recording)¶
What this does: uploads one multi-speaker recording, runs the session pipeline (diarized transcript → per-speaker communication style and Big Five from each speaker's own words), then asks the familiarity line whether the two main speakers' voices show the signature of prior interaction — and prints a one-screen summary.
What you get per speaker: seven communication-style dimensions and Big Five estimates,
each a z-score against executive-register norms, computed from that speaker's transcript in
this recording only. Speakers with fewer than the minimum word count are listed but not scored
(the API says so in a note). These are research signals for a trained reader — not
diagnoses, not accusations. The audio deception line is withdrawn (2026-10-14) and
is not part of a session; it is being rebuilt as departure from the speaker's own reference
(own prior speech / own session), a signal that pairs with the text fraud-language model —
not a lie detector, and never a standalone "listen to a clip, get a probability" verdict.
0. Install, authenticate, pick a file¶
pip install "archeai-sdk[quant]>=1.1"
Any WAV / MP3 / M4A / FLAC / OGG with more than one speaker. The demo file is a 3-minute
two-person conversation (ARCHE_DEMO_AUDIO). A session costs 40 credits (covers
transcription); audio auto-deletes after 7 days or immediately with delete_after=True.
import os, time
import pandas as pd
from arche_ai import ArcheClient, ArcheAPIError
API_KEY = os.environ.get("ARCHE_API_KEY") or input("ArcheAI API key: ")
BASE = os.environ.get("ARCHE_BASE_URL", "https://api.arche-ai.com")
AUDIO = os.environ.get("ARCHE_DEMO_AUDIO", "session_demo.wav")
client = ArcheClient(api_key=API_KEY, base_url=BASE)
print(f"credits: {client.account()['credits']} | file: {AUDIO} ({os.path.getsize(AUDIO)/1e6:.1f} MB)")
credits: 1496 | file: session_demo.wav (5.8 MB)
1. Run the session¶
One call: upload (bytes go straight to cloud storage via a signed URL, never through the API
gateway) → POST /v1/analyses/session → poll → SessionResult. Lines requested here:
transcript, speakers, style, personality. delete_after=True removes the audio as soon
as the result is back.
t0 = time.time()
sess = client.analyze_session(AUDIO, lines=["transcript", "speakers", "style", "personality"],
timeout=900, delete_after=True)
st = sess.statistics or {}
print(f"status: {sess.status} | {st.get('n_speakers')} speakers, {st.get('n_utterances')} utterances, "
f"{st.get('duration_s')} s of audio | {time.time()-t0:.0f} s wall")
print(f"transcription: {st.get('transcription')}")
print(f"artifact: {(sess.raw or {}).get('artifact_version')}")
status: completed | 2 speakers, 17 utterances, 180 s of audio | 11 s wall
transcription: {'model': None, 'phi_mode': False, 'provider': 'assemblyai', 'redacted': False}
artifact: session_v1(style+personality students)
2. The transcript, by speaker¶
Diarized utterances with timestamps. Speaker labels are per-recording (A, B, …) — the
pipeline does not identify people.
tr = pd.DataFrame(sess.transcript)
tr["start_s"] = (tr["start_ms"] / 1000).round(1)
share = tr.groupby("speaker")["text"].apply(lambda s: sum(len(t.split()) for t in s)).rename("n_words")
print(share.to_string())
tr[["start_s", "speaker", "text"]].head(10)
speaker A 304 B 149
| start_s | speaker | text | |
|---|---|---|---|
| 0 | 0.2 | A | So it sucks, because I know for a fact that I ... |
| 1 | 36.0 | B | Can't wear vans or what? |
| 2 | 37.4 | A | You fucking wear vans. Five years, I had high ... |
| 3 | 44.4 | B | What? |
| 4 | 45.2 | A | Yeah. Cause that's what she gave me. High chol... |
| 5 | 48.4 | B | You're so salty. |
| 6 | 49.5 | A | What do you mean? We met through mutual friend... |
| 7 | 85.6 | B | We met through, like, mutual friends. I didn't... |
| 8 | 116.0 | A | I wasn't interested in him. The first thing he... |
| 9 | 150.2 | B | Like, a nine. That was kind of one of the reas... |
3. Per-speaker style and personality¶
speaker_frame() → one row per speaker with the scores (or a note explaining why a
short-spoken speaker was not scored). Style dimensions are z-scores against
executive-register norms and read pole A → pole B (positive = more of the second pole):
"+1.0" means one standard deviation more than the typical executive in Q&A — a conversation
between friends will sit well off those norms on formal_conversational, and that is
information, not error. Personality traits are on the Big Five 1–5 scale (the text model's
native units), with confidence reflecting how much text they rest on.
def _flat(row, key):
d = row.get(key) or {}
if not isinstance(d, dict):
return {}
inner = d.get("dimensions") or d.get("traits") or {}
out = {}
for k, v in inner.items():
out[f"{key}_{k}"] = v.get("score", v.get("z")) if isinstance(v, dict) else v
if "confidence" in d:
out[f"{key}_confidence"] = d["confidence"]
return out
flat = pd.DataFrame([{"speaker": r["speaker"], "n_words": r["n_words"], "note": r.get("note", ""),
**_flat(r, "style"), **_flat(r, "personality")} for r in sess.behavioral_speakers])
num = [c for c in flat.columns if c.startswith(("style_", "personality_")) and pd.api.types.is_numeric_dtype(flat[c])]
flat[["speaker", "n_words", "note"] + num].round(2)
| speaker | n_words | note | style_authority_people | style_concrete_abstract | style_uncertain_certain | style_tentative_assertive | style_formal_conversational | style_pessimistic_optimistic | style_intellectual_colloquial | personality_openness | personality_neuroticism | personality_extraversion | personality_agreeableness | personality_conscientiousness | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | A | 304 | 1.46 | 0.61 | 0.88 | 0.20 | 2.66 | -0.99 | 0.95 | 4.53 | 3.17 | 4.45 | 3.86 | 4.98 | |
| 1 | B | 149 | 2.06 | 0.05 | -0.14 | -0.86 | 2.61 | 1.25 | 1.29 | 4.65 | 3.02 | 4.52 | 3.86 | 5.02 |
4. Familiarity between the two main speakers¶
The convergence line asks whether two different speakers' voices drift toward each other
the way voices do between people who have interacted before. It needs each speaker's audio
separately, so we cut the two most-talkative speakers' turns from the recording and upload each
as its own clip. Output is a familiarity_signal (higher = more convergence) — a lead for an
investigator, not proof of contact. On held-out pairs the line separates familiar from
unfamiliar at AUC 0.72–0.83.
import numpy as np, soundfile as sf
top2 = share.sort_values(ascending=False).index[:2].tolist()
wav, sr = sf.read(AUDIO, dtype="float32")
if wav.ndim > 1:
wav = wav.mean(axis=1)
for s in top2:
parts = [wav[int(u["start_ms"]*sr/1000):int(u["end_ms"]*sr/1000)] for u in sess.transcript if u.get("speaker") == s]
clip = np.concatenate(parts) if parts else np.zeros(sr, dtype="float32")
sf.write(f"speaker_{s}.wav", clip, sr, subtype="PCM_16")
print(f"speaker {s}: {len(clip)/sr:.0f} s of speech")
a_id = client.upload_audio(f"speaker_{top2[0]}.wav"); b_id = client.upload_audio(f"speaker_{top2[1]}.wav")
conv = client.wait(client.analyze_convergence(a_id, b_id), timeout=600)
r = conv.result or {}
print(f"familiarity_signal({top2[0]}, {top2[1]}) = {r.get('familiarity_signal')} | {r.get('notes')}")
_ = client.delete_audio(a_id), client.delete_audio(b_id) # clips removed from storage immediately
speaker A: 126 s of speech speaker B: 45 s of speech
familiarity_signal(A, B) = 0.5485 | Phonetic-convergence signal from wav2vec2 representations. Higher values are consistent with prior interaction between the speakers; the signal strengthens with accumulated contact. Research-stage capability — a lead for analysts, not proof of contact.
5. Summary¶
One screen: who spoke how much, how each scored speaker reads on style and traits relative
to executive norms, and whether the two main voices show familiarity. Read every number as a
research signal for a trained reader. docs/interpreting-scores.md has the full guide; for
longitudinal monitoring of named executives see examples/exec_monitoring.ipynb.
print(f"Recording: {AUDIO} — {st.get('duration_s')} s, {st.get('n_speakers')} speakers, {st.get('n_utterances')} utterances")
for _, row in flat.sort_values("n_words", ascending=False).iterrows():
top = sorted([(c, row[c]) for c in num if c.startswith("style_") and pd.notna(row[c])], key=lambda t: -abs(t[1]))[:3]
desc = ", ".join(f"{c.replace('style_','')} {v:+.1f}" for c, v in top) if top else (row["note"] or "not scored")
print(f" {row['speaker']}: {int(row['n_words'])} words — {desc}")
print(f"Familiarity ({top2[0]}↔{top2[1]}): {r.get('familiarity_signal')}")
print("Deception (audio): withdrawn 2026-10-14; in rebuild as a reference-based signal that pairs with the text fraud-language line.")
Recording: session_demo.wav — 180 s, 2 speakers, 17 utterances A: 304 words — formal_conversational +2.7, authority_people +1.5, pessimistic_optimistic -1.0 B: 149 words — formal_conversational +2.6, authority_people +2.1, intellectual_colloquial +1.3 Familiarity (A↔B): 0.5485 Deception (audio): withdrawn 2026-10-14; in rebuild as a reference-based signal that pairs with the text fraud-language line.