إنتقل إلى المحتوى الرئيسي

Quickstart

Install the SDK and make your first API call in 5 minutes.

Install

# Python
pip install masar-client

# TypeScript / Node.js
npm install @almadar/masar-client

Get an API Key

Sign up at masar.almadar.io and create an API key from the dashboard.

Plan: What Should the Agent Build?

from masar import MasarClient

client = MasarClient(api_key="your-key")

# Define where you are and where you want to be
current = {"name": "App", "orbitals": []}
goal = client.behaviors.get("std-helpdesk") # built-in behavior

# Get dependency-ordered instructions
plan = client.plan(current=current, goal=goal)
print(f"{len(plan.instructions)} instructions across {plan.levels} levels")

for instr in plan.instructions:
print(f" Level {instr.level}: {instr.action}({instr.params})")

Output:

14 instructions across 7 levels
Level 1: add_trait({"name": "TicketTriage", "linkedEntity": "Ticket"})
Level 2: add_states({"trait": "TicketTriage", "states": [{"name": "new", "isInitial": true}, ...]})
Level 2: add_events({"trait": "TicketTriage", "events": [{"key": "ASSESS"}, ...]})
Level 3: add_transitions({"trait": "TicketTriage", "transitions": [...]})
...

Verify: Is the Result Valid?

result = your_llm.execute(plan.instructions)  # LLM generates the JSON

check = client.verify(schema=result)
print(f"Valid: {check.valid}")
print(f"Probability: {check.probability:.0%}")
print(f"Predicted errors: {check.predicted_errors}")

Remember: Store the Experience

client.memory.store(
schema=result,
domain="helpdesk",
outcome="success",
)

Next time the agent encounters a similar task, Masar will recall this experience and provide pattern-guided planning.

Next Steps