SDKs
Archyl provides official SDKs for Node.js and Python. Both are lightweight wrappers around the REST API that handle authentication, serialization, and error handling for you.
Installation
Node.js
npm install @archyl/sdk
Python
pip install archyl-sdk
Quick Start
Node.js
import { ArchylClient } from "@archyl/sdk";
const client = new ArchylClient({
apiKey: process.env.ARCHYL_API_KEY,
organizationId: "your-org-id",
});
// List projects
const projects = await client.projects.list();
// Get C4 model
const model = await client.projects.getC4Model("project-id");
// Compute drift score
const drift = await client.governance.computeDrift("project-id");
// Create an ADR
const adr = await client.docs.createADR("project-id", {
title: "Use PostgreSQL for persistence",
status: "accepted",
context: "We need a relational database for transactional data.",
decision: "Adopt PostgreSQL 16 as the primary datastore.",
consequences: "Team must learn PostgreSQL-specific features.",
});
Python
from archyl import ArchylClient
client = ArchylClient(
api_key=os.environ["ARCHYL_API_KEY"],
organization_id="your-org-id",
)
# List projects
projects = client.projects.list()
# Get C4 model
model = client.projects.get_c4_model("project-id")
# Compute drift score
drift = client.governance.compute_drift("project-id")
# Create an ADR
adr = client.docs.create_adr("project-id",
title="Use PostgreSQL for persistence",
status="accepted",
context="We need a relational database for transactional data.",
decision="Adopt PostgreSQL 16 as the primary datastore.",
consequences="Team must learn PostgreSQL-specific features.",
)
API Reference
Projects
| Method |
Description |
projects.list() |
List all projects in the organization |
projects.get(projectId) |
Get a project by ID |
projects.create(data) |
Create a new project |
projects.getC4Model(projectId) |
Get the full C4 model for a project |
projects.getAgentContext(projectId) |
Get the architectural context (rules, tech radar, decisions) |
C4 Model
| Method |
Description |
c4.createSystem(projectId, data) |
Create a system |
c4.updateSystem(projectId, systemId, data) |
Update a system |
c4.createContainer(projectId, systemId, data) |
Create a container |
c4.updateContainer(projectId, containerId, data) |
Update a container |
c4.createComponent(projectId, containerId, data) |
Create a component |
c4.createRelationship(projectId, data) |
Create a relationship between elements |
c4.listRelationships(projectId) |
List all relationships |
Governance
| Method |
Description |
governance.runConformanceCheck(projectId, data) |
Run conformance rules against files |
governance.getReport(checkId) |
Get the full report for a check |
governance.listRules() |
List all conformance rules |
governance.createRule(data) |
Create a conformance rule |
governance.getStats(projectId?) |
Get conformance statistics |
governance.computeDrift(projectId) |
Compute the drift score for a project |
governance.getDriftScore(projectId) |
Get the latest drift score |
governance.getDriftHistory(projectId) |
Get drift score history over time |
DORA Metrics
| Method |
Description |
dora.getMetrics(projectId) |
Get current DORA metrics |
dora.getTrend(projectId) |
Get DORA metrics trend over time |
Documentation
| Method |
Description |
docs.listADRs(projectId) |
List Architecture Decision Records |
docs.createADR(projectId, data) |
Create an ADR |
docs.listReleases(projectId) |
List releases |
docs.createRelease(projectId, data) |
Create a release |
docs.listChangeRequests(projectId) |
List change requests |
docs.createChangeRequest(projectId, data) |
Create a change request |
Error Handling
Both SDKs throw typed errors with the HTTP status code and error details from the API.
Node.js
import { ArchylError } from "@archyl/sdk";
try {
await client.projects.get("nonexistent-id");
} catch (error) {
if (error instanceof ArchylError) {
console.error(error.status); // 404
console.error(error.code); // "NOT_FOUND"
console.error(error.message); // "Project not found"
}
}
Python
from archyl import ArchylError
try:
client.projects.get("nonexistent-id")
except ArchylError as e:
print(e.status) # 404
print(e.code) # "NOT_FOUND"
print(e.message) # "Project not found"
Common status codes:
| Code |
Meaning |
| 400 |
Bad Request - Invalid parameters |
| 401 |
Unauthorized - Invalid or missing API key |
| 403 |
Forbidden - Insufficient permissions |
| 404 |
Not Found - Resource doesn't exist |
| 429 |
Too Many Requests - Rate limit exceeded |
| 500 |
Internal Server Error |
Configuration
Custom Base URL
For self-hosted Archyl instances, pass a custom baseUrl:
const client = new ArchylClient({
apiKey: "your-api-key",
organizationId: "your-org-id",
baseUrl: "https://archyl.your-company.com/api/v1",
});
client = ArchylClient(
api_key="your-api-key",
organization_id="your-org-id",
base_url="https://archyl.your-company.com/api/v1",
)
Source Code
Both SDKs are open source:
Next Steps