> ## Documentation Index
> Fetch the complete documentation index at: https://docs.onecortex.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Strands Agents

> Deploy a Strands agent as it is: streamed text, tool calls as they form, and tool results.

## What is supported

`strands-agents` 1.0 and later. Onecortex recognises a Strands `Agent` and streams it with `stream_async`.

## A complete agent

```yaml agent.yml theme={null}
apiVersion: v1
runtime: python3.12
entrypoint: agent.py:agent
dependencies: requirements.txt
```

```text requirements.txt theme={null}
strands-agents[openai]>=1.0
```

```python agent.py theme={null}
import os

from strands import Agent, tool
from strands.models.openai import OpenAIModel


@tool
def word_count(text: str) -> int:
    """Counts the words in a piece of text."""
    return len(text.split())


# OPENAI_API_KEY is a secret you add on the agent's Config tab.
model = OpenAIModel(client_args={"api_key": os.environ["OPENAI_API_KEY"]}, model_id="gpt-5")
agent = Agent(model=model, tools=[word_count])
```

Add `OPENAI_API_KEY` as a secret on the agent's **Config** tab, then deploy. Any model works: this one is an example. See [Configuration and secrets](/build/configuration).

<Card title="A complete Strands Agents example" icon="github" href="https://github.com/onecortex-io/examples/tree/main/weather-planner">
  `weather-planner`: A day planner that checks a forecast tool first, on the oldest supported release. It runs with no model key.
</Card>

## The prompt and the reply

The prompt is the agent's input. The reply is its streamed text.

## Events it reports

| Events | From |
| - | - |
| `text` | The streamed text |
| `tool_call_start`, `tool_call_args`, `tool_call_end` | Each tool call as the model forms it |
| `tool_result` | Each tool's result, with `isError` when it failed |
| `done` or `error` | The end of the run: always exactly one |

See [Streaming and events](/build/streaming).

## The caller's fields

In the invocation state, as `invocation_state["onecortex"]`, which Strands hands to tools that ask for their context:

```python theme={null}
from strands import ToolContext, tool


@tool(context=True)
def get_forecast(city: str, tool_context: ToolContext) -> str:
    params = tool_context.invocation_state["onecortex"]["params"]
    units = params.get("units", "metric")
    ...
```

**Sessions:** Strands' own session managers are not connected. The same `sessionId` reaches the same running instance, where the agent object keeps its conversation in memory. See [Sessions](/build/sessions).

## Known limits

* Choose a model explicitly: an agent created without `model=` uses Strands' default provider, which needs credentials you would have to supply.

## Troubleshooting

| You see | Do this |
| - | - |
| The build's smoke test fails with a credentials error from the model | Pass `model=` explicitly, and add its key as a secret. |

More on [Troubleshooting](/production/troubleshooting) and [Errors](/production/errors).
