Organizational behavior, practiced on AI agents.
Project description
vstack
Organizational behavior, practiced on AI agents.
vstack is a curated library of design patterns for AI agents and multi-agent systems, anchored in named organizational-behavior (OB) literature — Wharton's After-Action Review, Lencioni's Five Dysfunctions, Edmondson's Psychological Safety, Frei & Morriss's Trust Triangle, Stone & Heen's "Thanks for the Feedback" — translated into runnable code, public benchmarks, and Substack-ready essays.
Most agent observability tools capture what happened (traces). Most incident-response tools handle single events (a postmortem per alert). vstack ships a curated library of organizational practices — the same frameworks human teams use to learn, debate, escalate, and improve — implemented as patterns AI agents can run themselves.
Where the existing agent ecosystem treats failures as bugs to debug, vstack treats them as learning events to organize around.
Disambiguation
You may have seen "vstack: Constitutional Governance for Autonomous Agent Economies via Separation of Power" (NetX Foundation, April 2026). That paper is about blockchain-based governance for agent economies. This is a different project. vstack-the-library is an open-source pattern library for applying organizational-behavior frameworks to AI agent design — no blockchain, no governance protocols, no agent economies. Same name, different domain.
What's in here
Three modules mirror the standard organizational-behavior curriculum:
- Module 1 — Individual Agent Patterns — Lewin's B=f(I,E), Goleman EI domains, Big Five/HEXACO personality, Vroom expectancy, 4 motivation traps, Yerkes-Dodson optimal workload, Johari Window self-audit.
- Module 2 — Multi-Agent Team Patterns — Lencioni Five Dysfunctions diagnostic, Frei & Morriss Trust Triangle audit, Edmondson Psychological Safety score, AAR generator, GRPI working agreement, Thomas-Kilmann conflict-style router, social-loafing and process-loss detectors.
- Module 3 — System / Organizational Patterns — Schein's Iceberg culture audit, span-of-control calculator, centralization/decentralization trade-off analyzer.
A full index is in PATTERNS.md. Academic citations are in CITATIONS.md.
How each pattern is shipped
Every pattern in vstack ships five layers:
- Documented. A README explaining the OB framework, the agent failure mode it addresses, the academic citation, and the proposed intervention.
- Implemented. A working Python (and optionally TypeScript) library.
- Demoed. A runnable example on at least one major agent framework (Claude Agent SDK, LangGraph, OpenAI Agents SDK, CrewAI, AutoGen, Mastra, Strands).
- Benchmarked. An eval on a public multi-agent task (GAIA, SWE-Bench-multi, AppWorld, AgentBench).
- Written up. A Substack-ready essay drafting the pattern, the failure it addresses, and the underlying OB theory — paper outline included.
Patterns ship one at a time, fully completed. Quantity loses to quality. All 34 patterns from the roadmap are shipped. v0.1.0 adds the production-readiness layer (structured logging with run-id correlation, optional token/cost telemetry, prompt-injection input guards, async LLM clients, configurable timeouts, py.typed marker, security policy, release automation).
Install
pip install valanistack
Optional extras (per LLM backend):
pip install "vstack[anthropic]" # Anthropic
pip install "vstack[openai]" # OpenAI
pip install "vstack[all]" # both
Python 3.11+ required (3.11, 3.12, 3.13 tested in CI). For the absolute latest pre-release, install from source: pip install git+https://github.com/valani9/vstack.git.
Quick start
from datetime import datetime, timezone
from vstack.aar import AARGenerator, AgentTrace, TraceStep
from vstack.aar.clients import AnthropicClient
# Build (or import from your observability tool) a structured trace of a
# failed agent run.
trace = AgentTrace(
goal="Refactor the auth module to use JWTs.",
steps=[
TraceStep(
timestamp=datetime.now(timezone.utc),
type="tool_call",
content="edit_file(path='auth/middleware.py')",
),
# ... more steps
],
outcome="Created JWT logic but broke the session middleware.",
success=False,
)
# Run the Wharton 4-step AAR.
aar = AARGenerator(llm_client=AnthropicClient()).generate(trace)
print(aar.to_markdown()) # human-readable AAR
print(aar.suggested_prompt_patch) # concrete prompt edit
print(aar.lesson_record_for_memory) # inject into agent memory
See module-2-team/30-aar-generator/demo/ for a self-contained example you can run with no API key (uses a deterministic StubClient).
Command-line interface
Installing the package also installs an vstack CLI binary:
# Generate an AAR from a JSON trace, read from a file, write markdown to stdout
vstack aar --trace path/to/trace.json --client anthropic
# Pipe a trace from stdin (useful in shell pipelines)
cat trace.json | vstack aar --client openai
# Get JSON output instead of markdown
vstack aar --trace trace.json --client anthropic --format json > aar.json
# Try the pipeline without an API key (deterministic stub responses)
echo '{"goal":"x","outcome":"y","success":false,"steps":[]}' | vstack aar --client stub
# Verbose mode (-v INFO, -vv DEBUG)
vstack aar -vv --trace trace.json --client anthropic
# Print version
vstack version
The --client flag accepts stub, anthropic, openai, or ollama. The stub client is deterministic and requires no API key, useful for trying the pipeline before committing to a provider. The Anthropic and OpenAI clients read API keys from ANTHROPIC_API_KEY and OPENAI_API_KEY environment variables.
Production-readiness
The library is built to ship:
- Retry with exponential backoff on rate limits, transient network errors, and provider 5xx — configurable via
max_retries. - Graceful degradation on malformed LLM JSON output — bad lessons/next-steps are dropped with a warning log, not raised; a partial AAR is more useful than no AAR.
- Trace truncation for inputs larger than
max_trace_chars(default 200K characters) — middle-truncated to keep the most informative head and tail of the agent run. - Structured logging via Python
loggingunder thevstack.aarnamespace. - Type-safe —
mypy --strictclean across the library. - CI — GitHub Actions runs tests, ruff lint, ruff format check, mypy strict, and a wheel-build sanity check on every push and pull request, across Python 3.11 / 3.12 / 3.13 on Linux and macOS.
Who this is for
- AI builders shipping agents in production who notice their systems failing in patterns that look like organizational problems, not just engineering ones.
- Multi-agent system developers tired of treating their orchestrator as a router and looking for vocabulary for what's actually happening.
- Researchers exploring the intersection of organizational behavior and AI agent design.
- Curious humans who want to think about what it means for AI agents to learn, disagree, escalate, and trust each other — and recognize that we have 80 years of human-organization research to draw on.
Status
Complete. All 34 patterns shipped at the 5-layer quality bar (docs + lib + demo + benchmark + essay):
vstack.aar(#30) — After-Action Review generatorvstack.lencioni(#17) — Five-Dysfunctions diagnosticvstack.trust_triangle(#18) — Frei & Morriss Trust Triangle auditvstack.johari(#03) — Johari Window self-auditvstack.grpi(#13) — GRPI Working Agreement generatorvstack.bias_stack(#27) — Kahneman/Tversky Bias-Stack detectorvstack.psych_safety(#20) — Edmondson Psychological Safety scorevstack.thomas_kilmann(#29) — Thomas-Kilmann Conflict Style selectorvstack.feedback_triggers(#22) — Stone & Heen 3-Trigger feedback diagnosticvstack.devils_advocate(#28) — Critical-Evaluator / Devil's Advocate role separatorvstack.lewin(#01) — Lewin Formula B = f(I, E) attribution diagnosticvstack.mcallister_trust(#19) — McAllister Cognitive vs Affective Trust dimensionsvstack.social_loafing(#15) — Latané Social Loafing detectorvstack.debate_pathology(#26) — Groupthink / Polarization / Emotional Contagion detectorvstack.process_gain_loss(#14) — Steiner / Robbins & Judge Process Gain/Loss detectorvstack.smart_goal(#24) — Doran SMART Goal generatorvstack.mcgregor(#11) — McGregor Theory X/Y Orchestrator Mode detectorvstack.group_decision(#25) — Stewart / Kaner Group Decision Models generator (fist-to-five + 4 others)vstack.schein_culture(#31) — Schein Iceberg Culture Audit (first Module 3 pattern)vstack.grant_strengths(#08) — Adam Grant Strengths-as-Weaknesses detectorvstack.plus_delta(#23) — Brené Brown Plus/Delta inter-agent feedback format generatorvstack.robbins_culture(#32) — Robbins & Judge 7-Characteristics Culture profile diagnosticvstack.superflocks(#16) — Heffernan/Muir Superflocks routing-fragility detectorvstack.yerkes_dodson(#06) — Yerkes-Dodson Optimal Workload pressure-curve diagnosticvstack.org_structure(#33) — Galbraith/Mintzberg Org-Structure Matrix analyzer (third Module 3 pattern)vstack.motivation_traps(#09) — Saxberg 4 Motivation Traps diagnostic (Values / Self-Efficacy / Emotions / Attribution)vstack.glaser_conversation(#21) — Glaser Cortisol/Oxytocin Conversation Steering diagnosticvstack.goleman_ei(#02) — Goleman/Boyatzis 4-Domain Emotional Intelligence audit (SELF/OTHER × RECOGNITION/REGULATION)vstack.sdt_reward(#10) — Deci & Ryan Self-Determination Theory intrinsic reward shaping (autonomy / competence / relatedness)vstack.span_of_control(#34) — deterministic Span-of-Control / Centralization calculator (fourth Module 3 pattern)vstack.danva_emotion(#04) — Nowicki/Duke DANVA-style emotion recognition (deterministic per-emotion accuracy + confusion + intensity)vstack.cognitive_reappraisal(#05) — Gross emotion-regulation strategy diagnostic (reappraisal vs suppression vs rumination vs avoidance)vstack.hexaco(#07) — Lee & Ashton 6-factor personality + H-factor safety riskvstack.vroom_expectancy(#12) — Vroom E × I × V motivation calculus with bottleneck-term diagnostic
The 34-pattern roadmap is complete. See PATTERNS.md for the full list.
License
MIT.
Maintainer
Ilhan Valani — builder, working in public. Background: github.com/valani9. Inspired by the open-source-as-credibility-engine practice of gstack.
If you're an AI builder, an OB researcher, or an academic who'd like to collaborate on a pattern, open an issue or reach out.
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file valanistack-0.1.0.tar.gz.
File metadata
- Download URL: valanistack-0.1.0.tar.gz
- Upload date:
- Size: 1.2 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
560204045b29b381638f0ed8b77689f960501dddaa526d6c80dc56fc4adb4924
|
|
| MD5 |
ce0e14ab13e8ce57df765415ea57bec1
|
|
| BLAKE2b-256 |
27294889456449048231e72b936ffc2d46f69d74c3a7617f8dda1c6cc71bfbce
|
Provenance
The following attestation bundles were made for valanistack-0.1.0.tar.gz:
Publisher:
release.yml on valani9/vstack
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
valanistack-0.1.0.tar.gz -
Subject digest:
560204045b29b381638f0ed8b77689f960501dddaa526d6c80dc56fc4adb4924 - Sigstore transparency entry: 1629144488
- Sigstore integration time:
-
Permalink:
valani9/vstack@0ee62fb755b7c1b481e29bec963f6eb837c29507 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/valani9
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@0ee62fb755b7c1b481e29bec963f6eb837c29507 -
Trigger Event:
push
-
Statement type:
File details
Details for the file valanistack-0.1.0-py3-none-any.whl.
File metadata
- Download URL: valanistack-0.1.0-py3-none-any.whl
- Upload date:
- Size: 888.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
694e3ed8c64c54d7c52b87af62f4af26d82d0780639065aff676da8b87babe3c
|
|
| MD5 |
0dd5706c3f6ec16c70a6a048d0fb34f1
|
|
| BLAKE2b-256 |
f57549245e6928774435bf3bd0d578c6f46c28f666e0a03a86668a5a1a494b5e
|
Provenance
The following attestation bundles were made for valanistack-0.1.0-py3-none-any.whl:
Publisher:
release.yml on valani9/vstack
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
valanistack-0.1.0-py3-none-any.whl -
Subject digest:
694e3ed8c64c54d7c52b87af62f4af26d82d0780639065aff676da8b87babe3c - Sigstore transparency entry: 1629144510
- Sigstore integration time:
-
Permalink:
valani9/vstack@0ee62fb755b7c1b481e29bec963f6eb837c29507 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/valani9
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@0ee62fb755b7c1b481e29bec963f6eb837c29507 -
Trigger Event:
push
-
Statement type: