AI Studio
AI Studio is a conversation workspace for designing, modifying, and inspecting Dagy workflows. It can use the node catalog, generate workflow YAML and Python, validate supported workflow structure, estimate execution cost, and suggest dependencies. It can also help find runs, explain failures, inspect run metrics, and propose fixes.
On this page
Start in the web appDiscover tiers and creditsCreate a sessionSend a messageStream a responseAttach requirements or sample dataManage sessions and draftsReview generated actionsTroubleshootUse it to accelerate a draft, then review configuration, credentials, generated code, and behavior before deploying. A generated workflow or successful validation does not prove that provider access or business logic is correct. Suggested operational fixes are not automatically applied to a running flow.
Start in the web app
- Open AI Studio in your workspace.
- Choose an available tier. Availability and limits depend on your plan and credit balance.
- Describe the trigger, source, transformations, destination, and failure behavior. Refer to existing flow and connector names when relevant.
- Review the generated canvas and source. Fill in required provider settings and secrets.
- Validate, save a draft, and test with representative inputs before deployment.
A useful prompt is:
Build a workflow that receives an order ID, fetches the order from our HTTPS API, rejects missing customer IDs, and writes the normalized result to object storage. Route invalid records to a review destination. Keep credentials in environment secrets.
Ask for an explanation or run investigation when you do not want a new workflow. For example: “Explain why run RUN_ID failed and suggest the smallest configuration change.” Available tools depend on the deployed service. Web research is available only where enabled; source links are returned when research is used.
Discover tiers and credits
All requests use authentication. Reads require flows.read; session creation, messages, attachments, and edits require flows.write.
curl --fail-with-body "$DAGY_API_URL/ai-studio/tiers" \
-H "Authorization: Bearer $DAGY_TOKEN"Use returned tiers, default_tier, and credits_balance. Tier data includes the limits applicable to the service. Do not hardcode a model name, plan entitlement, conversation limit, or credit cost from an example.
Sending a message can consume credits even when it does not produce a valid deployable workflow. Inspect the response's credits_used and validation result.
Create a session
curl --fail-with-body "$DAGY_API_URL/ai-studio/sessions" \
-H "Authorization: Bearer $DAGY_TOKEN" \
-H 'Content-Type: application/json' \
--data '{"title":"Order ingestion design","flow_name":"process-orders"}'The response contains session_id, title, tier, status, messages, canvas_state, generated source fields, attachments, credit usage, and timestamps. Omit tier to use the plan's default.
If an active session is already bound to the supplied flow_name, the API returns it instead of creating another. A creation request can include message, but that initial message is stored only; use the messages endpoint to run an AI turn.
Titles permit up to 120 characters. Messages permit up to 8,000 characters. Use attachments for longer reference material.
Send a message
curl --fail-with-body \
"$DAGY_API_URL/ai-studio/sessions/$SESSION_ID/messages" \
-H "Authorization: Bearer $DAGY_TOKEN" \
-H 'Content-Type: application/json' \
-H 'X-Idempotency-Key: order-design-turn-1' \
--data '{
"message":"Design the order ingestion workflow described in our current requirements.",
"intent":"build",
"turn_id":"order-design-turn-1"
}'intent | Use |
|---|---|
auto | Let the service interpret the request; default |
build | Request a new workflow and require a valid workflow result |
modify | Change an existing workflow and require a valid workflow result |
advisory | Ask for explanation, investigation, or advice |
The response includes:
| Field | Meaning |
|---|---|
response | Assistant text |
session | Updated session state |
canvas_state | Generated or updated graph when available |
pipeline_yaml, pipeline_python | Generated source when available |
workflow_status, workflow_errors, validation | Whether the requested workflow meets validation requirements |
requires_confirmation, confirmation_node_types | Generated operations needing explicit review |
credits_used | Credits charged for the turn |
research_sources | Research references when used |
An invalid build or modify result returns 422 with this workflow-oriented response and workflow_errors. It is not the usual {"detail":...} API error. Display those errors and request a correction; do not deploy a missing or invalid graph.
Use a stable turn_id for retries of the same turn. The synchronous endpoint also accepts X-Idempotency-Key and rejects detected duplicates with 409. A completed turn returns 409 if resubmitted. After an uncertain timeout, fetch the session and inspect its messages before retrying; this is not a general exactly-once guarantee for generation or billing.
Stream a response
curl --no-buffer --fail-with-body \
"$DAGY_API_URL/ai-studio/sessions/$SESSION_ID/messages/stream" \
-H "Authorization: Bearer $DAGY_TOKEN" \
-H 'Content-Type: application/json' \
--data '{"message":"Explain this workflow.","intent":"advisory","turn_id":"review-1"}'The response is text/event-stream. Some Dagy environments provide a separate base URL for streaming; use that URL for this request when supplied by your administrator. A normal API gateway can time out or buffer long responses, so confirm streaming support before implementing this client.
Use a client that supports streaming POST requests with authentication headers, such as a streaming fetch client. Browser EventSource alone cannot send this request shape.
| SSE event | Contents/purpose |
|---|---|
token | Text update in delta |
tool_start | Tool activity started |
tool_end | Tool activity completed |
canvas_update | Updated graph or generated source |
error | Error code and detail; may include workflow validation information |
done | Final session, source, validation, confirmation requirements, and credits |
Example frame:
event: token
data: {"delta":"The workflow begins by receiving an order ID."}
Once streaming begins, errors may arrive as SSE events even when the HTTP response was 200. An invalid workflow can produce an error followed by done; inspect workflow_errors in the final event instead of treating done as unconditional success. If the connection closes early, reload the session before retrying.
Attach requirements or sample data
Supported attachment types are PDF, Word (.docx), PowerPoint (.pptx), CSV, plain text/Markdown, JSON, and YAML. Each file must be nonempty and at most 25 MiB (26,214,400 bytes). Attachment counts depend on the selected tier.
- Initiate an upload:
POST /ai-studio/sessions/SESSION_ID/attachments/initiate
Authorization: Bearer YOUR_DAGY_TOKEN
Content-Type: application/json
{"filename":"requirements.md","file_size":1234,"content_type":"text/plain"}- Read
upload_url,upload_method,upload_headers,attachment_id, ands3_keyfrom the response.s3_keyis an opaque upload handle; preserve it exactly. Upload the actual bytes to the returned URL using the returned method and headers. Do not send your Dagy bearer token to that URL. Upload URLs expire after one hour. - Complete the upload:
POST /ai-studio/sessions/SESSION_ID/attachments/complete
Authorization: Bearer YOUR_DAGY_TOKEN
Content-Type: application/json
{
"attachment_id":"RETURNED_ATTACHMENT_ID",
"filename":"requirements.md",
"s3_key":"RETURNED_UPLOAD_HANDLE",
"content_type":"text/plain"
}- Inspect
attachment.parse_statusandparse_error. An HTTP success does not guarantee that parsing succeeded. Correct or replace a failed attachment before asking the assistant to rely on it. - Send a message explaining how the attachment should inform the workflow.
Remove a session attachment with DELETE /ai-studio/sessions/{id}/attachments/{attachment_id}. Submit only reference material you are authorized to use, and keep credentials in your secret store rather than in prompts or sample files.
Manage sessions and drafts
| Operation | Request/body |
|---|---|
| List your sessions | GET /ai-studio/sessions?status=active,draft&limit=25 |
| Read session | GET /ai-studio/sessions/{id} |
| Find by flow | GET /ai-studio/sessions/by-flow/{flow_name} |
| Bind to a flow | POST /ai-studio/sessions/{id}/bind-flow, {"flow_name":"process-orders"} |
| Rename | PATCH /ai-studio/sessions/{id}/title, {"title":"Order pipeline review"} |
| Change tier | PATCH /ai-studio/sessions/{id}/tier, {"tier":"AVAILABLE_TIER_ID"} |
| Save canvas edits | PATCH /ai-studio/sessions/{id}/canvas, {"canvas_state":{...}} |
| Archive | POST /ai-studio/sessions/{id}/archive |
| Delete | DELETE /ai-studio/sessions/{id} |
Lists accept active, draft, and archived, including comma-separated combinations. Default status is active; list limits are clamped to 1–100. The list is scoped to the current user; individual session and flow lookups are workspace-scoped. Do not assume conversations are private from other authorized members of the workspace.
Canvas updates must be nonempty JSON objects and cannot exceed 200,000 serialized bytes. Session drafts and generated source are not production deployments; use the normal review, test, and deployment workflow.
Review generated actions
Generated python_function, shell_command, and docker_container nodes can require explicit confirmation. Inspect requires_confirmation and the generated node types before proceeding. Code validation applies restrictions to AI-authored code but does not replace code review or your execution security requirements.
Verify target URLs, data destinations, dependencies, provider permissions, limits, and error branches. Review sample inputs and expected outputs with the same care as hand-written workflows.
Troubleshoot
| Result | Resolution |
|---|---|
400 invalid message/title/intent | Use documented limits and one of the four intent values |
402 insufficient credits | Check tier and workspace credit balance |
403 tier unavailable | Select a tier returned by /ai-studio/tiers |
404 | Check session/flow identity and workspace |
409 duplicate/completed turn | Fetch session state and use a new turn ID only for a new request |
422 invalid workflow | Display workflow_errors and revise the request or graph |
429 session turn or attachment limit | Start a new session or remove attachments as appropriate; inspect the detail |
SSE error or 5xx | Preserve session/turn IDs, reload state, and retry only after reconciling the previous result |
Legacy /ui/ai-studio/generate and /ui/ai-studio/generate-and-save routes are retired. Integrations should use the session APIs described here.