Quickstart¶
Build an identity-aware agent in 5 minutes.
What you'll do
- Install the SDK
- Create an agent instance
- Send observations, get an ExecutionContract
- Use the contract to control your agent's behavior
Time: ~5 minutes · Prerequisites: Python 3.8+ or Node.js 16+
Step 1: Install¶
Set your API key:
How do I get an API key?
Visit identity-os.dev → Sign up → Settings → API Keys → Create
Step 2: Create an Instance¶
An instance = one agent's identity. Create it once, send observations over time.
Step 3: Send an Observation¶
Tell the engine what your agent is doing. Pick a mode and signal strength:
| Mode | When to use |
|---|---|
perception | Agent is reading, analyzing, gathering info |
exploration | Agent is trying new approaches, being creative |
order | Agent is following procedures, being systematic |
assertion | Agent is executing, making decisions |
connection | Agent is collaborating, being empathetic |
stress_response | Agent encountered an error, got stuck, or is under pressure |
Step 4: Use the ExecutionContract¶
The contract tells your agent what it can do right now:
contract = result.contract
# What tools are available?
print(contract.allowed_actions)
# ['explore', 'question', 'pivot', 'suggest']
# Should the agent stop?
print(contract.should_pause) # False
print(contract.should_escalate) # False
# How should it decide?
print(contract.decision_style)
# {'tempo': 'exploratory', 'risk': 'seeking'}
# What's its energy and stress?
print(contract.energy_level) # 0.83
print(contract.stress_state) # 'LOW'
Use it in your agent loop:
if contract.should_pause:
agent.stop("Identity OS says: take a break")
elif "execute" in contract.allowed_actions:
agent.execute_plan()
elif contract.stress_state in ("HIGH", "OVER"):
agent.fallback_to_safe_mode()
else:
agent.continue_normally()
Step 5: Multi-Turn Example¶
A realistic 4-turn agent session:
from identity_os_sdk import IdentityOS, Mode
client = IdentityOS(api_key="idos_sk_xxx")
agent = client.instances.create(name="Researcher")
# Turn 1: Agent reads the task
r = client.engine.process(agent.id, mode_target=Mode.PERCEPTION, signal_strength=0.7)
print(f"Energy: {r.contract.energy_level}, Actions: {len(r.contract.allowed_actions)}")
# Turn 2: Agent explores approaches
r = client.engine.process(agent.id, mode_target=Mode.EXPLORATION, signal_strength=0.85)
print(f"Tempo: {r.contract.decision_style['tempo']}") # 'exploratory'
# Turn 3: Agent hits a problem — stress rises
r = client.engine.process(agent.id, mode_target=Mode.STRESS_RESPONSE, signal_strength=0.6)
print(f"Stress: {r.contract.stress_state}") # 'MED' or 'HIGH'
print(f"Actions: {r.contract.allowed_actions}") # fewer actions available
# Turn 4: Agent recovers
r = client.engine.process(agent.id, mode_target=Mode.ORDER, signal_strength=0.8)
print(f"Stress: {r.contract.stress_state}") # back to 'LOW'
What happens: - Turn 1–2: Normal operation, full action space - Turn 3: Stress rises → risky actions removed → agent is safer - Turn 4: Recovery → actions expand back → agent continues
What's Next?¶
Understand the model
Integrate with your framework