POST
/
enhance_task
curl --request POST \
  --url https://osmosis.gulp.dev/enhance_task \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --data '{
  "tenant_id": "YOUR_API_KEY",
  "input_text": "what is my top trending product selling right now"
}'
{
  "response": "<string>",
  "metadata": {}
}

The /enhance_task endpoint enriches tasks with relevant knowledge and context to improve agent responses.

This endpoint should be used whenever a user is prompting an agent. If your agent spawns sub sub agents, each sub task should also call this endpoint.

Base URL

POST https://osmosis.gulp.dev/enhance_task

Authentication

Request Body

Root Level Parameters

tenant_id
string
required

Unique identifier that corresponds to a dedicated recommendation collection, enabling sub-tenancy isolation for different agentic workflows.

input_text
string
required

The agent’s input/query. This can be a user prompt, or the task given to a sub agent.

agent_type
string

Type of agent making the request (e.g., ‘browser’, ‘orchestrator’). Best used in multi-agent environments.

Example Requests

curl -X POST https://osmosis.gulp.dev/enhance_task \
  -H "Content-Type: application/json" \
  -H "x-api-key: your-api-key" \
  -d '{
    "tenant_id": "api_key",
    "input_text": "Process refund request for damaged item",
    "agent_type": "support_agent"
  }'

Response

Success Response

response
string
required

The processed response with enhanced context and recommendations

metadata
object

Additional metadata about the enhancement process and results

Example success response:

{
  "response": "Process refund request for damaged item, note that the item is damaged and the user has not provided a valid reason for the refund. Check the company return policy manual for section 1.2 on damaged items.",
  "metadata": {
    "confidence_score": 0.45,
    "agent_type": "support_agent"
  }
}

The confidence score in the metadata is currently a simple computation based on our Monte Carlo Tree Search process. While it provides a general indication, it should not be treated as a definitive metric of response quality at this stage. We only provide confidence score if it is below 0.7

Error Response

detail
array
required

Array of error details

Example error response:

{
  "detail": [
    {
      "loc": ["body", "tenant_id"],
      "msg": "field required",
      "type": "value_error.missing"
    }
  ]
}

Status Codes

Error Codes

CodeDescription
value_error.missingRequired field is missing
value_error.jsonInvalid JSON in request body
type_errorIncorrect type for a field
value_errorInvalid value for a field

Best Practices

  1. Request Timing

    • Call this endpoint before agent execution
    • Use it for both main tasks and sub-tasks
  2. Input Text Formatting

    • Keep input text clear and specific
    • Include relevant context
    • Use consistent formatting across requests
  3. Agent Type Usage

    • Always specify agent_type when using multiple agents
    • Use consistent agent type names
    • Document agent types in your system
  4. Error Handling

    • Implement proper retry logic
    • Cache successful responses
    • Handle validation errors gracefully

Authorizations

x-api-key
string
header
required

Body

application/json

Agent input data including the query text and context

Response

200
application/json

Successful Response

Response enhanced with relevant past knowledge.