You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: splunklib/ai/README.md
+79-7Lines changed: 79 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -647,7 +647,9 @@ async with Agent(
647
647
await agent.invoke(...)
648
648
```
649
649
650
-
**Note**: Input schemas can only be used by subagents, not by regular agents. When invoking agents with external data, see [Security](#security) for guidance on how to do this safely.
650
+
> **Note**: Input schemas can only be used by subagents, not by regular agents. When invoking agents with external data, see [Security](#security) for guidance on how to do this safely.
651
+
652
+
> **Note**: Subagents with an `input_schema` receive their input via `invoke_with_data`, which separates instructions from data and reduces the risk of prompt injection. Subagents without an `input_schema` receive their input as a plain message, which provides weaker injection resistance - use them with caution when the supervisor may pass untrusted data.
651
653
652
654
## Middleware
653
655
@@ -1003,9 +1005,27 @@ Additionally logs from local tools are also forwarded to this logger.
1003
1005
1004
1006
## Security
1005
1007
1006
-
When invoking the agent with external data (log entries, alert payloads, API responses, etc.),
1007
-
use `invoke_with_data` instead of `invoke`. It separates your instructions from the untrusted
1008
-
data, reducing the risk of prompt injection:
1008
+
The SDK provides layered, automatic defenses and opt-in utilities to help you build secure
1009
+
agentic applications. Automatic protections are active for every agent with no configuration
1010
+
required. Opt-in utilities give you additional control where your use case requires it.
1011
+
1012
+
### What's on by default
1013
+
1014
+
| Protection | Default |
1015
+
|---|---|
1016
+
| Token limit | 200 000 tokens |
1017
+
| Step limit | 100 steps |
1018
+
| Timeout | 600 seconds per `invoke`|
1019
+
| System prompt hardening | Automatic - security rules are appended to every agent's system prompt |
1020
+
1021
+
See [Overriding defaults](#overriding-defaults) to customize or override these limits.
1022
+
1023
+
### Prompt injection
1024
+
1025
+
The SDK automatically appends injection-resistance rules to every agent's system prompt, so you
1026
+
do not need to add them manually. For additional protection when passing external or user-supplied
1027
+
data into the agent, use `invoke_with_data` instead of `invoke`. It separates your instructions
1028
+
from the untrusted data, reducing the risk of prompt injection:
1009
1029
1010
1030
```py
1011
1031
from splunklib.ai.messages import HumanMessage
@@ -1035,6 +1055,7 @@ result = await agent.invoke([
1035
1055
])
1036
1056
```
1037
1057
1058
+
For additional opt-in protection, the SDK provides `truncate_input` and `detect_injection`.
1038
1059
`truncate_input` caps the input length inline when constructing a message. `detect_injection`
1039
1060
scans for common injection patterns - one way to apply it consistently is via `agent_middleware`,
1040
1061
which gives you a single place to enforce the policy across every `invoke()` call. You decide
0 commit comments