For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Sign inBook a demo
DocsReferenceChangelog
DocsReferenceChangelog
  • Introduction
    • Overview
    • Errors
  • SDK
    • Overview
    • Decorators
    • Run Evaluation
  • API
      • POSTLog to a Flow
      • PATCHUpdate Flow Log
      • GETGet Flow
      • DELDelete Flow
      • PATCHMove Flow
      • GETList Flows
      • POSTUpsert Flow
      • GETList Versions of a Flow
      • DELDelete Flow Version
      • PATCHUpdate Flow Version
      • POSTDeploy Flow
      • DELRemove Deployment
      • GETList a Flow's Environments
      • POSTUpdate Monitoring
LogoLogo
Sign inBook a demo
APIFlows

Upsert Flow

POST
https://api.humanloop.com/v5/flows
POST
/v5/flows
$curl -X POST https://api.humanloop.com/v5/flows \
> -H "X-API-KEY: <apiKey>" \
> -H "Content-Type: application/json" \
> -d '{
> "attributes": {
> "prompt": {
> "template": "You are a helpful medical assistant helping with medical anamnesis. Answer {{question}}",
> "model": "gpt-4o",
> "temperature": 0.8
> },
> "tool": {
> "name": "retrieval_tool_v3",
> "description": "Retrieval tool for MedQA.",
> "source_code": "def retrieval_tool(question: str) -> str:\n pass\n"
> },
> "version_name": "medqa-flow-v1",
> "version_description": "Initial version"
> },
> "path": "Personal Projects/MedQA Flow"
>}'
1{
2 "path": "Personal Projects/MedQA",
3 "id": "fl_6o701g4jmcanPVHxdqD0O",
4 "attributes": {
5 "prompt": {
6 "template": "You are a helpful assistant helping with medical anamnesis",
7 "model": "gpt-4o",
8 "temperature": 0.8
9 },
10 "tool": {
11 "name": "retrieval_tool_v3",
12 "description": "Retrieval tool for MedQA.",
13 "source_code": "def retrieval_tool(question: str) -> str:\n pass\n"
14 }
15 },
16 "name": "MedQA Flow",
17 "version_id": "flv_7ZNQREaScH0JkhUwtXrLN",
18 "created_at": "2024-07-08T22:40:35.656915",
19 "updated_at": "2024-07-08T22:40:35.656915",
20 "last_used_at": "2024-07-08T22:40:35.656915",
21 "version_logs_count": 0,
22 "version_name": "medqa-flow-v1",
23 "version_description": "Initial version",
24 "type": "flow",
25 "environments": [
26 {
27 "id": "env_ffSVxEBzJcBZ1H5jcNMVj",
28 "created_at": "2023-06-27T23:16:07.992339",
29 "name": "development",
30 "tag": "default"
31 }
32 ],
33 "created_by": {
34 "id": "usr_01RJO1k2spBVqNUt1ASef",
35 "email_address": "raza@humanloop.com",
36 "full_name": "Raza Habib"
37 },
38 "evaluator_aggregates": null
39}

Create or update a Flow.

Flows can also be identified by the ID or their path.

You can provide version_name and version_description to identify and describe your versions. Version names must be unique within a Flow - attempting to create a version with a name that already exists will result in a 409 Conflict error.

Was this page helpful?
Previous

List Versions of a Flow

Next
Built with

Authentication

X-API-KEYstring
API Key authentication via header

Request

This endpoint expects an object.
attributesmap from strings to anyRequired

A key-value object identifying the Flow Version.

pathstringOptional

Path of the Flow, including the name. This locates the Flow in the Humanloop filesystem and is used as as a unique identifier. For example: folder/name or just name.

idstringOptional
ID for an existing Flow.
version_namestringOptional
Unique name for the Flow version. Version names must be unique for a given Flow.
version_descriptionstringOptional
Description of the version, e.g., the changes made in this version.

Response

Successful Response
pathstring
Path of the Flow, including the name, which is used as a unique identifier.
idstring
Unique identifier for the Flow.
attributesmap from strings to any

A key-value object identifying the Flow Version.

namestring
Name of the Flow.
version_idstring
Unique identifier for the specific Flow Version. If no query params provided, the default deployed Flow Version is returned.
created_atdatetime
updated_atdatetime
last_used_atdatetime
version_logs_countinteger
The number of logs that have been generated for this Flow Version
directory_idstring
ID of the directory that the file is in on Humanloop.
version_namestring
Unique name for the Flow version. Version names must be unique for a given Flow.
version_descriptionstring
Description of the Version.
descriptionstring
Description of the Flow.
schemamap from strings to any
The JSON schema for the File.
readmestring
Long description of the file.
tagslist of strings
List of tags associated with the file.
type"flow"
environmentslist of objects
The list of environments the Flow Version is deployed to.
created_byany
The user who created the Flow.
evaluator_aggregateslist of objects
Aggregation of Evaluator results for the Flow Version.
evaluatorslist of objects
The list of Monitoring Evaluators associated with the Flow Version.

Errors

422
Upsert Flows Post Request Unprocessable Entity Error