OSDK Agent Stuido strreaming API - InvalidJson Error When Passing String Parameters via Streaming API

I’m building a React Native app that integrates with an AIP Agent using the Foundry Streaming API (/api/v2/aipAgents/…/streamingContinue). I need to pass user context (userId and timezone) to the agent via parameterInputs.
My Agent Configuration
I have two application state variables configured in AIP Agent Studio:

currentUserId (String type)
userTimezone (String type)

When I call the Get Agent API, I see they’re configured as:

json{
“currentUserId”: {
“parameterType”: {“type”: “string”, “defaultValue”: “”},
“access”: “READ_ONLY”,
“description”: “”
},
“userTimezone”: {
“parameterType”: {“type”: “string”, “defaultValue”: “”},
“access”: “READ_ONLY”,
“description”: “The user’s home timezone”
}
}

My API Request
Following the API documentation for ParameterValue structure, I’m sending to the streamingContinue endpoint:

Request URL:
POST /api/v2/aipAgents/agents/{agentRid}/sessions/{sessionRid}/streamingContinue?preview=true
Request Body:
json{
“messageId”: “a115561xxxxxx6”,
“userInput”: {
“text”: “Create a dinner event tomorrow at 7 PM”
},
“parameterInputs”: {
“currentUserId”: {
“string”: {
“value”: “b9ef1be9-320ssssss64f142”
}
},
“userTimezone”: {
“string”: {
“value”: “America/Chicago”
}
}
}
}

The Error
I consistently get a 400 Bad Request with:

json{
“errorCode”: “INVALID_ARGUMENT”,
“errorName”: “InvalidJson”,
“errorInstanceId”: “d10b519xxxxxxxxx0140”,
“parameters”: {}
}

The response comes back in ~28ms, suggesting it’s failing validation before reaching the agent.
What I’ve Tried

:white_check_mark: Verified the JSON structure matches the API docs for string ParameterValue
:white_check_mark: Tested without parameterInputs - works fine (but agent can’t access context)
:white_check_mark: Tried flat structure (“currentUserId”: “user-123”) - same error
:white_check_mark: Verified parameter names match exactly (case-sensitive)
:white_check_mark: Confirmed preview=true is in the query string
:white_check_mark: Tested with both blockingContinue and streamingContinue - same error

My Questions

Can READ_ONLY parameters accept values via parameterInputs?

The documentation states “Use the parameterInputs field in requests to provide inputs” but doesn’t clarify how this interacts with the access field in the agent configuration.

What is the correct access level for parameters that should be:

:white_check_mark: Written by the API (from my React Native app)
:white_check_mark: Read by the Agent (to use in event creation)
:cross_mark: Not written by the Agent

Where in AIP Agent Studio can I change the access level?

I see “Agent can see the variable value” toggle in the parameter configuration
But I don’t see an explicit READ_ONLY/READ_WRITE/READ setting
Is the access level configured somewhere else?

For streaming API specifically, is there a different format expected for parameterInputs?
Alternative approaches: If READ_ONLY parameters can’t accept API inputs, what’s the recommended way to pass user-specific context (userId, timezone) to an agent?

Reference Documentation
From the API docs:

parameterInputs map<ParameterId, ParameterValue> (optional)
Any supplied values for application variables to pass to the Agent for the exchange.

ParameterValue (union)
The value provided for a variable configured in the application state of an Agent.

string (object, optional): A value passed for StringParameter application variable types.

value (string)

Example from docs (using objectSet type):

json{
“messageId”: “00f8412a-c29d-4063-a417-8052825285a5”,
“userInput”: {“text”: “What is the status of my order?”},
“parameterInputs”: {
“currentCustomerOrders”: {
“type”: “objectSet”,
“ontology”: “example-ontology”,
“objectSet”: {…}
}
}
}

The docs show objectSet parameters but don’t show a complete example of string parameters.
Environment

Endpoint: /api/v2/aipAgents/agents/{agentRid}/sessions/{sessionRid}/streamingContinue?preview=true
Agent version: 9.0
Integration: Custom React Native mobile app via REST API
Testing with both iOS simulator and actual logs confirm the same error

Additional Context
When I omit parameterInputs entirely, the agent responds but says “I wasn’t able to access your user information just yet” - confirming the agent is looking for these variables but they’re not being passed successfully.
Any guidance on the correct way to pass string parameters to the streaming API would be greatly appreciated!

Hi I think I know what is happening here.
I think you are supplying your parameters like this

"parameterInputs": {
    "parameterName": {
        "string" : {
            ...
        }
    } ...
}

I think what should work is this format

"parameterInputs": {
    "parameterName": {
        "type": "string",
        "string" : {
            ...
        }
    } ... 
}

This is just due to the way our backend serializes your request.
Give this a try and let me know if it still doesn’t work!

Updates:

After chatting with the team, turns out the response above was slightly incorrect. The correct format should look something like this

"parameterInputs": {
    "parameterName": {
        "type": "string",
        "value" : ...
    } ... 
}

Where the fields of the string are in the same object as the “type”: “string”

1 Like