# Code

Zerve's AI agent is aware of the context and working of the canvas, this enables it to work more efficiently and create better results.&#x20;

While coding the agent can create add run blocks, add requirements and edges.&#x20;

Before starting a coding process, the agent will present you with Milestone, Summary, Required Inputs, Anticipated Future Milestones and Tickets. Post this you can accept this plan or ask the agent to make changes. Once you are satisfied with the plan you can ask the agent to proceed. Each ticket that can be run in parallel will be assigned to a coding agent. If it faces an error, it will work on fixing it. The video below shows an example of how the agent can help with coding.

{% embed url="<https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIQKNeqjEeOp9UwUcB9R9%2Fuploads%2Fc36dc8LWTSMEyGzhKsKR%2FAgent%20(1)%20(1).mp4?alt=media&token=5d89db13-e173-474b-8c53-58d11a2c7359>" %}
Coding with agent
{% endembed %}

The agent can help with debugging existing code as well. You can click on **Open Error Assist**. The video below shows an example process.

{% embed url="<https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FIQKNeqjEeOp9UwUcB9R9%2Fuploads%2FKUtd1nvfHreYvytANne8%2FError%20Assist.mp4?alt=media&token=cc4e2841-aefa-4826-86b0-6f9fe40846f2>" %}
Error Assist
{% endembed %}

### AI Agent Capabilities

The AI Agent in Zerve is designed to support you throughout your development journey with a broad range of powerful features:

* **Code Generation:** Automatically generates clean, modular, and production-ready code snippets for Python, SQL, R, and more, tailored to your project context.
* **Workflow Design:** Helps you create, edit, and optimize data and AI workflows visually on the Zerve canvas, promoting best practices like modularity and parallel execution.
* **Data Integration Assistance:** Advises on how to connect and query various data sources like Snowflake, Redshift, PostgreSQL, and others within your workflows.
* **Generative AI Support:** Implements GenAI prompts for summarization, extraction, and text generation tasks seamlessly integrated into workflows.
* **Debugging & Optimization:** Suggests improvements, identifies potential errors, and helps you refactor code for better scalability and resilience.
* **Context Awareness:** Understands your canvas context, including layers, blocks, and existing variables, to provide relevant and non-conflicting suggestions.
* **Parallel Execution Guidance:** Helps you leverage Zerve’s fleet capabilities to run tasks in parallel and aggregate results efficiently.
* **API & Deployment Support:** Guides you through creating API endpoints, SageMaker deployments, and managing compute environments.

With these capabilities, the AI Agent enhances your productivity, reduces manual effort, and ensures you build high-quality AI and data solutions on Zerve with ease.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.zerve.ai/guide/canvas-view/ai-agent/code.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
