const workflow = await api.workflows.create({
name: "Triage",
trigger: { type: "manual" },
steps: [
{ id: "classify", type: "model.generate", config: { model: "gemini-3.5-flash",
prompt: "Is this urgent? {{input.text}}", schema: { type: "object", properties: { urgent: { type: "boolean" } } } } },
{ id: "check", type: "condition", config: { left: "{{steps.classify.output.urgent}}", operator: "eq", right: true } },
{ id: "approve", type: "human", config: { title: "Send the alert?" } },
{ id: "alert", type: "mail.send", config: { box: "ops@example.com", to: "team@example.com",
subject: "Urgent", text: "{{input.text}}" } },
{ id: "file", type: "storage.write", config: { storage: "…", action: "insert", collection: "tickets",
documents: [{ text: "{{input.text}}" }] } },
],
edges: [
{ from: "__trigger", to: "classify" },
{ from: "classify", to: "check" },
{ from: "check", to: "approve", branch: "true" },
{ from: "check", to: "file", branch: "false" },
{ from: "approve", to: "alert" },
],
});workflow = api.workflows.create({
"name": "Triage",
"trigger": {"type": "manual"},
"steps": [
{"id": "classify", "type": "model.generate", "config": {"model": "gemini-3.5-flash",
"prompt": "Is this urgent? {{input.text}}",
"schema": {"type": "object", "properties": {"urgent": {"type": "boolean"}}}}},
{"id": "check", "type": "condition", "config": {"left": "{{steps.classify.output.urgent}}", "operator": "eq", "right": True}},
{"id": "approve", "type": "human", "config": {"title": "Send the alert?"}},
{"id": "alert", "type": "mail.send", "config": {"box": "ops@example.com", "to": "team@example.com",
"subject": "Urgent", "text": "{{input.text}}"}},
{"id": "file", "type": "storage.write", "config": {"storage": "…", "action": "insert", "collection": "tickets",
"documents": [{"text": "{{input.text}}"}]}},
],
"edges": [
{"from": "__trigger", "to": "classify"},
{"from": "classify", "to": "check"},
{"from": "check", "to": "approve", "branch": "true"},
{"from": "check", "to": "file", "branch": "false"},
{"from": "approve", "to": "alert"},
],
})ما هو مُحَكَّر قبل هو مُنْ
- كل خطوة هي فريدة وجيدة التشكيل، هناك في أكثرها 30.
- كل نوع خطوة موجود، والتشكيل المطلوب الخاص به موجود.
- كل
{{steps.…}}أسماء المُراجع المرجعية فيكون في مُنْج. - الرسم البياني له بالضبط حافة واحدة من الزناد، لا دورة، ولا خطوة غير قابلة للوصل.
- (أ) يكون الشرط
trueوأن تكونfalse; a مُزِل له 1 لكل حالة زائدdefault(أ) المزلاج له مدخلان على الأقل. - أيّ أيّ أيّ أيّ شيء يعمل خارج الحساب لديه
human(ج) تُدرج في اتجاه أعلى. - A
agent.runاسماء فقط الأدوات الموجودة.
A قالب هو الأكثر رفضاً
{{steps.draft.output.textعلى خطوة تمر قبل أن يتم ضبط المشروع هنا بدلاً من إنتاج سلسلة فارغة في وقت التنفيذ. التحقق صارم لأن تدفق العمل يفشل حيث لا يراقب أحد.
تمّ تهسل أدوات الوكيل لك
{ id: "research", type: "agent.run", config: {
model: "gemini-3.5-flash",
tools: { search: api.tools.search, fetch: api.tools.fetch }, // the SDK serialises this
} }# In Python, an agent.run step names its built-in tools; the server runs them
{"id": "research", "type": "agent.run", "config": {
"model": "gemini-3.5-flash",
"tools": ["search", "fetch"],
}}ككتابة كائن يصبح المصفوفة منصة تخزين. كتابة كمصفوفة ، يتم إرسالها كما هي - و اسم أداة مجهول مرفوض مع قائمة من موجود.
الأخطاء
كل شيء فوق كل شيء يعود كما invalid_workflow (400) مع رسالة تسمي الخطوة و المشكلة. هناك رمز واحد لأن هناك إجابة واحدة: أصلح التعريف.