!pip install vlmrun
from pydantic import BaseModel, Field
import datetime
from vlmrun.client import VLMRun
from vlmrun.client.types import AgentCreationResponse, AgentCreationConfig, AgentExecutionResponse
from vlmrun.types import MessageContent, FileUrl
# Define a Pydantic model for the execution inputs
class ExecutionInputs(BaseModel):
file: MessageContent = Field(..., description="The file to extract data from")
# Define a Pydantic model for the response
class Invoice(BaseModel):
invoice_id: str = Field(..., description="The ID of the invoice")
invoice_date: datetime.date = Field(..., description="The date of the invoice")
total_amount: float = Field(..., description="The total amount of the invoice")
# Initialize the client
client = VLMRun(api_key="<VLMRUN_API_KEY>")
# Create the agent using a prompt
response: AgentCreationResponse = client.agent.create(
name="invoice-extractor", # Optional name
inputs=ExecutionInputs(file=MessageContent(type="file_url", file_url=FileUrl(url="https://example.com/invoice.pdf"))), # Optional test inputs
config=AgentCreationConfig(prompt="Extract the invoice_id, date and amount from the invoice.", response_model=Invoice),
)
npm install vlmrun zod
import { VlmRun } from 'vlmrun';
import { z } from 'zod';
// Define a Zod schema for the execution inputs
const ExecutionInputsSchema = z.object({
file: z.object({
type: z.literal("file_url"),
file_url: z.object({
url: z.string()
})
}).describe("The file to extract data from")
});
// Define a Zod schema for the response
const InvoiceSchema = z.object({
invoice_id: z.string().describe("The ID of the invoice"),
invoice_date: z.string().date().describe("The date of the invoice"),
total_amount: z.number().describe("The total amount of the invoice")
});
// Initialize the client
const client = new VlmRun({
baseUrl: "https://api.vlm.run/v1",
apiKey: "<VLMRUN_API_KEY>"
});
// Create the agent using a prompt
const response = await client.agent.create({
name: "invoice-extractor", // Optional name
inputs: { // Optional test inputs
file: {
type: "file_url",
file_url: {
url: "https://example.com/invoice.pdf"
}
}
},
config: {
prompt: "Extract the invoice_id, date and amount from the invoice.",
json_schema: JSON.stringify(InvoiceSchema.shape)
}
});
{
"id": "<string>",
"name": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"status": "pending"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}Create Agent
!pip install vlmrun
from pydantic import BaseModel, Field
import datetime
from vlmrun.client import VLMRun
from vlmrun.client.types import AgentCreationResponse, AgentCreationConfig, AgentExecutionResponse
from vlmrun.types import MessageContent, FileUrl
# Define a Pydantic model for the execution inputs
class ExecutionInputs(BaseModel):
file: MessageContent = Field(..., description="The file to extract data from")
# Define a Pydantic model for the response
class Invoice(BaseModel):
invoice_id: str = Field(..., description="The ID of the invoice")
invoice_date: datetime.date = Field(..., description="The date of the invoice")
total_amount: float = Field(..., description="The total amount of the invoice")
# Initialize the client
client = VLMRun(api_key="<VLMRUN_API_KEY>")
# Create the agent using a prompt
response: AgentCreationResponse = client.agent.create(
name="invoice-extractor", # Optional name
inputs=ExecutionInputs(file=MessageContent(type="file_url", file_url=FileUrl(url="https://example.com/invoice.pdf"))), # Optional test inputs
config=AgentCreationConfig(prompt="Extract the invoice_id, date and amount from the invoice.", response_model=Invoice),
)
npm install vlmrun zod
import { VlmRun } from 'vlmrun';
import { z } from 'zod';
// Define a Zod schema for the execution inputs
const ExecutionInputsSchema = z.object({
file: z.object({
type: z.literal("file_url"),
file_url: z.object({
url: z.string()
})
}).describe("The file to extract data from")
});
// Define a Zod schema for the response
const InvoiceSchema = z.object({
invoice_id: z.string().describe("The ID of the invoice"),
invoice_date: z.string().date().describe("The date of the invoice"),
total_amount: z.number().describe("The total amount of the invoice")
});
// Initialize the client
const client = new VlmRun({
baseUrl: "https://api.vlm.run/v1",
apiKey: "<VLMRUN_API_KEY>"
});
// Create the agent using a prompt
const response = await client.agent.create({
name: "invoice-extractor", // Optional name
inputs: { // Optional test inputs
file: {
type: "file_url",
file_url: {
url: "https://example.com/invoice.pdf"
}
}
},
config: {
prompt: "Extract the invoice_id, date and amount from the invoice.",
json_schema: JSON.stringify(InvoiceSchema.shape)
}
});
{
"id": "<string>",
"name": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"updated_at": "2023-11-07T05:31:56Z",
"status": "pending"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}!pip install vlmrun
from pydantic import BaseModel, Field
import datetime
from vlmrun.client import VLMRun
from vlmrun.client.types import AgentCreationResponse, AgentCreationConfig, AgentExecutionResponse
from vlmrun.types import MessageContent, FileUrl
# Define a Pydantic model for the execution inputs
class ExecutionInputs(BaseModel):
file: MessageContent = Field(..., description="The file to extract data from")
# Define a Pydantic model for the response
class Invoice(BaseModel):
invoice_id: str = Field(..., description="The ID of the invoice")
invoice_date: datetime.date = Field(..., description="The date of the invoice")
total_amount: float = Field(..., description="The total amount of the invoice")
# Initialize the client
client = VLMRun(api_key="<VLMRUN_API_KEY>")
# Create the agent using a prompt
response: AgentCreationResponse = client.agent.create(
name="invoice-extractor", # Optional name
inputs=ExecutionInputs(file=MessageContent(type="file_url", file_url=FileUrl(url="https://example.com/invoice.pdf"))), # Optional test inputs
config=AgentCreationConfig(prompt="Extract the invoice_id, date and amount from the invoice.", response_model=Invoice),
)
npm install vlmrun zod
import { VlmRun } from 'vlmrun';
import { z } from 'zod';
// Define a Zod schema for the execution inputs
const ExecutionInputsSchema = z.object({
file: z.object({
type: z.literal("file_url"),
file_url: z.object({
url: z.string()
})
}).describe("The file to extract data from")
});
// Define a Zod schema for the response
const InvoiceSchema = z.object({
invoice_id: z.string().describe("The ID of the invoice"),
invoice_date: z.string().date().describe("The date of the invoice"),
total_amount: z.number().describe("The total amount of the invoice")
});
// Initialize the client
const client = new VlmRun({
baseUrl: "https://api.vlm.run/v1",
apiKey: "<VLMRUN_API_KEY>"
});
// Create the agent using a prompt
const response = await client.agent.create({
name: "invoice-extractor", // Optional name
inputs: { // Optional test inputs
file: {
type: "file_url",
file_url: {
url: "https://example.com/invoice.pdf"
}
}
},
config: {
prompt: "Extract the invoice_id, date and amount from the invoice.",
json_schema: JSON.stringify(InvoiceSchema.shape)
}
});
Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
Request to create an agent.
The configuration for the agent creation request.
Hide child attributes
Hide child attributes
The prompt to guide the creation of the agent.
The JSON schema to the agent
The type of tools to use for the agent
document, image, video, multimodal List of agent skills to enable for this execution. Skills provide domain-specific expertise and capabilities.
Hide child attributes
Hide child attributes
The type of the skill. Use 'skill_reference' for DB-stored skills referenced by id/name. Use 'inline' to provide the skill as a base64-encoded zip bundle.
The unique identifier of the skill — a UUID or a name string (e.g., 'pillow', 'batch-processing').
Human-readable skill name for lookup (e.g., 'invoice-extraction'). Alternative to skill_id. Deprecated in favour of skill_id.
The version of the skill — an integer (e.g. 2) or 'latest'.
DEPRECATED: Use 'skill_version' instead. The version of the skill.
Human-readable name for the inline skill (used for discovery and logging).
Short description of what the inline skill does.
Source payload for inline skills. Contains the base64-encoded zip bundle with type, media_type, and data fields.
Hide child attributes
Hide child attributes
Base64-encoded zip bundle containing the skill files.
Encoding type for the inline skill data. Currently only 'base64' is supported.
"base64"MIME type of the skill bundle. Must be 'application/zip'.
DEPRECATED: Use 'source.data' instead. Base64-encoded zip bundle containing the skill files (inline skills only).
List of tool names to use for this agent execution. If provided, only these tools will be loaded. Tool names should match function names exactly.
Reuse cached representations of large document/video inputs across calls in the same session to reduce input-token cost and latency.
Delivery tier for the agent run. auto/default/None resolves to standard (baseline 1.0× billing); flex is 0.5× billing with higher latency, and priority is 1.8× billing with a premium latency SLO.
auto, default, standard, flex, priority Unique identifier of the request.
Date and time when the request was created (in UTC timezone)
The URL to call when the request is completed.
1VLM Run Agent model to use for agent creation. When omitted, the skill's vlmrun.yaml model is used; otherwise the agent default.
vlmrun-orion-1, vlmrun-orion-1:auto, vlmrun-orion-1:fast, vlmrun-orion-1:pro, vlmrun-orion-2, vlmrun-orion-2:auto Name of the agent. If not provided, a pretty-name will be generated.
The inputs to the agent.
Response
Successful Response
Response to the agent creation request.
ID of the agent
Name of the agent
Date and time when the agent was created (in UTC timezone)
Date and time when the agent was updated (in UTC timezone)
The status of the job.
pending, enqueued, running, completed, failed, paused