How to build a coding agent with Vikasit AI
A coding agent reads a task, plans changes, edits files, and runs commands in a loop until the job is done. The key is exposing tools (read file, write file, run shell) to the model and feeding results back so it can iterate.
Recommended model
Vikasit 3 Coder
Purpose-built for agentic coding with reliable tool-calls and edit formats — it's the model that powers the Vikasit Code CLI.
Steps
- 1
Define a set of tools (functions) for reading files, writing files, and running shell commands.
- 2
Describe these tools to the model using the OpenAI tools schema.
- 3
Send the user's task plus the tool definitions to vikasit-3-coder.
- 4
When the model returns tool calls, execute them and append the results as tool messages.
- 5
Loop: keep calling the model with updated results until it returns a final answer.
- 6
Add guardrails — confirm destructive commands and cap the number of iterations.
Code
The Vikasit Inference API is OpenAI-compatible, so this uses the standard OpenAI Python SDK pointed at https://api.vikasit.ai/v1.
from openai import OpenAI
client = OpenAI(
base_url="https://api.vikasit.ai/v1",
api_key="sk-vikasit-...", # get one at vikasit.ai/auth
)
tools = [{
"type": "function",
"function": {
"name": "run_shell",
"description": "Run a shell command and return stdout",
"parameters": {
"type": "object",
"properties": {"cmd": {"type": "string"}},
"required": ["cmd"],
},
},
}]
messages = [{"role": "user", "content": "List the Python files and count them."}]
resp = client.chat.completions.create(
model="vikasit-3-coder",
messages=messages,
tools=tools,
)
# Inspect resp.choices[0].message.tool_calls, run them,
# append the results as {"role": "tool", ...}, then call again.Build your coding agent today
Get an API key and 2M free tokens a day on Vikasit Nova. Pay-as-you-go, no minimums, OpenAI-compatible.